Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- sir: .space 400
- res: .space 4
- atoiRes: .space 4
- op1: .space 4
- formatScanf: .asciz "%[^\n]*400"
- printnr: .asciz "%d\n"
- delim: .asciz " "
- .text
- .global main
- main:
- //scanf("[^\n]*400", &sir)
- pushl $sir
- pushl $formatScanf
- call scanf
- popl %ebx
- popl %ebx
- //gets(sir)
- //pushl $sir
- //call gets
- //popl %ebx
- push $delim
- pushl $sir
- call strtok
- popl %ebx
- popl %ebx
- movl %eax, res
- pushl res
- call atoi
- popl %ebx
- movl %eax, atoiRes
- pushl atoiRes
- et_for:
- pushl $delim
- pushl $0
- call strtok
- popl %ebx
- popl %ebx
- cmp $0, %eax
- je et_exit
- movl %eax, res
- pushl res
- call atoi
- popl %ebx
- movl %eax, atoiRes
- cmp $0, atoiRes
- je operatie
- pushl atoiRes
- jmp et_for
- operatie:
- movl res, %edi
- xorl %ecx, %ecx
- movb (%edi, %ecx, 1), %al
- cmp $97, %al
- je adunare
- cmp $115, %al
- je scadere
- cmp $109, %al
- je inmultire
- cmp $100, %al
- je impartire
- adunare:
- popl op1
- popl %eax
- addl op1, %eax
- pushl %eax
- jmp et_for
- scadere:
- popl op1
- popl %eax
- subl op1, %eax
- pushl %eax
- jmp et_for
- inmultire:
- popl op1
- popl %eax
- mull op1
- pushl %eax
- jmp et_for
- impartire:
- popl op1
- popl %eax
- xorl %edx, %edx
- divl op1
- pushl %eax
- jmp et_for
- et_exit:
- pushl $printnr
- call printf
- popl %ebx
- popl %ebx
- movl $1, %eax
- xorl %ebx, %ebx
- int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement