This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
compilation/flap/questions/retrolixToX86_64/07.retrolix
2023-12-31 23:16:39 +01:00

26 lines
307 B
Text

def fact ()
local n:
n <- copy %rdi;
jumpif lte n, 1 -> fini, rec;
fini:
%rax <- copy 1;
ret;
rec:
%rdi <- sub n, 1;
fact();
%rax <- mul %rax, n;
ret;
end
globals (x)
%rdi <- copy 5;
fact();
x <- copy %rax;
%rdi <- copy x;
observe_int();
exit;
end