#include <stdio.h>
struct s
{
char a;
int b;
char c;
int d;
};
void f(struct s s)
{
printf("a = %d, b = %d, c = %d, d = %d\n", s.a, s.b, s.c, s.d);
}
int main()
{
struct s tmp;
tmp.a = 1;
tmp.b = 2;
tmp.c = 3;
tmp.d = 4;
f(tmp);
}
#if 0
/*
* intel
*/
0000000000001149 <f>:
1149: f3 0f 1e fa endbr64
114d: 55 push %rbp
114e: 48 89 e5 mov %rsp,%rbp
1151: 48 83 ec 10 sub $0x10,%rsp
1155: 48 89 f8 mov %rdi,%rax // rax=0x1
1158: 48 89 f1 mov %rsi,%rcx // rcx=0x3
115b: 48 89 ca mov %rcx,%rdx // rdx=0x3
115e: 48 89 45 f0 mov %rax,-0x10(%rbp) // (rbp-0x10)=0x1
1162: 48 89 55 f8 mov %rdx,-0x8(%rbp) // (rbp-0x8)=0x3
1166: 8b 75 fc mov -0x4(%rbp),%esi // esi=(rbp-0x4)=0x4
1169: 0f b6 45 f8 movzbl -0x8(%rbp),%eax // eax=(rbp-0x8)=0x3
116d: 0f be c8 movsbl %al,%ecx // ecx=0x3
1170: 8b 55 f4 mov -0xc(%rbp),%edx // edx=(rbp-0xc)=0x2
1173: 0f b6 45 f0 movzbl -0x10(%rbp),%eax // eax=(rbp-0x10)=0x1
1177: 0f be c0 movsbl %al,%eax // eax=0x1
117a: 41 89 f0 mov %esi,%r8d // r8d=0x4
117d: 89 c6 mov %eax,%esi // esi=0x1
117f: 48 8d 3d 82 0e 00 00 lea 0xe82(%rip),%rdi # 2008 <_IO_stdin_used+0x8>
1186: b8 00 00 00 00 mov $0x0,%eax
118b: e8 c0 fe ff ff callq 1050 <printf@plt>
1190: 90 nop
1191: c9 leaveq
1192: c3 retq
0000000000001193 <main>:
1193: f3 0f 1e fa endbr64
1197: 55 push %rbp
1198: 48 89 e5 mov %rsp,%rbp
119b: 48 83 ec 10 sub $0x10,%rsp
119f: c6 45 f0 01 movb $0x1,-0x10(%rbp) // (rbp-0x10)=0x1
11a3: c7 45 f4 02 00 00 00 movl $0x2,-0xc(%rbp) // (rbp-0xc)=0x2
11aa: c6 45 f8 03 movb $0x3,-0x8(%rbp) // (rbp-0x8)=0x3
11ae: c7 45 fc 04 00 00 00 movl $0x4,-0x4(%rbp) // (rbp-0x4)=0x4
11b5: 48 8b 55 f0 mov -0x10(%rbp),%rdx // rdx=(rbp-0x10)
11b9: 48 8b 45 f8 mov -0x8(%rbp),%rax // rax=0x3
11bd: 48 89 d7 mov %rdx,%rdi // rdi=(rbp-0x10)
11c0: 48 89 c6 mov %rax,%rsi // rsi=0x3
11c3: e8 81 ff ff ff callq 1149 <f>
11c8: b8 00 00 00 00 mov $0x0,%eax
11cd: c9 leaveq
11ce: c3 retq
11cf: 90 nop
/*
* arm
*/
000000000040055c <f>:
40055c: a9be7bfd stp x29, x30, [sp, #-32]!
400560: 910003fd mov x29, sp
400564: a90107a0 stp x0, x1, [x29, #16]
400568: 394043a0 ldrb w0, [x29, #16]
40056c: 2a0003e5 mov w5, w0 // w5=1
400570: b94017a1 ldr w1, [x29, #20] // w1=2
400574: 394063a0 ldrb w0, [x29, #24] // w0=3
400578: 2a0003e3 mov w3, w0 // w3=3
40057c: b9401fa2 ldr w2, [x29, #28] // w2=4
400580: 90000000 adrp x0, 400000 <_init-0x3e8>
400584: 911a4000 add x0, x0, #0x690 // x0=""
400588: 2a0203e4 mov w4, w2 // w4=4
40058c: 2a0103e2 mov w2, w1 // w2=2
400590: 2a0503e1 mov w1, w5 // w1=1
400594: 97ffffaf bl 400450 <printf@plt>
400598: d503201f nop
40059c: a8c27bfd ldp x29, x30, [sp], #32
4005a0: d65f03c0 ret
00000000004005a4 <main>:
4005a4: a9be7bfd stp x29, x30, [sp, #-32]!
4005a8: 910003fd mov x29, sp
4005ac: 52800020 mov w0, #0x1 // #1
4005b0: 390043a0 strb w0, [x29, #16]
4005b4: 52800040 mov w0, #0x2 // #2
4005b8: b90017a0 str w0, [x29, #20]
4005bc: 52800060 mov w0, #0x3 // #3
4005c0: 390063a0 strb w0, [x29, #24]
4005c4: 52800080 mov w0, #0x4 // #4
4005c8: b9001fa0 str w0, [x29, #28]
4005cc: a94107a0 ldp x0, x1, [x29, #16]
4005d0: 97ffffe3 bl 40055c <f>
4005d4: 52800000 mov w0, #0x0 // #0
4005d8: a8c27bfd ldp x29, x30, [sp], #32
4005dc: d65f03c0 ret
#endif