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/06.retrolix

29 lines
304 B
Text
Raw Normal View History

2023-12-31 15:59:53 +01:00
def fact ()
2023-12-31 23:16:39 +01:00
local n:
n <- copy %rdi;
2023-12-31 15:59:53 +01:00
%rax <- copy 1;
condition:
2023-12-31 23:16:39 +01:00
jumpif lte n, 1 -> fin, boucle;
2023-12-31 15:59:53 +01:00
boucle:
2023-12-31 23:16:39 +01:00
%rax <- mul %rax, n;
n <- sub n, 1;
2023-12-31 15:59:53 +01:00
jump condition;
fin:
ret;
end
globals (x)
2023-12-31 23:16:39 +01:00
%rdi <- copy 5;
2023-12-31 15:59:53 +01:00
fact();
x <- copy %rax;
%rdi <- copy x;
observe_int();
2023-12-31 23:16:39 +01:00
exit;
2023-12-31 15:59:53 +01:00
end