28 lines
304 B
Text
28 lines
304 B
Text
def fact ()
|
|
local n:
|
|
n <- copy %rdi;
|
|
|
|
%rax <- copy 1;
|
|
|
|
condition:
|
|
jumpif lte n, 1 -> fin, boucle;
|
|
|
|
boucle:
|
|
%rax <- mul %rax, n;
|
|
n <- sub n, 1;
|
|
jump condition;
|
|
|
|
fin:
|
|
ret;
|
|
end
|
|
|
|
globals (x)
|
|
%rdi <- copy 5;
|
|
fact();
|
|
x <- copy %rax;
|
|
|
|
%rdi <- copy x;
|
|
observe_int();
|
|
|
|
exit;
|
|
end
|