7
This commit is contained in:
parent
ccf1f51a75
commit
a2724c4e41
1 changed files with 27 additions and 0 deletions
|
@ -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
|
Reference in a new issue