Advertisement
Dari_

Untitled

May 26th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %include "io.inc"
  2.  
  3. section .text
  4. global CMAIN
  5.  
  6. GCD:
  7.     push ebp
  8.     mov ebp, esp
  9.     push ebx
  10.    
  11.     mov ecx, [ebp + 8]
  12.     mov ebx, [ebp + 12]
  13.    
  14.     .LOOP:
  15.     cmp ebx, 0
  16.     jle .end
  17.     mov eax, ecx
  18.     cdq
  19.     div ebx
  20.     mov ecx, ebx
  21.     mov ebx, edx
  22.    
  23.     jmp .LOOP
  24.     .end:
  25.     mov eax, ecx
  26.     pop ebx
  27.     leave
  28.     ret
  29.  
  30. CMAIN:
  31.     GET_DEC 4, ebx
  32.     GET_DEC 4, esi
  33.    
  34.     push ebx
  35.     push esi
  36.    
  37.     call GCD
  38.    
  39.     pop esi
  40.     pop ebx
  41.    
  42.     GET_DEC 4, ebx
  43.     mov esi, eax
  44.    
  45.     push ebx
  46.     push esi
  47.    
  48.     call GCD
  49.    
  50.     pop esi
  51.     pop ebx
  52.    
  53.     GET_DEC 4, ebx
  54.     mov esi, eax
  55.    
  56.     push ebx
  57.     push esi
  58.    
  59.     call GCD
  60.    
  61.     pop esi
  62.     pop ebx
  63.    
  64.     PRINT_DEC 4, eax
  65.    
  66.     xor eax, eax
  67.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement