main.c:
/* main.c */
#include <stdio.h>
int world(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
int sum=*a+*b+*c+*d+*e+*f+*a1+*b1+*c1+*d1+*e1+*f1;
return sum;
}
int hello(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
int sum = world(a,b,c,d,e,f,a1,b1,c1,d1,e1,f1);
return sum++;
}
int main(void){
int a,b,c,d,e,f,a1,b1,c1,d1,e1,f1;
a=1;
b=2;
c=3;
d=4;
e=5;
f=6;
a1=11;
b1=12;
c1=13;
d1=14;
e1=15;
f1=16;
hello(&a,&b,&c,&d,&e,&f,&a1,&b1,&c1,&d1,&e1,&f1);
return 0;
}
aarch64-linux-gnu-gcc -g main.c
aarch64-linux-gnu-objdump -S -d a.out > a.s
int world(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
400574: d10143ff sub sp, sp, #0x50
400578: f9001fe0 str x0, [sp, #56]
40057c: f9001be1 str x1, [sp, #48]
400580: f90017e2 str x2, [sp, #40]
400584: f90013e3 str x3, [sp, #32]
400588: f9000fe4 str x4, [sp, #24]
40058c: f9000be5 str x5, [sp, #16]
400590: f90007e6 str x6, [sp, #8]
400594: f90003e7 str x7, [sp]
int sum=*a+*b+*c+*d+*e+*f+*a1+*b1+*c1+*d1+*e1+*f1;
400598: f9401fe0 ldr x0, [sp, #56]
40059c: b9400001 ldr w1, [x0]
4005a0: f9401be0 ldr x0, [sp, #48]
4005a4: b9400000 ldr w0, [x0]
4005a8: 0b000021 add w1, w1, w0
4005ac: f94017e0 ldr x0, [sp, #40]
4005b0: b9400000 ldr w0, [x0]
4005b4: 0b000021 add w1, w1, w0
4005b8: f94013e0 ldr x0, [sp, #32]
4005bc: b9400000 ldr w0, [x0]
4005c0: 0b000021 add w1, w1, w0
4005c4: f9400fe0 ldr x0, [sp, #24]
4005c8: b9400000 ldr w0, [x0]
4005cc: 0b000021 add w1, w1, w0
4005d0: f9400be0 ldr x0, [sp, #16]
4005d4: b9400000 ldr w0, [x0]
4005d8: 0b000021 add w1, w1, w0
4005dc: f94007e0 ldr x0, [sp, #8]
4005e0: b9400000 ldr w0, [x0]
4005e4: 0b000021 add w1, w1, w0
4005e8: f94003e0 ldr x0, [sp]
4005ec: b9400000 ldr w0, [x0]
4005f0: 0b000021 add w1, w1, w0
4005f4: f9402be0 ldr x0, [sp, #80]
4005f8: b9400000 ldr w0, [x0]
4005fc: 0b000021 add w1, w1, w0
400600: f9402fe0 ldr x0, [sp, #88]
400604: b9400000 ldr w0, [x0]
400608: 0b000021 add w1, w1, w0
40060c: f94033e0 ldr x0, [sp, #96]
400610: b9400000 ldr w0, [x0]
400614: 0b000021 add w1, w1, w0
400618: f94037e0 ldr x0, [sp, #104]
40061c: b9400000 ldr w0, [x0]
400620: 0b000020 add w0, w1, w0
400624: b9004fe0 str w0, [sp, #76]
return sum;
400628: b9404fe0 ldr w0, [sp, #76]
}
40062c: 910143ff add sp, sp, #0x50
400630: d65f03c0 ret
0000000000400634 <hello>:
int hello(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
400634: d10203ff sub sp, sp, #0x80
400638: a9027bfd stp x29, x30, [sp, #32]
40063c: 910083fd add x29, sp, #0x20 x29就是fp,始终指向,栈中的fp
400640: f90037e0 str x0, [sp, #104]
400644: f90033e1 str x1, [sp, #96]
400648: f9002fe2 str x2, [sp, #88]
40064c: f9002be3 str x3, [sp, #80]
400650: f90027e4 str x4, [sp, #72]
400654: f90023e5 str x5, [sp, #64]
400658: f9001fe6 str x6, [sp, #56]
40065c: f9001be7 str x7, [sp, #48]
int sum = world(a,b,c,d,e,f,a1,b1,c1,d1,e1,f1);
400660: f9404fe0 ldr x0, [sp, #152]
400664: f9000fe0 str x0, [sp, #24]
400668: f9404be0 ldr x0, [sp, #144]
40066c: f9000be0 str x0, [sp, #16]
400670: f94047e0 ldr x0, [sp, #136]
400674: f90007e0 str x0, [sp, #8]
400678: f94043e0 ldr x0, [sp, #128]
40067c: f90003e0 str x0, [sp]
400680: f9401be7 ldr x7, [sp, #48]
400684: f9401fe6 ldr x6, [sp, #56]
400688: f94023e5 ldr x5, [sp, #64]
40068c: f94027e4 ldr x4, [sp, #72]
400690: f9402be3 ldr x3, [sp, #80]
400694: f9402fe2 ldr x2, [sp, #88]
400698: f94033e1 ldr x1, [sp, #96]
40069c: f94037e0 ldr x0, [sp, #104]
4006a0: 97ffffb5 bl 400574 <world>
4006a4: b9007fe0 str w0, [sp, #124]
return sum++;
4006a8: b9407fe0 ldr w0, [sp, #124]
4006ac: 11000401 add w1, w0, #0x1
4006b0: b9007fe1 str w1, [sp, #124]
}
4006b4: a9427bfd ldp x29, x30, [sp, #32]
4006b8: 910203ff add sp, sp, #0x80
4006bc: d65f03c0 ret
00000000004006c0 <main>:
int main(void){
4006c0: d10183ff sub sp, sp, #0x60
4006c4: a9027bfd stp x29, x30, [sp, #32]
4006c8: 910083fd add x29, sp, #0x20 x29就是fp,始终指向,栈中的fp
int a,b,c,d,e,f,a1,b1,c1,d1,e1,f1;
a=1;
4006cc: 52800020 mov w0, #0x1 // #1
4006d0: b9005fe0 str w0, [sp, #92]
b=2;
4006d4: 52800040 mov w0, #0x2 // #2
4006d8: b9005be0 str w0, [sp, #88]
c=3;
4006dc: 52800060 mov w0, #0x3 // #3
4006e0: b90057e0 str w0, [sp, #84]
d=4;
4006e4: 52800080 mov w0, #0x4 // #4
4006e8: b90053e0 str w0, [sp, #80]
e=5;
4006ec: 528000a0 mov w0, #0x5 // #5
4006f0: b9004fe0 str w0, [sp, #76]
f=6;
4006f4: 528000c0 mov w0, #0x6 // #6
4006f8: b9004be0 str w0, [sp, #72]
a1=11;
4006fc: 52800160 mov w0, #0xb // #11
400700: b90047e0 str w0, [sp, #68]
b1=12;
400704: 52800180 mov w0, #0xc // #12
400708: b90043e0 str w0, [sp, #64]
c1=13;
40070c: 528001a0 mov w0, #0xd // #13
400710: b9003fe0 str w0, [sp, #60]
d1=14;
400714: 528001c0 mov w0, #0xe // #14
400718: b9003be0 str w0, [sp, #56]
e1=15;
40071c: 528001e0 mov w0, #0xf // #15
400720: b90037e0 str w0, [sp, #52]
f1=16;
400724: 52800200 mov w0, #0x10 // #16
400728: b90033e0 str w0, [sp, #48]
hello(&a,&b,&c,&d,&e,&f,&a1,&b1,&c1,&d1,&e1,&f1);
40072c: 910103e7 add x7, sp, #0x40 b1地址放x7
400730: 910113e6 add x6, sp, #0x44 a1地址放x6
400734: 910123e5 add x5, sp, #0x48 f地址放x5
400738: 910133e4 add x4, sp, #0x4c e地址放x4
40073c: 910143e3 add x3, sp, #0x50 d地址放x3
400740: 910153e2 add x2, sp, #0x54 c地址放x2
400744: 910163e1 add x1, sp, #0x58 b地址放x1
400748: 910173e8 add x8, sp, #0x5c a地址放x8 //临时
40074c: 9100c3e0 add x0, sp, #0x30
400750: f9000fe0 str x0, [sp, #24] f1地址放[sp, #24]
400754: 9100d3e0 add x0, sp, #0x34
400758: f9000be0 str x0, [sp, #16] e1地址放[sp, #16]
40075c: 9100e3e0 add x0, sp, #0x38
400760: f90007e0 str x0, [sp, #8] d1地址放[sp, #8]
400764: 9100f3e0 add x0, sp, #0x3c
400768: f90003e0 str x0, [sp] c1地址放[sp, #0]
40076c: aa0803e0 mov x0, x8 a地址放x0
400770: 97ffffb1 bl 400634 <hello> 跳转到hello
return 0;
400774: 52800000 mov w0, #0x0 // #0
}
400778: a9427bfd ldp x29, x30, [sp, #32]
40077c: 910183ff add sp, sp, #0x60
400780: d65f03c0 ret
400784: d503201f nop
400788: d503201f nop
40078c: d503201f nop