Advertisement
Guest User

asd

a guest
Nov 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .intel_syntax noprefix
  2.  
  3. .global main
  4. .text
  5.  
  6.   main:
  7.       push offset x
  8.       push offset y
  9.       call scanf
  10.       add esp,8
  11.  
  12.   fibonacci:
  13.       push ebp
  14.       mov ebp, esp
  15.       mov eax, [ebp+8]
  16.       cmp eax, 1
  17.       ja recurse
  18.       mov ecx, 1
  19.       jmp exit
  20.  
  21.   recurse:
  22.       dec eax
  23.       mov edx, eax
  24.       push edx
  25.       push eax
  26.       call fibonacci
  27.       pop eax
  28.       dec eax
  29.       push ecx
  30.       push eax
  31.       call fibonacci
  32.       pop eax
  33.       add ecx, eax
  34.  
  35.   exit:
  36.       mov esp,ebp
  37.       pop ebp
  38.       ret
  39.  
  40. .data
  41. x: .int 0
  42. y: .asciz "%d"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement