Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %include "io.inc"
- section .data
- n dd 0
- count dd 1
- num dd 1
- section .text
- FUNC:
- push ebp
- mov ebp, esp
- .cont1:
- mov eax, [ebp + 8]
- mov edx, [ebp + 16]
- cmp eax, edx
- je .end2
- mov eax, [ebp + 8]
- mov ecx, [ebp + 16]
- cdq
- div ecx
- cmp edx, 0
- jne .end3
- mov eax, [ebp + 12]
- add eax, ecx
- mov [ebp + 12], eax
- .end3:
- mov edx, [ebp + 16]
- inc edx
- mov [ebp + 16], edx
- jmp .cont1
- .end2:
- mov eax, [ebp + 12]
- mov esp, ebp
- pop ebp
- ret
- global CMAIN
- CMAIN:
- GET_DEC 4, [n]
- .back1:
- mov ecx, dword[count]
- cmp ecx, dword[n]
- je .end1
- mov ecx, dword[num]
- inc ecx
- mov dword[num], ecx
- push ebp
- mov ebp, esp
- sub esp, 12
- mov [esp], ecx
- mov ecx, 1
- mov [esp + 4], ecx
- mov ecx, 2
- mov [esp + 8], ecx
- call FUNC
- mov esp, ebp
- pop ebp
- cmp eax, dword[num]
- jge .not
- mov ecx, dword[count]
- inc ecx
- mov dword[count], ecx
- .not:
- jmp .back1
- .end1:
- PRINT_DEC 4, num
- xor eax, eax
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement