反汇编 之C 复杂 if

#include <stdio.h>

/*
 * 识别复杂运算
 */

int main()
{
    unsigned int a;
    unsigned int b;
    int c;
    int d;

    if (d) {
        printf("TRUE\n");
    }
    else {
        if (((a > b) && (a != 0)) || ((a == c) && (c != 0)))
            printf("OK\n");
    }

    if (c == d)
        printf("+++\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 f0 00              cmpl   $0x0,-0x10(%rbp)    // (rbp-0x10)-0x0
    1159:    74 0e                    je     1169 <main+0x20>    // ==0 jump
    115b:    48 8d 3d a2 0e 00 00     lea    0xea2(%rip),%rdi        # 2004 <_IO_stdin_used+0x4>
    1162:    e8 e9 fe ff ff           callq  1050 <puts@plt>    // puts(rdi)
    1167:    eb 28                    jmp    1191 <main+0x48>    // jump
    1169:    8b 45 f4                 mov    -0xc(%rbp),%eax    // eax=(rbp-0xc)
    116c:    3b 45 f8                 cmp    -0x8(%rbp),%eax    // eax-(rbp-0x8)
    116f:    76 06                    jbe    1177 <main+0x2e>    // (无符号<=) jump
    1171:    83 7d f4 00              cmpl   $0x0,-0xc(%rbp)    // (rbp-0xc)-0x0
    1175:    75 0e                    jne    1185 <main+0x3c>    // 不等/非零 jump
    1177:    8b 45 fc                 mov    -0x4(%rbp),%eax    // eax=(rbp-0x4)
    117a:    39 45 f4                 cmp    %eax,-0xc(%rbp)    // (rbp-0xc)-eax
    117d:    75 12                    jne    1191 <main+0x48>    // 不等/非零 jump
    117f:    83 7d fc 00              cmpl   $0x0,-0x4(%rbp)    // (rbp-0x4)-0x0
    1183:    74 0c                    je     1191 <main+0x48>    // 等于/零 jump
    1185:    48 8d 3d 7d 0e 00 00     lea    0xe7d(%rip),%rdi        # 2009 <_IO_stdin_used+0x9>
    118c:    e8 bf fe ff ff           callq  1050 <puts@plt>
    1191:    8b 45 fc                 mov    -0x4(%rbp),%eax    // eax=(rbp-0x4)
    1194:    3b 45 f0                 cmp    -0x10(%rbp),%eax    // eax-(rbp-0x10)
    1197:    75 0c                    jne    11a5 <main+0x5c>    // 不等/非零 jump
    1199:    48 8d 3d 6c 0e 00 00     lea    0xe6c(%rip),%rdi        # 200c <_IO_stdin_used+0xc>
    11a0:    e8 ab fe ff ff           callq  1050 <puts@plt>
    11a5:    b8 00 00 00 00           mov    $0x0,%eax
    11aa:    c9                       leaveq
    11ab:    c3                       retq   
    11ac:    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:    7100001f     cmp    w0, #0x0        // w0-0x0
  40056c:    540000a0     b.eq    400580 <main+0x24>  // b.none    相等
  400570:    90000000     adrp    x0, 400000 <_init-0x3e8>
  400574:    911a8000     add    x0, x0, #0x6a0
  400578:    97ffffb6     bl    400450 <puts@plt>
  40057c:    14000012     b    4005c4 <main+0x68>
  400580:    b9401ba1     ldr    w1, [x29, #24]
  400584:    b94017a0     ldr    w0, [x29, #20]
  400588:    6b00003f     cmp    w1, w0
  40058c:    54000089     b.ls    40059c <main+0x40>  // b.plast    无符号 <=
  400590:    b9401ba0     ldr    w0, [x29, #24]
  400594:    7100001f     cmp    w0, #0x0
  400598:    54000101     b.ne    4005b8 <main+0x5c>  // b.any    不等
  40059c:    b94013a0     ldr    w0, [x29, #16]
  4005a0:    b9401ba1     ldr    w1, [x29, #24]
  4005a4:    6b00003f     cmp    w1, w0
  4005a8:    540000e1     b.ne    4005c4 <main+0x68>  // b.any    不等
  4005ac:    b94013a0     ldr    w0, [x29, #16]
  4005b0:    7100001f     cmp    w0, #0x0
  4005b4:    54000080     b.eq    4005c4 <main+0x68>  // b.none    相等
  4005b8:    90000000     adrp    x0, 400000 <_init-0x3e8>
  4005bc:    911aa000     add    x0, x0, #0x6a8
  4005c0:    97ffffa4     bl    400450 <puts@plt>
  4005c4:    b94013a1     ldr    w1, [x29, #16]
  4005c8:    b9401fa0     ldr    w0, [x29, #28]
  4005cc:    6b00003f     cmp    w1, w0
  4005d0:    54000081     b.ne    4005e0 <main+0x84>  // b.any    不等
  4005d4:    90000000     adrp    x0, 400000 <_init-0x3e8>
  4005d8:    911ac000     add    x0, x0, #0x6b0
  4005dc:    97ffff9d     bl    400450 <puts@plt>
  4005e0:    52800000     mov    w0, #0x0                       // #0
  4005e4:    a8c27bfd     ldp    x29, x30, [sp], #32
  4005e8:    d65f03c0     ret
  4005ec:    00000000     .inst    0x00000000 ; undefined

#endif

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值