From ccf1f51a75e1a8b9fc546eaa716986a6ed60d1d0 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 31 Dec 2023 15:59:53 +0100 Subject: [PATCH] 6 --- flap/questions/retrolixToX86_64/06.retrolix | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/flap/questions/retrolixToX86_64/06.retrolix b/flap/questions/retrolixToX86_64/06.retrolix index e69de29..71a1611 100644 --- a/flap/questions/retrolixToX86_64/06.retrolix +++ b/flap/questions/retrolixToX86_64/06.retrolix @@ -0,0 +1,25 @@ +def fact () + %rax <- copy 1; + + condition: + jumpif lte %rdi, 1 -> fin, boucle; + + boucle: + %rax <- mul %rax, %rdi; + %rdi <- sub %rdi, 1; + jump condition; + + fin: + ret; +end + +globals (x) + x <- copy 5; + + %rdi <- copy x; + fact(); + x <- copy %rax; + + %rdi <- copy x; + observe_int(); +end