Advertisement
_takumi

lizing

Sep 30th, 2022
883
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. %include "io64.inc"
  2.  
  3. extern scanf
  4. extern printf
  5.  
  6. section .rodata
  7.     fstr db '%d', 0
  8.     fstr1 db '%ll', 0
  9.    
  10. section .bss
  11.     n resd 1
  12.  
  13. section .text
  14. global CMAIN
  15. CMAIN:
  16.     mov ebp, esp
  17.     and esp, -16
  18.     sub esp, 8
  19.     push n
  20.     push fstr
  21.     call scanf
  22.     mov eax, 1
  23. .loop:
  24.     cmp dword [n], 0
  25.     je .loop_end
  26.     mul dword [n]
  27.     dec dword [n]
  28.     jmp .loop
  29. .loop_end:
  30.     ;mov dword [res], eax
  31.     mov dword [esp + 8], edx
  32.     mov dword [esp + 4], eax
  33.     mov dword [esp], fstr1
  34.     call printf
  35.     mov esp, ebp
  36.     xor eax, eax
  37.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement