Question
{Convert this to Y86 please} bubbleSort: pushl %ebp movl %esp, %ebp pushl %edi pushl %esi pushl %ebx movl 8(%ebp), %edi movl 12(%ebp), %eax leal -1(%eax),
{Convert this to Y86 please}
bubbleSort:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
movl 8(%ebp), %edi
movl 12(%ebp), %eax
leal -1(%eax), %esi
testl %esi, %esi
jle .L1
leal -4(%edi,%eax,4), %ebx
jmp .L3
.L5:
movl (%eax), %ecx
movl 4(%eax), %edx
cmpl %edx, %ecx
jle .L4
movl %ecx, 4(%eax)
movl %edx, (%eax)
.L4:
addl $4, %eax
cmpl %ebx, %eax
jne .L5
.L6:
subl $4, %ebx
subl $1, %esi
je .L1
.L3:
testl %esi, %esi
jle .L6
movl %edi, %eax
jmp .L5
.L1:
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size bubbleSort, .-bubbleSort
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
pushl $10
pushl $array
call bubbleSort
addl $8, %esp
leave
ret
.size main, .-main
.globl array
.data
.align 32
.type array, @object
.size array, 40
array:
.long 10
.long 9
.long 8
.long 7
.long 6
.long 5
.long 4
.long 3
.long 2
.long 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started