Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global sort_by_abs
- .text
- sort_by_abs:
- push %ebp
- mov %esp, %ebp
- push $pre_comparator
- mov $2, %eax
- push %eax
- push 12(%ebp)
- push 8(%ebp)
- call qsort
- xor %eax, %eax
- mov %ebp, %esp
- pop %ebp
- ret
- pre_comparator:
- push %ebp
- mov %esp, %ebp
- mov 8(%ebp), %ecx
- mov (%ecx), %cx
- movswl %cx, %ecx
- mov 12(%ebp), %edx
- mov (%edx), %dx
- movswl %dx, %edx
- checl_first_num:
- cmp $0, %ecx
- jge check_second_num
- mov %ecx, %eax
- sub %eax, %ecx
- sub %eax, %ecx
- check_second_num:
- cmp $0, %edx
- jge comparator
- mov %edx, %eax
- sub %eax, %edx
- sub %eax, %edx
- comparator:
- sub %edx, %ecx
- mov %ecx, %eax
- mov %ebp, %esp
- pop %ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement