2024-05-11 15:22:08 -05:00
|
|
|
main := fn(): int {
|
2024-05-11 11:16:27 -05:00
|
|
|
return fib(10);
|
|
|
|
}
|
|
|
|
|
2024-05-11 15:22:08 -05:00
|
|
|
fib := fn(n: int): int {
|
2024-05-11 11:16:27 -05:00
|
|
|
a := 0;
|
|
|
|
b := 1;
|
|
|
|
loop {
|
2024-05-12 15:40:28 -05:00
|
|
|
if n == 0 {
|
|
|
|
break;
|
|
|
|
}
|
2024-05-11 11:16:27 -05:00
|
|
|
c := a + b;
|
|
|
|
a = b;
|
|
|
|
b = c;
|
2024-05-15 03:37:39 -05:00
|
|
|
n -= 1;
|
2024-05-14 05:17:39 -05:00
|
|
|
|
|
|
|
stack_reclamation_edge_case := 0;
|
|
|
|
|
2024-05-11 11:16:27 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|