Advertisement
Dari_

Untitled

Mar 24th, 2019
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %include "io.inc"
  2.  
  3. section .data
  4.     i dd 1
  5.  
  6. section .text
  7.  
  8. FUNC:
  9.     mov esi, 1
  10.     pop ecx
  11.     LOOP2:
  12.     cmp ecx, 0
  13.     je .end
  14.    
  15.     mov ebx, 1
  16.     mov edi, 2
  17.    
  18.     LOOP1:
  19.     cmp edi, esi
  20.     jge .next
  21.     mov eax, esi
  22.     cdq
  23.     div edi
  24.     cmp edx, 0
  25.     jne .exit
  26.     add ebx, edi
  27.     inc edi
  28.  
  29.     .exit:
  30.     inc edi
  31.     jmp LOOP1
  32.     .next:
  33.     cmp esi, ebx
  34.     jge .L1
  35.     dec ecx
  36.     .L1:
  37.     inc esi
  38.     jmp LOOP2
  39.    
  40.     .end:
  41.     mov eax, esi
  42.    
  43.     xor esi, esi
  44.     xor edi, edi
  45.     xor ebx, ebx
  46.     ret
  47.  
  48. global CMAIN
  49. CMAIN:
  50.     GET_DEC 4, [i]
  51.     push ebp
  52.     mov ebp, esp
  53.     push ecx
  54.     mov ecx, i
  55.     call FUNC
  56.    
  57.     PRINT_DEC 4, eax
  58.     xor eax, eax
  59.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement