eval.in

Paste #6677

x86 Assembly — NASM 2.07, pasted 4 years ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
extern printf
global main

fib:
  mov ecx, [esp+4]
  xor eax, eax
  mov ebx, 1
.iter:
  add ebx, eax
  xchg ebx, eax
  loop .iter
  ret

main:
  push dword 30
  call fib
  add esp, 4
  
  push eax
  push fmt
  call printf
  add esp, 8
  
  xor eax, eax
  ret

fmt db "%d", 10, 0

Program Output

832040

OK (0.000 sec real, 0.000 sec wall, 2 MB, 26 syscalls)

Fork