反汇编 之C 多个 if

#include <stdio.h>

/*
 * 整数的基本关系
 */

int main()
{
    int a;
    int b;

    if (a < b) printf("a < b\n");
    if (a > b) printf("a > b\n");
    if (a == b) printf("a == b\n");
    if (a != b) printf("a != b\n");
    if (a >= b) printf("a >= b\n");
    if (a <= b) printf("a <= b\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:    8b 45 f8                 mov    -0x8(%rbp),%eax    // eax=(rbp-0x8)
    1158:    3b 45 fc                 cmp    -0x4(%rbp),%eax    // eax-(rbp-0x4)
    115b:    7d 0c                    jge    1169 <main+0x20>    // >= jump
    115d:    48 8d 3d a0 0e 00 00     lea    0xea0(%rip),%rdi        # 2004 <_IO_stdin_used+0x4>    // rdi=rip+0xea0
    1164:    e8 e7 fe ff ff           callq  1050 <puts@plt>    // puts(rdi)
    1169:    8b 45 f8                 mov    -0x8(%rbp),%eax    // eax=(rbp-0x8)
    116c:    3b 45 fc                 cmp    -0x4(%rbp),%eax    // eax-(rbp-0x4)
    116f:    7e 0c                    jle    117d <main+0x34>    // <= jump
    1171:    48 8d 3d 92 0e 00 00     lea    0xe92(%rip),%rdi        # 200a <_IO_stdin_used+0xa>    
    1178:    e8 d3 fe ff ff           callq  1050 <puts@plt>    // puts(rdi)
    117d:    8b 45 f8                 mov    -0x8(%rbp),%eax    // eax=(rbp-0x8)
    1180:    3b 45 fc                 cmp    -0x4(%rbp),%eax    // eax-(rbp-0x4)
    1183:    75 0c                    jne    1191 <main+0x48>    // !=0 jump
    1185:    48 8d 3d 84 0e 00 00     lea    0xe84(%rip),%rdi        # 2010 <_IO_stdin_used+0x10>
    118c:    e8 bf fe ff ff           callq  1050 <puts@plt>    // puts(rdi)
    1191:    8b 45 f8                 mov    -0x8(%rbp),%eax    // eax=(rbp-0x8)
    1194:    3b 45 fc                 cmp    -0x4(%rbp),%eax    // eax-(rpb-0x4)
    1197:    74 0c                    je     11a5 <main+0x5c>    // == jump
    1199:    48 8d 3d 77 0e 00 00     lea    0xe77(%rip),%rdi        # 2017 <_IO_stdin_used+0x17>
    11a0:    e8 ab fe ff ff           callq  1050 <puts@plt>
    11a5:    8b 45 f8                 mov    -0x8(%rbp),%eax
    11a8:    3b 45 fc                 cmp    -0x4(%rbp),%eax
    11ab:    7c 0c                    jl     11b9 <main+0x70>    // < jump
    11ad:    48 8d 3d 6a 0e 00 00     lea    0xe6a(%rip),%rdi        # 201e <_IO_stdin_used+0x1e>
    11b4:    e8 97 fe ff ff           callq  1050 <puts@plt>
    11b9:    8b 45 f8                 mov    -0x8(%rbp),%eax
    11bc:    3b 45 fc                 cmp    -0x4(%rbp),%eax
    11bf:    7f 0c                    jg     11cd <main+0x84>    // > jump
    11c1:    48 8d 3d 5d 0e 00 00     lea    0xe5d(%rip),%rdi        # 2025 <_IO_stdin_used+0x25>
    11c8:    e8 83 fe ff ff           callq  1050 <puts@plt>
    11cd:    b8 00 00 00 00           mov    $0x0,%eax
    11d2:    c9                       leaveq
    11d3:    c3                       retq   
    11d4:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
    11db:    00 00 00
    11de:    66 90                    xchg   %ax,%ax

/*
 * arm
 */
000000000040055c <main>:
  40055c:    a9be7bfd     stp    x29, x30, [sp, #-32]!
  400560:    910003fd     mov    x29, sp
  400564:    b9401fa1     ldr    w1, [x29, #28]        // w1=[x29+28]
  400568:    b9401ba0     ldr    w0, [x29, #24]        // w0=[x29+24]
  40056c:    6b00003f     cmp    w1, w0            // w1-w0
  400570:    5400008a     b.ge    400580 <main+0x24>  // b.tcont    >=
  400574:    90000000     adrp    x0, 400000 <_init-0x3e8>
  400578:    911b2000     add    x0, x0, #0x6c8
  40057c:    97ffffb5     bl    400450 <puts@plt>    // puts(x0)
  400580:    b9401fa1     ldr    w1, [x29, #28]
  400584:    b9401ba0     ldr    w0, [x29, #24]
  400588:    6b00003f     cmp    w1, w0
  40058c:    5400008d     b.le    40059c <main+0x40>    // <=
  400590:    90000000     adrp    x0, 400000 <_init-0x3e8>
  400594:    911b4000     add    x0, x0, #0x6d0
  400598:    97ffffae     bl    400450 <puts@plt>    // puts(x0)
  40059c:    b9401fa1     ldr    w1, [x29, #28]
  4005a0:    b9401ba0     ldr    w0, [x29, #24]
  4005a4:    6b00003f     cmp    w1, w0
  4005a8:    54000081     b.ne    4005b8 <main+0x5c>  // b.any    !=
  4005ac:    90000000     adrp    x0, 400000 <_init-0x3e8>
  4005b0:    911b6000     add    x0, x0, #0x6d8
  4005b4:    97ffffa7     bl    400450 <puts@plt>
  4005b8:    b9401fa1     ldr    w1, [x29, #28]
  4005bc:    b9401ba0     ldr    w0, [x29, #24]
  4005c0:    6b00003f     cmp    w1, w0
  4005c4:    54000080     b.eq    4005d4 <main+0x78>  // b.none    ==
  4005c8:    90000000     adrp    x0, 400000 <_init-0x3e8>
  4005cc:    911b8000     add    x0, x0, #0x6e0
  4005d0:    97ffffa0     bl    400450 <puts@plt>
  4005d4:    b9401fa1     ldr    w1, [x29, #28]
  4005d8:    b9401ba0     ldr    w0, [x29, #24]
  4005dc:    6b00003f     cmp    w1, w0
  4005e0:    5400008b     b.lt    4005f0 <main+0x94>  // b.tstop    <
  4005e4:    90000000     adrp    x0, 400000 <_init-0x3e8>
  4005e8:    911ba000     add    x0, x0, #0x6e8
  4005ec:    97ffff99     bl    400450 <puts@plt>
  4005f0:    b9401fa1     ldr    w1, [x29, #28]
  4005f4:    b9401ba0     ldr    w0, [x29, #24]
  4005f8:    6b00003f     cmp    w1, w0
  4005fc:    5400008c     b.gt    40060c <main+0xb0>        >
  400600:    90000000     adrp    x0, 400000 <_init-0x3e8>
  400604:    911bc000     add    x0, x0, #0x6f0
  400608:    97ffff92     bl    400450 <puts@plt>
  40060c:    52800000     mov    w0, #0x0                       // #0
  400610:    a8c27bfd     ldp    x29, x30, [sp], #32
  400614:    d65f03c0     ret


#endif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值