Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %include "io.inc"
- section .bss
- k resd 1
- a resd 1
- section .text
- f:
- push ebp
- mov ebp, esp
- push ebx
- push ecx
- push edx
- push esi
- mov eax, [ebp + 8]
- mov ecx, [ebp + 12]
- xor ebx, ebx
- .l:
- cdq
- idiv ecx
- xchg eax, ebx
- mov esi, edx
- imul ecx
- add eax, esi
- xchg eax, ebx
- test eax, eax
- jnz .l
- mov eax, ebx
- pop esi
- pop edx
- pop ecx
- pop ebx
- leave
- ret
- global CMAIN
- CMAIN:
- mov ebp, esp; for correct debugging
- GET_DEC 4, k
- GET_DEC 4, ecx
- GET_DEC 4, eax
- mov ebx, 2011
- cdq
- idiv ebx
- mov eax, edx
- .loop:
- imul eax
- push dword[k]
- push eax
- call f
- idiv ebx
- mov eax, edx
- dec ecx
- jnz .loop
- PRINT_DEC 4, eax
- xor eax, eax
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement