Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .global partition, arr
- partition:
- push %ebp
- mov %esp, %ebp
- sub $4, %esp
- /*mov (%edi), %eax
- call writei32*/
- // the second element for while
- mov %esi, -4(%ebp)
- sub $1, -4(%ebp)
- mov $0, %eax
- while:
- cmp %eax, -4(%ebp)
- jl fin
- /*call writei32
- mov %eax, %ecx
- mov -4(%ebp), %eax
- call writei32
- mov %ecx, %eax
- mov $0, %ecx*/
- mov %eax, %ecx
- mov -4(%ebp), %eax
- call writei32
- mov %ecx, %eax
- mov $0, %ecx
- mov (%ebx, %eax, 2), %cx
- /*mov %eax, %edx
- mov $0, %eax
- mov %cx, %ax
- call writei32
- mov %edx, %eax*/
- cmp (%edi), %ecx
- jl swap
- /*mov %eax, %edx
- mov (%edi), %eax
- call writei32
- mov %edx, %eax*/
- inc %eax
- jmp while
- swap:
- mov %eax, %edx
- mov $228, %eax
- call writei32
- mov %edx, %eax
- sub $1, -4(%ebp)
- jmp while
- fin:
- mov %ebp, %esp
- pop %ebp
- ret
- .global main
- main:
- call readi32
- mov %eax, %esi
- mov $0, %ebx
- readloop:
- call readi32
- mov %ax, arr(, %ebx, 2)
- inc %ebx
- cmp %esi, %ebx
- jne readloop
- mov $0, %ebx
- call readi32
- mov %eax, (%edi)
- mov $arr, %ebx
- call partition
- writeloop:
- xor %eax, %eax
- mov arr(, %ebx, 2), %ax
- call writei32
- inc %ebx
- cmp %esi, %ebx
- jne writeloop
- end:
- mov %edx, %eax
- call writei32
- call finish
- .data
- arr:
- .skip 64
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement