SHARE
TWEET

Untitled

a guest Mar 26th, 2020 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. section .data
  2. format db "%u", 0
  3.  
  4. section .bss
  5. x resd 1
  6. k resd 1
  7.  
  8. section .text
  9. extern _printf
  10. extern _scanf
  11.  
  12. global _main
  13. _main:
  14.     mov ebp, esp
  15.     and esp, 0xfffffff0
  16.     sub esp, 8
  17.     push x
  18.     push format
  19.     call _scanf
  20.     add esp, 16
  21.     sub esp, 8
  22.     push k
  23.     push format
  24.     call _scanf
  25.     add esp, 16
  26.    
  27.     mov ebx, dword[k]
  28.     mov eax, dword[x]
  29.     xor esi, esi
  30.     .cycle1:
  31.         xor edx, edx
  32.         div ebx
  33.         push edx
  34.         inc esi
  35.         test eax, eax
  36.         jnz .cycle1
  37.     .print:
  38.         pop eax
  39.         push ebp
  40.         mov ebp, esp
  41.         and esp, 0xfffffff0
  42.         sub esp, 8
  43.         push eax
  44.         push format
  45.         call _printf
  46.         add esp, 16
  47.         mov esp, ebp
  48.         pop ebp
  49.         dec esi
  50.         test esi, esi
  51.         jnz .print
  52.     add esp, 12
  53.     xor eax, eax
  54.     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