16 lines
263 B
Text
16 lines
263 B
Text
def fact ()
|
|
%rax <- copy 1;
|
|
boucle: jumpif lte %rdi, 1 -> fin, suite;
|
|
suite: %rax <- mul %rax, %rdi;
|
|
%rdi <- sub %rdi, 1;
|
|
jump boucle;
|
|
fin: ret;
|
|
end
|
|
|
|
globals (res)
|
|
%rdi <- copy 5;
|
|
fact();
|
|
res <- copy %rax;
|
|
%rdi <- copy res;
|
|
print_int();
|
|
end
|