Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global _inAsm
- .extern print
- _inAsm:
- pushl %ebp
- movl %esp, %ebp
- movl 8(%ebp), %eax #get n
- movl %eax, %ecx # resave n
- # movl $1, %ebx # last=1
- movl $2, %esi # i=2
- while:
- cmpl $1, %eax # n-1 ? 0
- jle exit
- idiv %esi # n/i, eax shi unda sheinaxos ganayofi, edx shi nashti
- cmpl $0, %edx # nashti-0 ? 0
- jne endIf
- movl %esi, %ebx # last=i
- movl %ecx, %eax # save n in eax again
- idiv %esi # n/i, saidanac minda ganayofi anu eax
- movl %eax, %ecx # isev ecx shi shevinaxo ganayofi
- endIf:
- inc %esi
- jmp while
- movl %ebx, %eax
- pushl %eax
- call _print # print 'last', last is in ebx
- exit:
- popl %ebp
- movl %ebp, %esp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement