19 lines
303 B
Text
19 lines
303 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();
|
|
|
|
%rdi <- copy "\n";
|
|
print_string();
|
|
end
|