Printed by Katsuro Inoue
1 15, 03 19:34

effect−opt.txt−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Case 1−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
main(){
int i;
for(i=1;i<=2;i++){printf("test out\n"); }printf("end\n");}−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−O0 No Optimization−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−.section.rodata.LC0:.byte
0x74,0x65,0x73,0x74,0x20,0x6f,0x75,0x74,0xa,0x0
.LC1:
.byte
0x65,0x6e,0x64,0xa,0x0.text.p2align 2,0x90.globl main
.type
main,@function
main:pushl %ebp
movl %esp,%ebp
subl $24,%esp
nopmovl $1,−4(%ebp).p2align 2,0x90.L3:
cmpl $2,−4(%ebp)
jle .L6
jmp .L4.p2align 2,0x90.L6:addl $−12,%esp
pushl $.LC0
call printf
addl $16,%esp.L5:
incl −4(%ebp)
jmp .L3.p2align 2,0x90.L4:addl $−12,%esp
pushl $.LC1
call printf
addl $16,%esp.L2:
leaveret.Lfe1:.size
main,.Lfe1−main.ident "GCC: (GNU) c 2.95.4 20020320 [FreeBSD]"−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
cc −O3 Max Optimization−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−.file"test−opt1.c".version"01.01"¿åÍËÆü 1•î 17, 2007

Page 1/4

1 15, 03 19:34

effect−opt.txtPage 2/4

gcc2_compiled.:.section.rodata.LC0:.byte
0x74,0x65,0x73,0x74,0x20,0x6f,0x75,0x74,0xa,0x0
.LC1:
.byte
0x65,0x6e,0x64,0xa,0x0.text.p2align 2,0x90.globl main
.type
main,@function
main:pushl %ebp
movl %esp,%ebp
subl $20,%esp
pushl %ebx
movl $1,%ebx.p2align 2,0x90.L6:addl $−12,%esp
pushl $.LC0
call printf
addl $16,%esp
decl %ebx
jns .L6
addl $−12,%esp
pushl $.LC1
call printf
movl −24(%ebp),%ebx
leaveret.Lfe1:.size
main,.Lfe1−main.ident "GCC: (GNU) c 2.95.4 20020320 [FreeBSD]"−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Case 2−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−main(){
int i,x;i=2;
x=1+i;
printf("result=%d\n",x);}−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−No Optimization−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−.file"test−opt2.c".version"01.01"
gcc2_compiled.:.section.rodata.LC0:.byte
0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x25,0x64,0xa.byte
0x0.text.p2align 2,0x90.globl main
.type
main,@function

lecture−files/effect−opt.txt

1/2

Printed by Katsuro Inoue

effect−opt.txt

1 15, 03 19:34

Page 3/4

1 15, 03 19:34

effect−opt.txt

Page 4/4

main:
pushl %ebp
movl %esp,%ebp
subl $24,%esp
movl $2,−4(%ebp)
movl −4(%ebp),%eax
incl %eax
movl %eax,−8(%ebp)
addl $−8,%esp
movl −8(%ebp),%eax
pushl %eax
pushl $.LC0
call printf
addl $16,%esp% time a.out
result=887459712
0.301u 0.000s 0:00.31 96.7%

5+167k 0+0io 0pf+0w% cc −O3 test−opt1.c% time a.out
result=887459712
0.114u 0.000s 0:00.11 100.0%

5+192k 0+0io 0pf+0w

.L2:
leave
ret.Lfe1:.ident.size
main,.Lfe1−main"GCC: (GNU) c 2.95.4 20020320 [FreeBSD]"−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Max Optimization−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−.file"test−opt2.c".version"01.01"
gcc2_compiled.:.section.rodata.LC0:.byte
0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x25,0x64,0xa.byte
0x0.text.p2align 2,0x90.globl main.type
main,@function
main:pushl %ebp
movl %esp,%ebpsubl $8,%esp
addl $−8,%esp
pushl $3
pushl $.LC0
call printf
leave
ret.Lfe1:.size
main,.Lfe1−main.ident "GCC: (GNU) c 2.95.4 20020320 [FreeBSD]"−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Case 3−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−main(){long i,x;x=0;
for(i=1;i<100000000;i++){x=x+i; }printf("result=%d\n",x);}−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−% cc −O0 test−opt1.c¿åÍËÆü 1•î 17, 2007

lecture−files/effect−opt.txt

2/2