#include <stdio.h>
/*
*
*/
int main()
{
int a;
switch(a) {
case 1:
printf("a == 1\n");
break;
case 2:
case 4:
case 7:
printf("a == 2|4|7\n");
break;
case 9:
printf("a == 9\n");
break;
default:
printf("default.\n");
}
return 0;
}
#if 0
/*
* intel
*/
0000000000001149 <main>:
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: 83 7d fc 09 cmpl $0x9,-0x4(%rbp) // (rbp-0x4)-0x9
1159: 77 4e ja 11a9 <main+0x60> // 超过(无符号>) jump
115b: 8b 45 fc mov -0x4(%rbp),%eax // eax=(rbp-0x4)
115e: 48 8d 14 85 00 00 00 lea 0x0(,%rax,4),%rdx // rdx=(rax*4)+0x0
1165: 00
1166: 48 8d 05 bb 0e 00 00 lea 0xebb(%rip),%rax # 2028 <_IO_stdin_used+0x28>
116d: 8b 04 02 mov (%rdx,%rax,1),%eax // eax=(rdx+rax*1)
1170: 48 98 cltq
1172: 48 8d 15 af 0e 00 00 lea 0xeaf(%rip),%rdx # 2028 <_IO_stdin_used+0x28>
1179: 48 01 d0 add %rdx,%rax // rax+=rdx
117c: 3e ff e0 notrack jmpq *%rax // ????
117f: 48 8d 3d 7e 0e 00 00 lea 0xe7e(%rip),%rdi # 2004 <_IO_stdin_used+0x4>
1186: e8 c5 fe ff ff callq 1050 <puts@plt>
118b: eb 28 jmp 11b5 <main+0x6c>
118d: 48 8d 3d 77 0e 00 00 lea 0xe77(%rip),%rdi # 200b <_IO_stdin_used+0xb>
1194: e8 b7 fe ff ff callq 1050 <puts@plt>
1199: eb 1a jmp 11b5 <main+0x6c>
119b: 48 8d 3d 74 0e 00 00 lea 0xe74(%rip),%rdi # 2016 <_IO_stdin_used+0x16>
11a2: e8 a9 fe ff ff callq 1050 <puts@plt>
11a7: eb 0c jmp 11b5 <main+0x6c>
11a9: 48 8d 3d 6d 0e 00 00 lea 0xe6d(%rip),%rdi # 201d <_IO_stdin_used+0x1d>
11b0: e8 9b fe ff ff callq 1050 <puts@plt>
11b5: b8 00 00 00 00 mov $0x0,%eax
11ba: c9 leaveq
11bb: c3 retq
11bc: 0f 1f 40 00 nopl 0x0(%rax)
/*
* arm
*/
000000000040055c <main>:
40055c: a9be7bfd stp x29, x30, [sp, #-32]!
400560: 910003fd mov x29, sp
400564: b9401fa0 ldr w0, [x29, #28] // w0=[x29+28]
400568: 7100101f cmp w0, #0x4 // w0-0x4
40056c: 54000220 b.eq 4005b0 <main+0x54> // b.none 运算结果相等为1
400570: 7100101f cmp w0, #0x4
400574: 540000cc b.gt 40058c <main+0x30> // 带符号 >
400578: 7100041f cmp w0, #0x1
40057c: 54000120 b.eq 4005a0 <main+0x44> // b.none 运算结果相等为1
400580: 7100081f cmp w0, #0x2
400584: 54000160 b.eq 4005b0 <main+0x54> // b.none 运算结果相等为1
400588: 14000012 b 4005d0 <main+0x74>
40058c: 71001c1f cmp w0, #0x7
400590: 54000100 b.eq 4005b0 <main+0x54> // b.none 运算结果相等为1
400594: 7100241f cmp w0, #0x9
400598: 54000140 b.eq 4005c0 <main+0x64> // b.none 运算结果相等为1
40059c: 1400000d b 4005d0 <main+0x74>
4005a0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005a4: 911a6000 add x0, x0, #0x698
4005a8: 97ffffaa bl 400450 <puts@plt>
4005ac: 1400000c b 4005dc <main+0x80>
4005b0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005b4: 911a8000 add x0, x0, #0x6a0
4005b8: 97ffffa6 bl 400450 <puts@plt>
4005bc: 14000008 b 4005dc <main+0x80>
4005c0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005c4: 911ac000 add x0, x0, #0x6b0
4005c8: 97ffffa2 bl 400450 <puts@plt>
4005cc: 14000004 b 4005dc <main+0x80>
4005d0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005d4: 911ae000 add x0, x0, #0x6b8
4005d8: 97ffff9e bl 400450 <puts@plt>
4005dc: 52800000 mov w0, #0x0 // #0
4005e0: a8c27bfd ldp x29, x30, [sp], #32
4005e4: d65f03c0 ret
#endif