#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int a[33] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32};
int main_add()
{
/*80484d0: 55 push %ebp
80484d1: 89 e5 mov %esp,%ebp
80484d3: 83 ec 28 sub $0x28,%esp
80484d6: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80484dd: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)*/
int j = 0;
int i = 0;
//80484e4: e9 94 00 00 00 jmp 804857d <main_add+0xad>
for (i = 0; i <= 10; i++) {
//80484e9: 83 45 f0 01 addl $0x1,-0x10(%ebp)
j++;
/*80484ed: 8b 45 f0 mov -0x10(%ebp),%eax // eax = 1
80484f0: 83 e8 01 sub $0x1,%eax // eax = 1-1 = 0
80484f3: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax // eax = a+0*4
80484fa: 89 44 24 0c mov %eax,0xc(%esp) // (esp+c) = a
80484fe: 8b 45 f0 mov -0x10(%ebp),%eax // eax = j
8048501: 89 44 24 08 mov %eax,0x8(%esp) // (esp+8) = j
8048505: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp) // (esp+4) = 0x10
804850c: 00
804850d: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
8048514: e8 77 fe ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0xa, j, a[j-1]);
//8048519: 83 45 f0 01 addl $0x1,-0x10(%ebp)
j++;
/*804851d: 8b 45 f0 mov -0x10(%ebp),%eax // eax = 2
8048520: 83 e8 01 sub $0x1,%eax // eax = 1
8048523: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax // eax = a+4*1 = a[1]
804852a: 89 44 24 0c mov %eax,0xc(%esp)
804852e: 8b 45 f0 mov -0x10(%ebp),%eax
8048531: 89 44 24 08 mov %eax,0x8(%esp)
8048535: c7 44 24 04 12 00 00 movl $0x12,0x4(%esp)
804853c: 00
804853d: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
8048544: e8 47 fe ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x12, j, a[j-1]);
//8048549: 83 45 f0 01 addl $0x1,-0x10(%ebp)
j++;
/*804854d: 8b 45 f0 mov -0x10(%ebp),%eax // eax = 3
8048550: 83 e8 01 sub $0x1,%eax // eax 3-1 = 2
8048553: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax // eax = a+[2*4] = a[2]
804855a: 89 44 24 0c mov %eax,0xc(%esp) // (esp+c) = a[2]
804855e: 8b 45 f0 mov -0x10(%ebp),%eax
8048561: 89 44 24 08 mov %eax,0x8(%esp) // (esp+8) = j
8048565: c7 44 24 04 14 00 00 movl $0x14,0x4(%esp) // (esp+4) = 0x14
804856c: 00
804856d: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
8048574: e8 17 fe ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x14, j, a[j-1]);
}
/*8048579: 83 45 f4 01 addl $0x1,-0xc(%ebp)
804857d: 83 7d f4 0a cmpl $0xa,-0xc(%ebp)
8048581: 0f 8e 62 ff ff ff jle 80484e9 <main_add+0x19>
8048587: b8 00 00 00 00 mov $0x0,%eax
804858c: c9 leave
804858d: c3 ret*/
return 0;
}
int add_main()
{
/*804858e: 55 push %ebp
804858f: 89 e5 mov %esp,%ebp
8048591: 83 ec 28 sub $0x28,%esp
8048594: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
804859b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)*/
int j = 0;
int i = 0;
//80485a2: e9 94 00 00 00 jmp 804863b <add_main+0xad>
for (i = 0; i <= 10; i++) {
//80485a7: 83 45 f0 01 addl $0x1,-0x10(%ebp)
++j;
/*80485ab: 8b 45 f0 mov -0x10(%ebp),%eax
80485ae: 83 e8 01 sub $0x1,%eax // eax = 1-1 = 0
80485b1: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax // eax = a+0*4 = a[0]
80485b8: 89 44 24 0c mov %eax,0xc(%esp) // (esp+c)=a[0]
80485bc: 8b 45 f0 mov -0x10(%ebp),%eax
80485bf: 89 44 24 08 mov %eax,0x8(%esp) // (esp+8) = j
80485c3: c7 44 24 04 46 00 00 movl $0x46,0x4(%esp) // (esp+4) = 0x46
80485ca: 00
80485cb: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
80485d2: e8 b9 fd ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x46, j, a[j-1]);
/*80485d7: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80485db: 8b 45 f0 mov -0x10(%ebp),%eax
80485de: 83 e8 01 sub $0x1,%eax
80485e1: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax
80485e8: 89 44 24 0c mov %eax,0xc(%esp)
80485ec: 8b 45 f0 mov -0x10(%ebp),%eax
80485ef: 89 44 24 08 mov %eax,0x8(%esp)
80485f3: c7 44 24 04 48 00 00 movl $0x48,0x4(%esp)
80485fa: 00
80485fb: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
8048602: e8 89 fd ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x48, j, a[j-1]);
/*8048607: 83 45 f0 01 addl $0x1,-0x10(%ebp)
804860b: 8b 45 f0 mov -0x10(%ebp),%eax
804860e: 83 e8 01 sub $0x1,%eax
8048611: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax
8048618: 89 44 24 0c mov %eax,0xc(%esp)
804861c: 8b 45 f0 mov -0x10(%ebp),%eax
804861f: 89 44 24 08 mov %eax,0x8(%esp)
8048623: c7 44 24 04 4a 00 00 movl $0x4a,0x4(%esp)
804862a: 00
804862b: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
8048632: e8 59 fd ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x4a, j, a[j-1]);
}
/*8048637: 83 45 f4 01 addl $0x1,-0xc(%ebp)
804863b: 83 7d f4 0a cmpl $0xa,-0xc(%ebp)
804863f: 0f 8e 62 ff ff ff jle 80485a7 <add_main+0x19>
8048645: b8 00 00 00 00 mov $0x0,%eax
804864a: c9 leave
804864b: c3 ret */
return 0;
}
void array_main()
{
/*804864c: 55 push %ebp
804864d: 89 e5 mov %esp,%ebp
804864f: 83 ec 28 sub $0x28,%esp
8048652: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
8048659: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)*/
int j = 0;
int i = 0;
// 8048660: e9 91 00 00 00 jmp 80486f6 <array_main+0xaa>
for (i = 0; i <= 10; i++) {
/*8048665: 8b 45 f0 mov -0x10(%ebp),%eax // eax = 0
8048668: 8d 50 01 lea 0x1(%eax),%edx // edx = 1
804866b: 89 55 f0 mov %edx,-0x10(%ebp) // (ebp-0x10) = 1
804866e: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax // eax = a+0*4 = a[0]
8048675: 89 44 24 0c mov %eax,0xc(%esp) // (esp+c) = a[0]
8048679: 8b 45 f0 mov -0x10(%ebp),%eax // eax = j
804867c: 89 44 24 08 mov %eax,0x8(%esp) // (esp+8) = a[0]
8048680: c7 44 24 04 7b 00 00 movl $0x7b,0x4(%esp) // (esp+4) = 0x7b
8048687: 00
8048688: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
804868f: e8 fc fc ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x7b, j, a[j++]);
/*8048694: 8b 45 f0 mov -0x10(%ebp),%eax
8048697: 8d 50 01 lea 0x1(%eax),%edx
804869a: 89 55 f0 mov %edx,-0x10(%ebp)
804869d: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax
80486a4: 89 44 24 0c mov %eax,0xc(%esp)
80486a8: 8b 45 f0 mov -0x10(%ebp),%eax
80486ab: 89 44 24 08 mov %eax,0x8(%esp)
80486af: c7 44 24 04 7c 00 00 movl $0x7c,0x4(%esp)
80486b6: 00
80486b7: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
80486be: e8 cd fc ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x7c, j, a[j++]);
/*80486c3: 8b 45 f0 mov -0x10(%ebp),%eax
80486c6: 8d 50 01 lea 0x1(%eax),%edx
80486c9: 89 55 f0 mov %edx,-0x10(%ebp)
80486cc: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax
80486d3: 89 44 24 0c mov %eax,0xc(%esp)
80486d7: 8b 45 f0 mov -0x10(%ebp),%eax
80486da: 89 44 24 08 mov %eax,0x8(%esp)
80486de: c7 44 24 04 7d 00 00 movl $0x7d,0x4(%esp)
80486e5: 00
80486e6: c7 04 24 44 88 04 08 movl $0x8048844,(%esp)
80486ed: e8 9e fc ff ff call 8048390 <printf@plt>*/
printf("%d %d %d\n", 0x7d, j, a[j++]);
/*80486f2: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80486f6: 83 7d f4 0a cmpl $0xa,-0xc(%ebp)
80486fa: 0f 8e 65 ff ff ff jle 8048665 <array_main+0x19>*/
}
//8048700: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
//8048707: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
j = 0;
i = 0;
//804870e: eb 7c jmp 804878c <array_main+0x140>
for (j = 0; j <= 10; j++) {
/*8048710: 8b 45 f0 mov -0x10(%ebp),%eax // eax = j = 0
8048713: 8d 50 01 lea 0x1(%eax),%edx // edx = 0+1 = 1
8048716: 89 55 f0 mov %edx,-0x10(%ebp) // (ebp-0x10) = 1
8048719: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax // eax = a+0*4 = a[0]
8048720: 89 44 24 08 mov %eax,0x8(%esp) // (esp+0x8) = a[0]
8048724: c7 44 24 04 83 00 00 movl $0x83,0x4(%esp) // (esp+0x4) = 0x83
804872b: 00
804872c: c7 04 24 67 88 04 08 movl $0x8048867,(%esp)
8048733: e8 58 fc ff ff call 8048390 <printf@plt>*/
printf("%d %d\n", 0x83, a[j++]);
/*8048738: 8b 45 f0 mov -0x10(%ebp),%eax
804873b: 8d 50 01 lea 0x1(%eax),%edx
804873e: 89 55 f0 mov %edx,-0x10(%ebp)
8048741: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax
8048748: 89 44 24 08 mov %eax,0x8(%esp)
804874c: c7 44 24 04 84 00 00 movl $0x84,0x4(%esp)
8048753: 00
8048754: c7 04 24 67 88 04 08 movl $0x8048867,(%esp)
804875b: e8 30 fc ff ff call 8048390 <printf@plt>*/
printf("%d %d\n", 0x84, a[j++]);
/*8048760: 8b 45 f0 mov -0x10(%ebp),%eax
8048763: 8d 50 01 lea 0x1(%eax),%edx
8048766: 89 55 f0 mov %edx,-0x10(%ebp)
8048769: 8b 04 85 40 a0 04 08 mov 0x804a040(,%eax,4),%eax
8048770: 89 44 24 08 mov %eax,0x8(%esp)
8048774: c7 44 24 04 85 00 00 movl $0x85,0x4(%esp)
804877b: 00
804877c: c7 04 24 67 88 04 08 movl $0x8048867,(%esp)
8048783: e8 08 fc ff ff call 8048390 <printf@plt>*/
printf("%d %d\n", 0x85, a[j++]);
/*8048788: 83 45 f4 01 addl $0x1,-0xc(%ebp)
804878c: 83 7d f4 0a cmpl $0xa,-0xc(%ebp)
8048790: 0f 8e 7a ff ff ff jle 8048710 <array_main+0xc4>*/
}
/*8048796: b8 00 00 00 00 mov $0x0,%eax
804879b: c9 leave
804879c: c3 ret */
}
int main()
{
/*804879d: 55 push %ebp
804879e: 89 e5 mov %esp,%ebp
80487a0: 83 e4 f0 and $0xfffffff0,%esp
80487a3: e8 a4 fe ff ff call 804864c <array_main>*/
array_main();
/*80487a8: b8 00 00 00 00 mov $0x0,%eax
80487ad: c9 leave
80487ae: c3 ret
80487af: 90 nop*/
return 0;
}
// code
#include <stdio.h>
int array[33] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32};
int main_add()
{
int i, j, suffix;
suffix = 0;
for (i = 0; i < 11; i++)
/*for (j = 0; j < 3; j++)*/ {
suffix++;
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix-1]);
suffix++;
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix-1]);
suffix++;
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix-1]);
}
return 0;
}
int add_main()
{
int i, j, suffix;
suffix = 0;
for (i = 0; i < 11; i++)
/*for (j = 0; j < 3; j++)*/ {
++suffix;
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix-1]);
++suffix;
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix-1]);
++suffix;
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix-1]);
}
return 0;
}
int array_main()
{
int i, j, suffix;
suffix = 0;
for (i = 0; i < 11; i++)
/*for (j = 0; j < 3; j++)*/ {
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix++]);
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix++]);
printf("\tline = %d suffix = %d array = %d\n", __LINE__, suffix, array[suffix++]);
}
suffix = 0;
for (i = 0; i < 11; i++)
/*for (j = 0; j < 3; j++)*/ {
printf("\tline = %d array = %d\n", __LINE__, array[suffix++]);
printf("\tline = %d array = %d\n", __LINE__, array[suffix++]);
printf("\tline = %d array = %d\n", __LINE__, array[suffix++]);
}
return 0;
}