program Fibonacci {
section module {
}
section data {
int rax = 0
string str_0 = "enter how many: "
string str_1 = " "
string str_2 = " done "
string fmt_int = "%lld "
string fmt_str = "%s "
string newline = "\n"
string input_buffer, 256
int n = 0
int a = 0
int b = 0
int temp = 0
int i = 0
}
section code {
start:
mov a, 0
mov b, 1
mov i, 2
print fmt_str, str_0
getline input_buffer
to_int n, input_buffer
print fmt_int, a
print fmt_str, str_1
cmp n, 1
jle ELSE_0
print fmt_int, b
print fmt_str, str_1
ELSE_0:
WHILE_4:
cmp i, n
jge ENDWHILE_5
mov temp, a
add temp, b
mov a, b
mov b, temp
print fmt_int, b
print fmt_str, str_1
add i, 1
jmp WHILE_4
ENDWHILE_5:
print fmt_str, str_2
print newline
done
}
}