Advertisement
Guest User

Untitled

a guest
Jun 5th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     global _lcm
  2.     section .text
  3. _lcm:
  4.     push ebp
  5.     mov ebp, esp
  6.  
  7.     cmp dword [ebp+12], 0
  8.     je .BaseCase
  9.  
  10. .recurse:
  11.     mov eax, [ebp+8]    ; eax <-- 32-bit "a"
  12.     xor edx, edx        ; edx <-- upper 0 bits
  13.     div dword [ebp+12]
  14.     push edx            ; reszta jest nowym "b"
  15.     mov eax, [ebp+12]
  16.     push eax            ; stare "b" jest nowym "a"
  17.     call _lcm           ; wywołanie rekurencji dla ogona
  18.     leave       ; albo skaczemy do .done aby skończyć
  19.     ret
  20.  
  21. .BaseCase:
  22.     mov eax, [ebp+8]
  23. .done:
  24.     leave
  25.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement