This commit is contained in:
Mylloon 2023-12-31 16:03:27 +01:00
parent ccf1f51a75
commit a2724c4e41
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -0,0 +1,27 @@
def fact ()
local x:
jumpif lte %rdi, 1 -> fini, rec;
fini:
%rax <- copy 1;
ret;
rec:
x <- copy %rdi;
%rdi <- sub %rdi, 1;
fact();
%rax <- mul %rax, x;
ret;
end
globals (x)
x <- copy 5;
%rdi <- copy x;
fact();
x <- copy %rax;
%rdi <- copy x;
observe_int();
end