daily pastebin goal
8%
SHARE
TWEET

Untitled

Dari_ Mar 24th, 2019 68 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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top