27 lines
321 B
Text
27 lines
321 B
Text
|
|
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
|