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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!