Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %include "io.inc"
- section .data
- section .bss
- n resd 1
- section .text
- foo:
- xor ecx, ecx
- .loop:
- cmp eax, 0
- je .endLoop
- mov ebx, 1
- and ebx, eax
- add ecx, ebx
- shr eax, 1
- mov ebx, 1
- and ebx, eax
- sub ecx, ebx
- shr eax, 1
- jmp .loop
- .endLoop:
- mov eax, ecx
- ret
- global CMAIN
- CMAIN:
- mov ebp, esp; for correct debugging
- GET_UDEC 4, [n]
- xor esi, esi
- .outerLoop:
- cmp esi, dword[n]
- jge .exitOuterLoop
- GET_UDEC 4, eax
- .innerLoop:
- cmp eax, 3
- jl .exitInnerLoop
- call foo
- jmp .innerLoop
- .exitInnerLoop:
- inc esi
- cmp eax, 0
- jne .no
- PRINT_STRING "YES"
- NEWLINE
- jmp .outerLoop
- .no:
- PRINT_STRING "NO"
- NEWLINE
- jmp .outerLoop
- .exitOuterLoop:
- xor eax, eax
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement