#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ m_out;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int **);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int, unsigned int,
                           unsigned int, unsigned int, unsigned int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  unsigned int m_val[8];
  unsigned int m_val_tmp;
  unsigned int m_input[8];
  unsigned int m_input_tmp[8];
  int i0 = 0, i1 = 0, i2 = 0;
  printf("\n\nHELP: input tran -c to enter client code mode!\n\n");
  if (argc >= 2) {
    ;
  }
  if (argc >= 2) {
    if (strcmp(argv[1], "-c") == 0) {
      printf("Please enter your client code(for example 0x1234):\n");
      scanf("%x", &m_input);
      if (m_input[0] > 0xFFFF || m_input[0] <= 0) {
        printf("ERROR CODE!\n");
        return -1;
      }
      m_input_tmp[0] = m_input[0];
      while (i0 < 4) {
        m_val[i0] = 0;
        while (i1 < 4) {
          m_val[i0] |= m_input[0] & 0x01;
          if (i1 != 3)
            m_val[i0] <<= 1;
          m_input[0] >>= 1;
          i1++;
        }
        i1 = 0;
        i0++;
      }
      printf("0x%x ==> 0x%x%x%x%x\n", m_input_tmp[0], m_val[2], m_val[3],
             m_val[0], m_val[1]);
    } else {
      printf("Wrong argument!\n");
      goto KEY_CODE;
    }
  } else {
  KEY_CODE:
    while (1) {
      int i2 = 0;
      char m_out[128];
      while (i2 < 4) {
        m_input[i2] = 0;
        m_input_tmp[i2] = 0;
        m_val[i2] = 0;
        i2++;
      }
      printf("Please enter your key code(for example 0x56):\n");
      scanf("%x", &m_input);
      ;
      if (m_input[0] > 0xff || m_input[0] <= 0) {
        printf("ERROR CODE!\n");
        break;
      }
      m_input_tmp[0] = m_input[0];
      while (i0 < 2) {
        m_val[i0] = 0;
        while (i1 < 4) {
          m_val[i0] |= m_input[0] & 0x01;
          ;
          if (i1 != 3)
            m_val[i0] <<= 1;
          m_input[0] >>= 1;
          i1++;
        }
        i1 = 0;
        i0++;
      }
      i0 = 0;
      m_val[2] = ~m_val[0] & 0x0F;
      m_val[3] = ~m_val[1] & 0x0F;
      printf("0x%x ==> 0x%x%x%x%x\n", m_input_tmp[0], m_val[0], m_val[1],
             m_val[2], m_val[3]);
      memset(m_out, 0x0, sizeof(m_out));
      sprintf(m_out, "echo \"0x%x --  0x%x%x%x%x \" >> key_code ",
              m_input_tmp[0], m_val[0], m_val[1], m_val[2], m_val[3]);
      system(m_out);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jl     11b4 <main+0x54>
jmp    11b4 <main+0x54>
cmpl   $0x2,-0x8(%rbp)
jl     1305 <main+0x1a5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe66(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12ed <main+0x18d>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   1070 <scanf@plt>
cmpl   $0xffff,-0x60(%rbp)
ja     1211 <main+0xb1>
cmpl   $0x0,-0x60(%rbp)
ja     122b <main+0xcb>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14de <main+0x37e>
mov    -0x60(%rbp),%eax
mov    %eax,-0x80(%rbp)
cmpl   $0x4,-0x84(%rbp)
jge    12c9 <main+0x169>
movslq -0x84(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
cmpl   $0x4,-0x88(%rbp)
jge    12ab <main+0x14b>
mov    -0x60(%rbp),%ecx
and    $0x1,%ecx
movslq -0x84(%rbp),%rax
or     -0x30(%rbp,%rax,4),%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
cmpl   $0x3,-0x88(%rbp)
je     128e <main+0x12e>
movslq -0x84(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
shl    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x60(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    124d <main+0xed>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1231 <main+0xd1>
mov    -0x80(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1300 <main+0x1a0>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    130a <main+0x1aa>
jmp    14de <main+0x37e>
jmp    130a <main+0x1aa>
jmp    130f <main+0x1af>
movl   $0x0,-0x90(%rbp)
cmpl   $0x4,-0x90(%rbp)
jge    1367 <main+0x207>
movslq -0x90(%rbp),%rax
movl   $0x0,-0x60(%rbp,%rax,4)
movslq -0x90(%rbp),%rax
movl   $0x0,-0x80(%rbp,%rax,4)
movslq -0x90(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1319 <main+0x1b9>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xcea(%rip),%rdi
call   1070 <scanf@plt>
cmpl   $0xff,-0x60(%rbp)
ja     139c <main+0x23c>
cmpl   $0x0,-0x60(%rbp)
ja     13af <main+0x24f>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14d9 <main+0x379>
mov    -0x60(%rbp),%eax
mov    %eax,-0x80(%rbp)
cmpl   $0x2,-0x84(%rbp)
jge    144d <main+0x2ed>
movslq -0x84(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
cmpl   $0x4,-0x88(%rbp)
jge    142f <main+0x2cf>
mov    -0x60(%rbp),%ecx
and    $0x1,%ecx
movslq -0x84(%rbp),%rax
or     -0x30(%rbp,%rax,4),%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
cmpl   $0x3,-0x88(%rbp)
je     1412 <main+0x2b2>
movslq -0x84(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
shl    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x60(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    13d1 <main+0x271>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    13b5 <main+0x255>
movl   $0x0,-0x84(%rbp)
mov    -0x30(%rbp),%eax
xor    $0xffffffff,%eax
and    $0xf,%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
xor    $0xffffffff,%eax
and    $0xf,%eax
mov    %eax,-0x24(%rbp)
mov    -0x80(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x24(%rbp),%r9d
lea    0xbf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
lea    -0x110(%rbp),%rdi
mov    -0x80(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x24(%rbp),%eax
lea    0xc0f(%rip),%rsi
mov    %eax,(%rsp)
call   1080 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <system@plt>
jmp    130f <main+0x1af>
jmp    14de <main+0x37e>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebp
jl     11bc <main+0x4c>
mov    0x8(%rbx),%rdi
lea    0xe6e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1316 <main+0x1a6>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3c(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x10(%rsp),%r14d
lea    -0x100(%r14),%eax
cmp    $0xffffff01,%eax
jb     12f4 <main+0x184>
lea    0x30(%rsp),%rbx
nopl   (%rax)
mov    %r14d,%eax
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x50,%cl
add    %cl,%cl
shr    %al
and    $0x50,%al
or     %cl,%al
shr    $0x4,%al
movzbl %al,%r13d
mov    %r14d,%eax
shr    $0x3,%eax
and    $0x2,%eax
mov    %r14d,%ecx
shr    $0x5,%ecx
mov    %ecx,%edx
and    $0x1,%edx
or     %eax,%edx
and    $0x2,%ecx
lea    (%rcx,%rdx,4),%eax
mov    %r14d,%r12d
shr    $0x7,%r12d
or     %eax,%r12d
mov    %r14d,%eax
shr    $0x8,%eax
mov    %eax,0x10(%rsp)
mov    %r13d,%r15d
xor    $0xf,%r15d
mov    %r12d,%ebp
xor    $0xf,%ebp
lea    0xda9(%rip),%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
mov    %ebp,(%rsp)
mov    %rbx,%rdi
lea    0xd8c(%rip),%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    %r12d,%r8d
mov    %r15d,%r9d
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xdbf(%rip),%rdi
call   1030 <puts@plt>
lea    0xd40(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x10(%rsp),%r14d
lea    -0x100(%r14),%eax
cmp    $0xffffff00,%eax
ja     1200 <main+0x90>
lea    0xdfc(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xda7(%rip),%rdi
call   1030 <puts@plt>
lea    0xcea(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x10(%rsp),%esi
lea    -0x10000(%rsi),%eax
cmp    $0xffff0001,%eax
jae    1357 <main+0x1e7>
lea    0xdac(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    1302 <main+0x192>
mov    %esi,%eax
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x50,%cl
add    %cl,%cl
shr    %al
and    $0x50,%al
or     %cl,%al
shr    $0x4,%al
movzbl %al,%r8d
mov    %esi,%eax
shr    $0x3,%eax
and    $0x2,%eax
mov    %esi,%ecx
shr    $0x5,%ecx
mov    %ecx,%edx
and    $0x1,%edx
or     %eax,%edx
and    $0x2,%ecx
lea    (%rcx,%rdx,4),%eax
mov    %esi,%ecx
shr    $0x7,%ecx
mov    %ecx,%r9d
and    $0x1,%r9d
or     %eax,%r9d
and    $0x2,%ecx
mov    %esi,%eax
shr    $0x9,%eax
mov    %eax,%edx
and    $0x1,%edx
or     %ecx,%edx
and    $0x2,%eax
lea    (%rax,%rdx,4),%eax
mov    %esi,%ecx
shr    $0xb,%ecx
mov    %ecx,%edx
and    $0x1,%edx
or     %eax,%edx
and    $0x2,%ecx
mov    %esi,%eax
shr    $0xd,%eax
mov    %eax,%edi
and    $0x1,%edi
or     %ecx,%edi
and    $0x2,%eax
lea    (%rax,%rdi,4),%eax
mov    %esi,%ecx
shr    $0xf,%ecx
or     %eax,%ecx
mov    %esi,%eax
shr    $0x10,%eax
mov    %eax,0x10(%rsp)
lea    0xc21(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1302 <main+0x192>

LLVM IR (-O0):
@.str = [51 x i8] c"\0A\0AHELP: input tran -c to enter client code mode!\0A\0A\00"
@.str.1 = [3 x i8] c"-c\00"
@.str.2 = [52 x i8] c"Please enter your client code(for example 0x1234):\0A\00"
@.str.3 = [3 x i8] c"%x\00"
@.str.4 = [13 x i8] c"ERROR CODE!\0A\00"
@.str.5 = [21 x i8] c"0x%x ==> 0x%x%x%x%x\0A\00"
@.str.6 = [17 x i8] c"Wrong argument!\0A\00"
@.str.7 = [47 x i8] c"Please enter your key code(for example 0x56):\0A\00"
@.str.8 = [41 x i8] c"echo \220x%x -- 0x%x%x%x%x \22 >> key_code \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i32]
%7 = alloca i32
%8 = alloca [8 x i32]
%9 = alloca [8 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %4
%17 = icmp sge i32 %16, 2
br i1 %17, label %18, label %19
18: ; preds = %2
br label %19
19: ; preds = %18, %2
%20 = load i32, i32* %4
%21 = icmp sge i32 %20, 2
br i1 %21, label %22, label %96
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %93
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%30 = bitcast [8 x i32]* %8 to i32**
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32** %30)
%32 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%33 = load i32, i32* %32
%34 = icmp ugt i32 %33, 65535
br i1 %34, label %39, label %35
35: ; preds = %28
%36 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%37 = load i32, i32* %36
%38 = icmp ule i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35, %28
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %206
41: ; preds = %35
%42 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%43 = load i32, i32* %42
%44 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 0
store i32 %43, i32* %44
br label %45
45: ; preds = %78, %41
%46 = load i32, i32* %10
%47 = icmp slt i32 %46, 4
br i1 %47, label %48, label %81
48: ; preds = %45
%49 = load i32, i32* %10
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %50
store i32 0, i32* %51
br label %52
52: ; preds = %72, %48
%53 = load i32, i32* %11
%54 = icmp slt i32 %53, 4
br i1 %54, label %55, label %78
55: ; preds = %52
%56 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%57 = load i32, i32* %56
%58 = and i32 %57, 1
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = or i32 %62, %58
store i32 %63, i32* %61
%64 = load i32, i32* %11
%65 = icmp ne i32 %64, 3
br i1 %65, label %66, label %72
66: ; preds = %55
%67 = load i32, i32* %10
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = shl i32 %70, 1
store i32 %71, i32* %69
br label %72
72: ; preds = %66, %55
%73 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%74 = load i32, i32* %73
%75 = lshr i32 %74, 1
store i32 %75, i32* %73
%76 = load i32, i32* %11
%77 = add nsw i32 %76, 1
store i32 %77, i32* %11
br label %52
78: ; preds = %52
store i32 0, i32* %11
%79 = load i32, i32* %10
%80 = add nsw i32 %79, 1
store i32 %80, i32* %10
br label %45
81: ; preds = %45
%82 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 0
%83 = load i32, i32* %82
%84 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 2
%85 = load i32, i32* %84
%86 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 3
%87 = load i32, i32* %86
%88 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%89 = load i32, i32* %88
%90 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 1
%91 = load i32, i32* %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %83, i32 %85, i32 %87, i32 %89, i32 %91)
br label %95
93: ; preds = %22
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %97
95: ; preds = %81
br label %206
96: ; preds = %19
br label %97
97: ; preds = %96, %93
br label %98
98: ; preds = %97, %167
store i32 0, i32* %13
br label %99
99: ; preds = %102, %98
%100 = load i32, i32* %13
%101 = icmp slt i32 %100, 4
br i1 %101, label %102, label %114
102: ; preds = %99
%103 = load i32, i32* %13
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 %104
store i32 0, i32* %105
%106 = load i32, i32* %13
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 %107
store i32 0, i32* %108
%109 = load i32, i32* %13
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %110
store i32 0, i32* %111
%112 = load i32, i32* %13
%113 = add nsw i32 %112, 1
store i32 %113, i32* %13
br label %99
114: ; preds = %99
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%116 = bitcast [8 x i32]* %8 to i32**
%117 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32** %116)
%118 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%119 = load i32, i32* %118
%120 = icmp ugt i32 %119, 255
br i1 %120, label %125, label %121
121: ; preds = %114
%122 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%123 = load i32, i32* %122
%124 = icmp ule i32 %123, 0
br i1 %124, label %125, label %127
125: ; preds = %121, %114
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %205
127: ; preds = %121
%128 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%129 = load i32, i32* %128
%130 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 0
store i32 %129, i32* %130
br label %131
131: ; preds = %164, %127
%132 = load i32, i32* %10
%133 = icmp slt i32 %132, 2
br i1 %133, label %134, label %167
134: ; preds = %131
%135 = load i32, i32* %10
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %136
store i32 0, i32* %137
br label %138
138: ; preds = %158, %134
%139 = load i32, i32* %11
%140 = icmp slt i32 %139, 4
br i1 %140, label %141, label %164
141: ; preds = %138
%142 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%143 = load i32, i32* %142
%144 = and i32 %143, 1
%145 = load i32, i32* %10
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %146
%148 = load i32, i32* %147
%149 = or i32 %148, %144
store i32 %149, i32* %147
%150 = load i32, i32* %11
%151 = icmp ne i32 %150, 3
br i1 %151, label %152, label %158
152: ; preds = %141
%153 = load i32, i32* %10
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %154
%156 = load i32, i32* %155
%157 = shl i32 %156, 1
store i32 %157, i32* %155
br label %158
158: ; preds = %152, %141
%159 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%160 = load i32, i32* %159
%161 = lshr i32 %160, 1
store i32 %161, i32* %159
%162 = load i32, i32* %11
%163 = add nsw i32 %162, 1
store i32 %163, i32* %11
br label %138
164: ; preds = %138
store i32 0, i32* %11
%165 = load i32, i32* %10
%166 = add nsw i32 %165, 1
store i32 %166, i32* %10
br label %131
167: ; preds = %131
store i32 0, i32* %10
%168 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%169 = load i32, i32* %168
%170 = xor i32 %169, -1
%171 = and i32 %170, 15
%172 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 2
store i32 %171, i32* %172
%173 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 1
%174 = load i32, i32* %173
%175 = xor i32 %174, -1
%176 = and i32 %175, 15
%177 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 3
store i32 %176, i32* %177
%178 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 0
%179 = load i32, i32* %178
%180 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%181 = load i32, i32* %180
%182 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 1
%183 = load i32, i32* %182
%184 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 2
%185 = load i32, i32* %184
%186 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 3
%187 = load i32, i32* %186
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %179, i32 %181, i32 %183, i32 %185, i32 %187)
%189 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%190 = call i32 @memset(i8* %189, i32 0, i32 128)
%191 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%192 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 0
%193 = load i32, i32* %192
%194 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%195 = load i32, i32* %194
%196 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 1
%197 = load i32, i32* %196
%198 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 2
%199 = load i32, i32* %198
%200 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 3
%201 = load i32, i32* %200
%202 = call i32 @sprintf(i8* %191, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i32 %193, i32 %195, i32 %197, i32 %199, i32 %201)
%203 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%204 = call i32 @system(i8* %203)
br label %98
205: ; preds = %125
br label %206
206: ; preds = %39, %205, %95
%207 = load i32, i32* %3
ret i32 %207
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-c\00"
@.str.3 = [3 x i8] c"%x\00"
@.str.5 = [21 x i8] c"0x%x ==> 0x%x%x%x%x\0A\00"
@.str.8 = [41 x i8] c"echo \220x%x -- 0x%x%x%x%x \22 >> key_code \00"
@str = [50 x i8] c"\0A\0AHELP: input tran -c to enter client code mode!\0A\00"
@str.9 = [46 x i8] c"Please enter your key code(for example 0x56):\00"
@str.11 = [16 x i8] c"Wrong argument!\00"
@str.12 = [51 x i8] c"Please enter your client code(for example 0x1234):\00"
@str.13 = [12 x i8] c"ERROR CODE!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = alloca [128 x i8]
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %66
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %64
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.12, i64 0, i64 0))
%15 = bitcast [8 x i32]* %3 to i32**
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32** %15)
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%18 = load i32, i32* %17
%19 = add i32 %18, -65536
%20 = icmp ult i32 %19, -65535
br i1 %20, label %62, label %21
21: ; preds = %13
%22 = trunc i32 %18 to i4
%23 = call i4 @llvm.bitreverse.i4(i4 %22)
%24 = zext i4 %23 to i32
%25 = lshr i32 %18, 3
%26 = and i32 %25, 2
%27 = lshr i32 %18, 5
%28 = and i32 %27, 1
%29 = or i32 %26, %28
%30 = shl nuw nsw i32 %29, 2
%31 = lshr i32 %18, 5
%32 = and i32 %31, 2
%33 = or i32 %30, %32
%34 = lshr i32 %18, 7
%35 = and i32 %34, 1
%36 = or i32 %33, %35
%37 = lshr i32 %18, 7
%38 = and i32 %37, 2
%39 = lshr i32 %18, 9
%40 = and i32 %39, 1
%41 = or i32 %38, %40
%42 = shl nuw nsw i32 %41, 2
%43 = lshr i32 %18, 9
%44 = and i32 %43, 2
%45 = or i32 %42, %44
%46 = lshr i32 %18, 11
%47 = and i32 %46, 1
%48 = or i32 %45, %47
%49 = lshr i32 %18, 11
%50 = and i32 %49, 2
%51 = lshr i32 %18, 13
%52 = and i32 %51, 1
%53 = or i32 %50, %52
%54 = shl nuw nsw i32 %53, 2
%55 = lshr i32 %18, 13
%56 = and i32 %55, 2
%57 = or i32 %54, %56
%58 = lshr i32 %18, 15
%59 = or i32 %57, %58
%60 = lshr i32 %18, 16
store i32 %60, i32* %17
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %18, i32 %48, i32 %59, i32 %24, i32 %36)
br label %105
62: ; preds = %13
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.13, i64 0, i64 0))
br label %105
64: ; preds = %8
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.11, i64 0, i64 0))
br label %66
66: ; preds = %2, %64
%67 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%68 = bitcast [8 x i32]* %3 to i32**
%69 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.9, i64 0, i64 0))
%71 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32** %68)
%72 = load i32, i32* %69
%73 = add i32 %72, -256
%74 = icmp ult i32 %73, -255
br i1 %74, label %103, label %75
75: ; preds = %66, %75
%76 = phi i32 [ %100, %75 ], [ %72, %66 ]
%77 = trunc i32 %76 to i4
%78 = call i4 @llvm.bitreverse.i4(i4 %77)
%79 = zext i4 %78 to i32
%80 = lshr i32 %76, 3
%81 = and i32 %80, 2
%82 = lshr i32 %76, 5
%83 = and i32 %82, 1
%84 = or i32 %81, %83
%85 = shl nuw nsw i32 %84, 2
%86 = lshr i32 %76, 5
%87 = and i32 %86, 2
%88 = or i32 %85, %87
%89 = lshr i32 %76, 7
%90 = or i32 %88, %89
%91 = lshr i32 %76, 8
store i32 %91, i32* %69
%92 = xor i32 %79, 15
%93 = xor i32 %90, 15
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %76, i32 %79, i32 %90, i32 %92, i32 %93)
%95 = call i32 @memset(i8* %67, i32 0, i32 128)
%96 = call i32 @sprintf(i8* %67, i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i32 %76, i32 %79, i32 %90, i32 %92, i32 %93)
%97 = call i32 @system(i8* %67)
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.9, i64 0, i64 0))
%99 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32** %68)
%100 = load i32, i32* %69
%101 = add i32 %100, -256
%102 = icmp ult i32 %101, -255
br i1 %102, label %103, label %75
103: ; preds = %75, %66
%104 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.13, i64 0, i64 0))
br label %105
105: ; preds = %103, %21, %62
%106 = phi i32 [ -1, %62 ], [ 0, %21 ], [ 0, %103 ]
ret i32 %106
}