/*
* 任意值或残留数据
*/
void f1()
{
int a = 1, b = 2, c = 3;
}
void f2()
{
int a, b, c;
printf("0x%x, 0x%x, 0x%x\n", a, b, c); // 0x1, 0x2, 0x3
}
int main()
{
f1();
f2();
}
#if 0
/*
* intel
*/
0000000000001149 :
1149: f3 0f 1e fa endbr64
114d: 55 push %rbp
114e: 48 89 e5 mov %rsp,%rbp
1151: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%rbp) // 1
1158: c7 45 f8 02 00 00 00 movl $0x2,-0x8(%rbp) // 2
115f: c7 45 fc 03 00 00 00 movl $0x3,-0x4(%rbp) // 3
1166: 90 nop
1167: 5d pop %rbp
1168: c3 retq
0000000000001169 :
1169: f3 0f 1e fa endbr64
116d: 55 push %rbp
116e: 48 89 e5 mov %rsp,%rbp
1171: 48 83 ec 10 sub $0x10,%rsp
1175: 8b 4d fc mov -0x4(%rbp),%ecx // 1
1178: 8b 55 f8 mov -0x8(%rbp),%edx // 2
117b: 8b 45 f4 mov -0xc(%rbp),%eax // 3
117e: 89 c6 mov %eax,%esi
1180: 48 8d 3d 7d 0e 00 00 lea 0xe7d(%rip),%rdi # 2004 <_IO_stdin_used+0x4>
1187: b8 00 00 00 00 mov $0x0,%eax
118c: e8 bf fe ff ff callq 1050
1191: 90 nop
1192: c9 leaveq
1193: c3 retq
0000000000001194 :
1194: f3 0f 1e fa endbr64
1198: 55 push %rbp
1199: 48 89 e5 mov %rsp,%rbp
119c: b8 00 00 00 00 mov $0x0,%eax
11a1: e8 a3 ff ff ff callq 1149
11a6: b8 00 00 00 00 mov $0x0,%eax
11ab: e8 b9 ff ff ff callq 1169
11b0: b8 00 00 00 00 mov $0x0,%eax
11b5: 5d pop %rbp
11b6: c3 retq
11b7: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
11be: 00 00
/*
* arm
*/
000000000040055c :
40055c: d10043ff sub sp, sp, #0x10
400560: 52800020 mov w0, #0x1 // #1
400564: b9000fe0 str w0, [sp, #12]
400568: 52800040 mov w0, #0x2 // #2
40056c: b9000be0 str w0, [sp, #8]
400570: 52800060 mov w0, #0x3 // #3
400574: b90007e0 str w0, [sp, #4]
400578: d503201f nop
40057c: 910043ff add sp, sp, #0x10
400580: d65f03c0 ret
0000000000400584 :
400584: a9be7bfd stp x29, x30, [sp, #-32]!
400588: 910003fd mov x29, sp
40058c: 90000000 adrp x0, 400000 <_init-0x3e8>
400590: 911a0000 add x0, x0, #0x680
400594: b94017a3 ldr w3, [x29, #20]
400598: b9401ba2 ldr w2, [x29, #24]
40059c: b9401fa1 ldr w1, [x29, #28]
4005a0: 97ffffac bl 400450
4005a4: d503201f nop
4005a8: a8c27bfd ldp x29, x30, [sp], #32
4005ac: d65f03c0 ret
00000000004005b0 :
4005b0: a9bf7bfd stp x29, x30, [sp, #-16]!
4005b4: 910003fd mov x29, sp
4005b8: 97ffffe9 bl 40055c
4005bc: 97fffff2 bl 400584
4005c0: 52800000 mov w0, #0x0 // #0
4005c4: a8c17bfd ldp x29, x30, [sp], #16
4005c8: d65f03c0 ret
4005cc: 00000000 .inst 0x00000000 ; undefined
#endif