20155216 2017-2018-1 第八周课下作业1
20155216 2017-2018-1 第八周课下作业1
作业内容:
1、完成家庭作业4.47,4.48,4.49。
2、相应代码反汇编成X86-64汇编。
3、把上述X68-64汇编翻译成Y86-64汇编,并给出相应机器码。
作业4.47
A、书写一个C版本的冒泡排序法,用指针引用数组元素,而不是数组索引。
void bubble_a(int *data, int count){
int i,next;
for(next = 1; next < count; next++){
for(i = next - 1; i >= 0; i--)
if(*(data + i + 1) < *(data + i)){
int t = *(data + i + 1);
*(data + i + 1) = *(data + i);
*(data + i) = t;
}
}
}
测试代码:
void main()
{
int data[5]={4,3,2,1,0};
int i;
bubble_a(data,5);
for(i=0;i<5;i++)
{
printf("%2d",data[i]);
}
}
运行结果:
B、书写并测试一个由这个函数和测试代码组成的Y86-64程序。
X86-64汇编:
测试代码汇编:
main:
.LFB2:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $48, %rsp
movq %fs:40, %rax
movq %rax, -8(%rbp)
xorl %eax, %eax
movl $4, -32(%rbp)
movl $3, -28(%rbp)
movl $2, -24(%rbp)
movl $1, -20(%rbp)
movl $0, -16(%rbp)
leaq -32(%rbp), %rax
movl $5, %esi
movq %rax, %rdi
movl $0, %eax
call bubble_a
movl $0, -36(%rbp)
jmp .L2
.L3:
movl -36(%rbp), %eax
cltq
movl -32(%rbp,%rax,4), %eax
movl %eax, %esi
movl $.LC0, %edi
movl $0, %eax
call printf
addl $1, -36(%rbp)
.L2:
cmpl $4, -36(%rbp)
jle .L3
movl $10, %edi
call putchar
nop
movq -8(%rbp), %rax
xorq %fs:40, %rax
je .L4
call __stack_chk_fail
.L4:
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE2:
.size main, .-main
.globl bubble_a
.type bubble_a, @function
功能函数汇编代码:
bubble_a:
.LFB3:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -24(%rbp)
movl %esi, -28(%rbp)
movl $1, -8(%rbp)
jmp .L6
.L10:
movl -8(%rbp), %eax
subl $1, %eax
movl %eax, -12(%rbp)
jmp .L7
.L9:
movl -12(%rbp), %eax
cltq
addq $1, %rax
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rdx, %rax
movl (%rax), %edx
movl -12(%rbp), %eax
cltq
leaq 0(,%rax,4), %rcx
movq -24(%rbp), %rax
addq %rcx, %rax
movl (%rax), %eax
cmpl %eax, %edx
jge .L8
movl -12(%rbp), %eax
cltq
addq $1, %rax
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rdx, %rax
movl (%rax), %eax
movl %eax, -4(%rbp)
movl -12(%rbp), %eax
cltq
addq $1, %rax
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rax, %rdx
movl -12(%rbp), %eax
cltq
leaq 0(,%rax,4), %rcx
movq -24(%rbp), %rax
addq %rcx, %rax
movl (%rax), %eax
movl %eax, (%rdx)
movl -12(%rbp), %eax
cltq
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rax, %rdx
movl -4(%rbp), %eax
movl %eax, (%rdx)
.L8:
subl $1, -12(%rbp)
.L7:
cmpl $0, -12(%rbp)
jns .L9
addl $1, -8(%rbp)
.L6:
movl -8(%rbp), %eax
cmpl -28(%rbp), %eax
jl .L10
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE3:
.size bubble_a, .-bubble_a
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits
X86-64机器码:
000000000000009e <bubble_a>:
9e: 55 push %rbp
9f: 48 89 e5 mov %rsp,%rbp
a2: 48 89 7d e8 mov %rdi,-0x18(%rbp)
a6: 89 75 e4 mov %esi,-0x1c(%rbp)
a9: c7 45 f8 01 00 00 00 movl $0x1,-0x8(%rbp)
b0: e9 ba 00 00 00 jmpq 16f <bubble_a+0xd1>
b5: 8b 45 f8 mov -0x8(%rbp),%eax
b8: 83 e8 01 sub $0x1,%eax
bb: 89 45 f4 mov %eax,-0xc(%rbp)
be: e9 9e 00 00 00 jmpq 161 <bubble_a+0xc3>
c3: 8b 45 f4 mov -0xc(%rbp),%eax
c6: 48 98 cltq
c8: 48 83 c0 01 add $0x1,%rax
cc: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
d3: 00
d4: 48 8b 45 e8 mov -0x18(%rbp),%rax
d8: 48 01 d0 add %rdx,%rax
db: 8b 10 mov (%rax),%edx
dd: 8b 45 f4 mov -0xc(%rbp),%eax
e0: 48 98 cltq
e2: 48 8d 0c 85 00 00 00 lea 0x0(,%rax,4),%rcx
e9: 00
ea: 48 8b 45 e8 mov -0x18(%rbp),%rax
ee: 48 01 c8 add %rcx,%rax
f1: 8b 00 mov (%rax),%eax
f3: 39 c2 cmp %eax,%edx
f5: 7d 66 jge 15d <bubble_a+0xbf>
f7: 8b 45 f4 mov -0xc(%rbp),%eax
fa: 48 98 cltq
fc: 48 83 c0 01 add $0x1,%rax
100: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
107: 00
108: 48 8b 45 e8 mov -0x18(%rbp),%rax
10c: 48 01 d0 add %rdx,%rax
10f: 8b 00 mov (%rax),%eax
111: 89 45 fc mov %eax,-0x4(%rbp)
114: 8b 45 f4 mov -0xc(%rbp),%eax
117: 48 98 cltq
119: 48 83 c0 01 add $0x1,%rax
11d: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
124: 00
125: 48 8b 45 e8 mov -0x18(%rbp),%rax
129: 48 01 c2 add %rax,%rdx
12c: 8b 45 f4 mov -0xc(%rbp),%eax
12f: 48 98 cltq
131: 48 8d 0c 85 00 00 00 lea 0x0(,%rax,4),%rcx
138: 00
139: 48 8b 45 e8 mov -0x18(%rbp),%rax
13d: 48 01 c8 add %rcx,%rax
140: 8b 00 mov (%rax),%eax
142: 89 02 mov %eax,(%rdx)
144: 8b 45 f4 mov -0xc(%rbp),%eax
147: 48 98 cltq
149: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
150: 00
151: 48 8b 45 e8 mov -0x18(%rbp),%rax
155: 48 01 c2 add %rax,%rdx
158: 8b 45 fc mov -0x4(%rbp),%eax
15b: 89 02 mov %eax,(%rdx)
15d: 83 6d f4 01 subl $0x1,-0xc(%rbp)
161: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
165: 0f 89 58 ff ff ff jns c3 <bubble_a+0x25>
16b: 83 45 f8 01 addl $0x1,-0x8(%rbp)
16f: 8b 45 f8 mov -0x8(%rbp),%eax
172: 3b 45 e4 cmp -0x1c(%rbp),%eax
175: 0f 8c 3a ff ff ff jl b5 <bubble_a+0x17>
17b: 90 nop
17c: 5d pop %rbp
17d: c3 retq
Y86-64汇编:
bubble_c:
.LFB22:
.cfi_startproc
pushl %edi
.cfi_def_cfa_offset 8
.cfi_offset 7, -8
pushl %esi
.cfi_def_cfa_offset 12
.cfi_offset 6, -12
pushl %ebx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
mrmovl 16(%esp), %edx
mrmovl 20(%esp), %edi
irmovl $1, %eax
subl %eax, %edi
jle .L1
subl $1, %edi
irmovl $0, %esi
.L6:
rrmovl %esi, %eax
irmovl $0 , ebx
subl %ebx, %esi
jl .L3
.L7:
rrmovl %eax, %ecx
addl %ecx, %ecx
addl %ecx, %ecx
addl %edx, %ecx
mrmovl 4(%ecx), %ecx
rrmovl %eax, %ebx
addl %ecx, %ebx
addl %ecx, %ebx
addl %edx, %ebx
mrmovl (%ebx), %ebx
subl %ebx, %ecx
jge .L4
addl %eax, %eax
addl %eax, %eax
addl %edx, %eax
rmmovl %ebx, 4(%eax)
addl %eax, %eax
addl %eax, %eax
addl %edx, %eax
rmmovl %ecx, 4(%eax)
.L4:
subl $1, %eax
irmovl $-1, %edx
subl %edx, %eax
jne .L7
.L3:
addl $1, %esi
subl %edi, %esi
jne .L6
.L1:
popl %ebx
.cfi_def_cfa_offset 12
.cfi_restore 3
popl %esi
.cfi_def_cfa_offset 8
.cfi_restore 6
popl %edi
.cfi_def_cfa_offset 4
.cfi_restore 7
ret
.cfi_endproc
.LFE22:
.size bubble_c, .-bubble_c
.section .rodata.str1.1,"aMS",@progbits,1
4.48
实现冒泡排序,要求不使用跳转,且最多使用3次条件传送。
void bubble_c(int *data,int count)
{
int i , next;
int pre_ele,next_ele;
for(next = 1;next < count;next++)
{
for(i = next -1;i >= 0;i--)
{
pre_ele = *(data + i);
next_ele = *(data + i + 1);
*(data + i) = next_ele < pre_ele ? next_ele : pre_ele;//三目运算符号
*(data + i + 1) = next_ele < pre_ele ? pre_ele : next_ele;//使用两次条件传送
}
}
}
X86-64汇编:
bubble_c:
.LFB3:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -24(%rbp)
movl %esi, -28(%rbp)
movl $1, -12(%rbp)
jmp .L6
.L9:
movl -12(%rbp), %eax
subl $1, %eax
movl %eax, -16(%rbp)
jmp .L7
.L8:
movl -16(%rbp), %eax
cltq
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rdx, %rax
movl (%rax), %eax
movl %eax, -8(%rbp)
movl -16(%rbp), %eax
cltq
addq $1, %rax
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rdx, %rax
movl (%rax), %eax
movl %eax, -4(%rbp)
movl -16(%rbp), %eax
cltq
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rax, %rdx
movl -4(%rbp), %eax
cmpl %eax, -8(%rbp)
cmovle -8(%rbp), %eax
movl %eax, (%rdx)
movl -16(%rbp), %eax
cltq
addq $1, %rax
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rax, %rdx
movl -8(%rbp), %eax
cmpl %eax, -4(%rbp)
cmovge -4(%rbp), %eax
movl %eax, (%rdx)
subl $1, -16(%rbp)
.L7:
cmpl $0, -16(%rbp)
jns .L8
addl $1, -12(%rbp)
.L6:
movl -12(%rbp), %eax
cmpl -28(%rbp), %eax
jl .L9
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE3:
.size bubble_c, .-bubble_c
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits
X86-64机器码:
000000000000009e <bubble_c>:
9e: 55 push %rbp
9f: 48 89 e5 mov %rsp,%rbp
a2: 48 89 7d e8 mov %rdi,-0x18(%rbp)
a6: 89 75 e4 mov %esi,-0x1c(%rbp)
a9: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%rbp)
b0: e9 97 00 00 00 jmpq 14c <bubble_c+0xae>
b5: 8b 45 f4 mov -0xc(%rbp),%eax
b8: 83 e8 01 sub $0x1,%eax
bb: 89 45 f0 mov %eax,-0x10(%rbp)
be: eb 7e jmp 13e <bubble_c+0xa0>
c0: 8b 45 f0 mov -0x10(%rbp),%eax
c3: 48 98 cltq
c5: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
cc: 00
cd: 48 8b 45 e8 mov -0x18(%rbp),%rax
d1: 48 01 d0 add %rdx,%rax
d4: 8b 00 mov (%rax),%eax
d6: 89 45 f8 mov %eax,-0x8(%rbp)
d9: 8b 45 f0 mov -0x10(%rbp),%eax
dc: 48 98 cltq
de: 48 83 c0 01 add $0x1,%rax
e2: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
e9: 00
ea: 48 8b 45 e8 mov -0x18(%rbp),%rax
ee: 48 01 d0 add %rdx,%rax
f1: 8b 00 mov (%rax),%eax
f3: 89 45 fc mov %eax,-0x4(%rbp)
f6: 8b 45 f0 mov -0x10(%rbp),%eax
f9: 48 98 cltq
fb: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
102: 00
103: 48 8b 45 e8 mov -0x18(%rbp),%rax
107: 48 01 c2 add %rax,%rdx
10a: 8b 45 fc mov -0x4(%rbp),%eax
10d: 39 45 f8 cmp %eax,-0x8(%rbp)
110: 0f 4e 45 f8 cmovle -0x8(%rbp),%eax
114: 89 02 mov %eax,(%rdx)
116: 8b 45 f0 mov -0x10(%rbp),%eax
119: 48 98 cltq
11b: 48 83 c0 01 add $0x1,%rax
11f: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
126: 00
127: 48 8b 45 e8 mov -0x18(%rbp),%rax
12b: 48 01 c2 add %rax,%rdx
12e: 8b 45 f8 mov -0x8(%rbp),%eax
131: 39 45 fc cmp %eax,-0x4(%rbp)
134: 0f 4d 45 fc cmovge -0x4(%rbp),%eax
138: 89 02 mov %eax,(%rdx)
13a: 83 6d f0 01 subl $0x1,-0x10(%rbp)
13e: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
142: 0f 89 78 ff ff ff jns c0 <bubble_c+0x22>
148: 83 45 f4 01 addl $0x1,-0xc(%rbp)
14c: 8b 45 f4 mov -0xc(%rbp),%eax
14f: 3b 45 e4 cmp -0x1c(%rbp),%eax
152: 0f 8c 5d ff ff ff jl b5 <bubble_c+0x17>
158: 90 nop
159: 5d pop %rbp
15a: c3 retq
Y86-64汇编:
bubble_b:
.LFB22:
.cfi_startproc
pushl %edi
.cfi_def_cfa_offset 8
.cfi_offset 7, -8
pushl %esi
.cfi_def_cfa_offset 12
.cfi_offset 6, -12
pushl %ebx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
mrmovl 16(%esp), %edx
mrmovl 20(%esp), %edi
irmovl $1, %eax
subl %eax, %edi
jle .L1
subl $1, %edi
irmovl $0, %esi
.L6:
movl (%ebx,%eax,4), %edx
movl 4(%ebx,%eax,4), %ecx
cmpl %edx, %ecx
movl %edx, %ebp
cmovle %ecx, %ebp
movl %ebp, (%ebx,%eax,4)
cmovge %ecx, %edx
movl %edx, 4(%ebx,%eax,4)
subl $1, %eax
cmpl $-1, %eax
jne .L6
.L7:
rrmovl %eax, %ecx
addl %ecx, %ecx
addl %ecx, %ecx
addl %edx, %ecx
mrmovl 4(%ecx), %ecx
rrmovl %eax, %ebx
addl %ecx, %ebx
addl %ecx, %ebx
addl %edx, %ebx
mrmovl (%ebx), %ebx
subl %ebx, %ecx
jge .L4
addl %eax, %eax
addl %eax, %eax
addl %edx, %eax
rmmovl %ebx, 4(%eax)
addl %eax, %eax
addl %eax, %eax
addl %edx, %eax
rmmovl %ecx, 4(%eax)
.L4:
subl $1, %eax
irmovl $-1, %edx
subl %edx, %eax
jne .L7
.L3:
addl $1, %esi
subl %edi, %esi
jne .L6
.L1:
popl %ebx
.cfi_def_cfa_offset 12
.cfi_restore 3
popl %esi
.cfi_def_cfa_offset 8
.cfi_restore 6
popl %edi
.cfi_def_cfa_offset 4
.cfi_restore 7
ret
.cfi_endproc
.LFE22:
.size bubble_b, .-bubble_b
.section .rodata.str1.1,"aMS",@progbits,1
4.49
实现冒泡排序,要求不使用跳转,且最多使用1次条件传送。
void bubble_c(int *data,int count)
{
int i , next;
int pre_ele,next_ele;
for(next = 1;next < count;next++)
{
for(i = next -1;i >= 0;i--)
{
pre_ele = *(data + i);
next_ele = *(data + i + 1);
*(data + i) = next_ele < pre_ele ? next_ele : pre_ele;
*(data + i + 1) = pre_ele;
}
}
}
X86-64汇编:
bubble_c:
.LFB3:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -24(%rbp)
movl %esi, -28(%rbp)
movl $1, -12(%rbp)
jmp .L6
.L9:
movl -12(%rbp), %eax
subl $1, %eax
movl %eax, -16(%rbp)
jmp .L7
.L8:
movl -16(%rbp), %eax
cltq
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rdx, %rax
movl (%rax), %eax
movl %eax, -8(%rbp)
movl -16(%rbp), %eax
cltq
addq $1, %rax
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rdx, %rax
movl (%rax), %eax
movl %eax, -4(%rbp)
movl -16(%rbp), %eax
cltq
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rax, %rdx
movl -4(%rbp), %eax
cmpl %eax, -8(%rbp)
cmovle -8(%rbp), %eax
movl %eax, (%rdx)
movl -16(%rbp), %eax
cltq
addq $1, %rax
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rax, %rdx
movl -8(%rbp), %eax
movl %eax, (%rdx)
subl $1, -16(%rbp)
.L7:
cmpl $0, -16(%rbp)
jns .L8
addl $1, -12(%rbp)
.L6:
movl -12(%rbp), %eax
cmpl -28(%rbp), %eax
jl .L9
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE3:
.size bubble_c, .-bubble_c
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits
X86-64机器码:
0000000000000094 <bubble_c>:
94: 55 push %rbp
95: 48 89 e5 mov %rsp,%rbp
98: 48 89 7d e8 mov %rdi,-0x18(%rbp)
9c: 89 75 e4 mov %esi,-0x1c(%rbp)
9f: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%rbp)
a6: e9 8c 00 00 00 jmpq 137 <bubble_c+0xa3>
ab: 8b 45 f4 mov -0xc(%rbp),%eax
ae: 83 e8 01 sub $0x1,%eax
b1: 89 45 f0 mov %eax,-0x10(%rbp)
b4: eb 77 jmp 12d <bubble_c+0x99>
b6: 8b 45 f0 mov -0x10(%rbp),%eax
b9: 48 98 cltq
bb: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
c2: 00
c3: 48 8b 45 e8 mov -0x18(%rbp),%rax
c7: 48 01 d0 add %rdx,%rax
ca: 8b 00 mov (%rax),%eax
cc: 89 45 f8 mov %eax,-0x8(%rbp)
cf: 8b 45 f0 mov -0x10(%rbp),%eax
d2: 48 98 cltq
d4: 48 83 c0 01 add $0x1,%rax
d8: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
df: 00
e0: 48 8b 45 e8 mov -0x18(%rbp),%rax
e4: 48 01 d0 add %rdx,%rax
e7: 8b 00 mov (%rax),%eax
e9: 89 45 fc mov %eax,-0x4(%rbp)
ec: 8b 45 f0 mov -0x10(%rbp),%eax
ef: 48 98 cltq
f1: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
f8: 00
f9: 48 8b 45 e8 mov -0x18(%rbp),%rax
fd: 48 01 c2 add %rax,%rdx
100: 8b 45 fc mov -0x4(%rbp),%eax
103: 39 45 f8 cmp %eax,-0x8(%rbp)
106: 0f 4e 45 f8 cmovle -0x8(%rbp),%eax
10a: 89 02 mov %eax,(%rdx)
10c: 8b 45 f0 mov -0x10(%rbp),%eax
10f: 48 98 cltq
111: 48 83 c0 01 add $0x1,%rax
115: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx
11c: 00
11d: 48 8b 45 e8 mov -0x18(%rbp),%rax
121: 48 01 c2 add %rax,%rdx
124: 8b 45 f8 mov -0x8(%rbp),%eax
127: 89 02 mov %eax,(%rdx)
129: 83 6d f0 01 subl $0x1,-0x10(%rbp)
12d: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
131: 79 83 jns b6 <bubble_c+0x22>
133: 83 45 f4 01 addl $0x1,-0xc(%rbp)
137: 8b 45 f4 mov -0xc(%rbp),%eax
13a: 3b 45 e4 cmp -0x1c(%rbp),%eax
13d: 0f 8c 68 ff ff ff jl ab <bubble_c+0x17>
143: 90 nop
144: 5d pop %rbp
145: c3 retq
Y86-64汇编:
bubble_b:
.LFB22:
.cfi_startproc
pushl %edi
.cfi_def_cfa_offset 8
.cfi_offset 7, -8
pushl %esi
.cfi_def_cfa_offset 12
.cfi_offset 6, -12
pushl %ebx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
mrmovl 16(%esp), %edx
mrmovl 20(%esp), %edi
irmovl $1, %eax
subl %eax, %edi
jle .L1
subl $1, %edi
irmovl $0, %esi
.L6:
movl (%ebx,%eax,4), %edx
movl 4(%ebx,%eax,4), %ecx
cmpl %edx, %ecx
movl %edx, %ebp
cmovle %ecx, %ebp
movl %edx, 4(%ebx,%eax,4)
subl $1, %eax
cmpl $-1, %eax
jne .L6
.L7:
rrmovl %eax, %ecx
addl %ecx, %ecx
addl %ecx, %ecx
addl %edx, %ecx
mrmovl 4(%ecx), %ecx
rrmovl %eax, %ebx
addl %ecx, %ebx
addl %ecx, %ebx
addl %edx, %ebx
mrmovl (%ebx), %ebx
subl %ebx, %ecx
jge .L4
addl %eax, %eax
addl %eax, %eax
addl %edx, %eax
rmmovl %ebx, 4(%eax)
addl %eax, %eax
addl %eax, %eax
addl %edx, %eax
rmmovl %ecx, 4(%eax)
.L4:
subl $1, %eax
irmovl $-1, %edx
subl %edx, %eax
jne .L7
.L3:
addl $1, %esi
subl %edi, %esi
jne .L6
.L1:
popl %ebx
.cfi_def_cfa_offset 12
.cfi_restore 3
popl %esi
.cfi_def_cfa_offset 8
.cfi_restore 6
popl %edi
.cfi_def_cfa_offset 4
.cfi_restore 7
ret
.cfi_endproc
.LFE22:
.size bubble_b, .-bubble_b
.section .rodata.str1.1,"aMS",@progbits,1