#include <stdio.h>
/*
*
*/
int main()
{
int a;
switch(a) {
case 0:
printf("a == 0\n");
break;
case 1:
printf("a == 1\n");
break;
case 2:
printf("a == 2\n");
break;
case 3:
printf("a == 3\n");
break;
case 666:
printf("a == 666\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 // rsp-=0x10
1155: 81 7d fc 9a 02 00 00 cmpl $0x29a,-0x4(%rbp) // (rbp-0x4)-0x29a
115c: 74 67 je 11c5 <main+0x7c> // 等于/零 jump
115e: 81 7d fc 9a 02 00 00 cmpl $0x29a,-0x4(%rbp) // (rbp-0x4)-0x29a
1165: 7f 6c jg 11d3 <main+0x8a> // 大于(有符号>) jump
1167: 83 7d fc 03 cmpl $0x3,-0x4(%rbp) // (rbp-0x4)-0x3
116b: 74 4a je 11b7 <main+0x6e> // 等于/零 jump
116d: 83 7d fc 03 cmpl $0x3,-0x4(%rbp) // (rbp-0x4)-0x3
1171: 7f 60 jg 11d3 <main+0x8a> // 大于(有符号>) jump
1173: 83 7d fc 02 cmpl $0x2,-0x4(%rbp) // (rbp-0x4)-0x2
1177: 74 30 je 11a9 <main+0x60> // 等于/零 jump
1179: 83 7d fc 02 cmpl $0x2,-0x4(%rbp) // (rbp-0x4)-0x2
117d: 7f 54 jg 11d3 <main+0x8a> // 大于(有符号>) jump
117f: 83 7d fc 00 cmpl $0x0,-0x4(%rbp) // (rbp-0x4)-0x0
1183: 74 08 je 118d <main+0x44> // 等于/零 jump
1185: 83 7d fc 01 cmpl $0x1,-0x4(%rbp) // (rbp-0x4)-0x1
1189: 74 10 je 119b <main+0x52> // 等于/零 jump
118b: eb 46 jmp 11d3 <main+0x8a> // jmp
118d: 48 8d 3d 70 0e 00 00 lea 0xe70(%rip),%rdi # 2004 <_IO_stdin_used+0x4>
1194: e8 b7 fe ff ff callq 1050 <puts@plt>
1199: eb 44 jmp 11df <main+0x96>
119b: 48 8d 3d 69 0e 00 00 lea 0xe69(%rip),%rdi # 200b <_IO_stdin_used+0xb>
11a2: e8 a9 fe ff ff callq 1050 <puts@plt>
11a7: eb 36 jmp 11df <main+0x96>
11a9: 48 8d 3d 62 0e 00 00 lea 0xe62(%rip),%rdi # 2012 <_IO_stdin_used+0x12>
11b0: e8 9b fe ff ff callq 1050 <puts@plt>
11b5: eb 28 jmp 11df <main+0x96>
11b7: 48 8d 3d 5b 0e 00 00 lea 0xe5b(%rip),%rdi # 2019 <_IO_stdin_used+0x19>
11be: e8 8d fe ff ff callq 1050 <puts@plt>
11c3: eb 1a jmp 11df <main+0x96>
11c5: 48 8d 3d 54 0e 00 00 lea 0xe54(%rip),%rdi # 2020 <_IO_stdin_used+0x20>
11cc: e8 7f fe ff ff callq 1050 <puts@plt>
11d1: eb 0c jmp 11df <main+0x96>
11d3: 48 8d 3d 4f 0e 00 00 lea 0xe4f(%rip),%rdi # 2029 <_IO_stdin_used+0x29>
11da: e8 71 fe ff ff callq 1050 <puts@plt>
11df: b8 00 00 00 00 mov $0x0,%eax
11e4: c9 leaveq
11e5: c3 retq
11e6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
11ed: 00 00 00
/*
* arm
*/
000000000040055c <main>:
40055c: a9be7bfd stp x29, x30, [sp, #-32]!
400560: 910003fd mov x29, sp
400564: b9401fa0 ldr w0, [x29, #28]
400568: 7100081f cmp w0, #0x2
40056c: 540002a0 b.eq 4005c0 <main+0x64> // b.none 运算结果相等为1
400570: 7100081f cmp w0, #0x2
400574: 540000cc b.gt 40058c <main+0x30> // 带符号 >
400578: 7100001f cmp w0, #0x0
40057c: 54000120 b.eq 4005a0 <main+0x44> // b.none 运算结果相等为1
400580: 7100041f cmp w0, #0x1
400584: 54000160 b.eq 4005b0 <main+0x54> // b.none 运算结果相等为1
400588: 1400001a b 4005f0 <main+0x94>
40058c: 71000c1f cmp w0, #0x3
400590: 54000200 b.eq 4005d0 <main+0x74> // b.none 运算结果相等为1
400594: 710a681f cmp w0, #0x29a
400598: 54000240 b.eq 4005e0 <main+0x84> // b.none 运算结果相等为1
40059c: 14000015 b 4005f0 <main+0x94>
4005a0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005a4: 911ae000 add x0, x0, #0x6b8
4005a8: 97ffffaa bl 400450 <puts@plt>
4005ac: 14000014 b 4005fc <main+0xa0>
4005b0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005b4: 911b0000 add x0, x0, #0x6c0
4005b8: 97ffffa6 bl 400450 <puts@plt>
4005bc: 14000010 b 4005fc <main+0xa0>
4005c0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005c4: 911b2000 add x0, x0, #0x6c8
4005c8: 97ffffa2 bl 400450 <puts@plt>
4005cc: 1400000c b 4005fc <main+0xa0>
4005d0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005d4: 911b4000 add x0, x0, #0x6d0
4005d8: 97ffff9e bl 400450 <puts@plt>
4005dc: 14000008 b 4005fc <main+0xa0>
4005e0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005e4: 911b6000 add x0, x0, #0x6d8
4005e8: 97ffff9a bl 400450 <puts@plt>
4005ec: 14000004 b 4005fc <main+0xa0>
4005f0: 90000000 adrp x0, 400000 <_init-0x3e8>
4005f4: 911ba000 add x0, x0, #0x6e8
4005f8: 97ffff96 bl 400450 <puts@plt>
4005fc: 52800000 mov w0, #0x0 // #0
400600: a8c27bfd ldp x29, x30, [sp], #32
400604: d65f03c0 ret
#endif