#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 */

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ displayBinary(unsigned char *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
int hexToBin(char *, unsigned char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  unsigned char *redeemScript;
  unsigned char publicKey[100 * 15];
  int publicKeyLength[15];
  int offset = 0;
  int m;
  int n;
  int i;
  int inputScriptSize = 0;
  if (argc < 3) {
    fprintf(stderr, "Usage : %s [M] [N] N*[public key]\n", argv[0]);
    return 0;
  }
  m = atoi(argv[1]);
  n = atoi(argv[2]);
  if ((m == 0) || (n == 0) || (n > 15) || (m > n)) {
    fprintf(stderr, "Invalid M / N\n");
    return 0;
  }
  if (argc != (3 + n)) {
    fprintf(stderr, "Invalid number of arguments\n");
    return 0;
  }
  for (i = 0; i < n; i++) {
    publicKeyLength[i] = hexToBin(argv[3 + i], &publicKey[100 * i], 100);
    if (publicKeyLength[i] <= 0) {
      fprintf(stderr, "Invalid public key %d\n", (i + 1));
      return 0;
    }
    inputScriptSize += publicKeyLength[i] + 1;
  }
  redeemScript = (unsigned char *)malloc(inputScriptSize + 3);
  if (redeemScript == NULL) {
    fprintf(stderr, "Failed to allocate redeem script\n");
    return 0;
  }
  redeemScript[offset++] = 0x50 + m;
  for (i = 0; i < n; i++) {
    redeemScript[offset++] = publicKeyLength[i];
    memcpy(redeemScript + offset, &publicKey[100 * i], publicKeyLength[i]);
    offset += publicKeyLength[i];
  }
  redeemScript[offset++] = 0x50 + n;
  redeemScript[offset++] = 0xAE;
  printf("Redeem script : ");
  displayBinary(redeemScript, offset);
  free(redeemScript);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x660,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x644(%rbp)
movl   $0x0,-0x654(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11e1 <main+0x61>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe32(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e5 <main+0x365>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x648(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x64c(%rbp)
cmpl   $0x0,-0x648(%rbp)
je     1240 <main+0xc0>
cmpl   $0x0,-0x64c(%rbp)
je     1240 <main+0xc0>
cmpl   $0xf,-0x64c(%rbp)
jg     1240 <main+0xc0>
mov    -0x648(%rbp),%eax
cmp    -0x64c(%rbp),%eax
jle    1263 <main+0xe3>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e5 <main+0x365>
mov    -0x8(%rbp),%eax
mov    -0x64c(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
je     129a <main+0x11a>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e5 <main+0x365>
movl   $0x0,-0x650(%rbp)
mov    -0x650(%rbp),%eax
cmp    -0x64c(%rbp),%eax
jge    1369 <main+0x1e9>
mov    -0x10(%rbp),%rax
mov    -0x650(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
imul   $0x64,-0x650(%rbp),%eax
cltq
lea    -0x600(%rbp),%rsi
add    %rax,%rsi
mov    $0x64,%edx
call   10a0 <hexToBin@plt>
mov    %eax,%ecx
movslq -0x650(%rbp),%rax
mov    %ecx,-0x640(%rbp,%rax,4)
movslq -0x650(%rbp),%rax
cmpl   $0x0,-0x640(%rbp,%rax,4)
jg     1338 <main+0x1b8>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
mov    -0x650(%rbp),%edx
add    $0x1,%edx
lea    0xd2a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e5 <main+0x365>
movslq -0x650(%rbp),%rax
mov    -0x640(%rbp,%rax,4),%eax
add    $0x1,%eax
add    -0x654(%rbp),%eax
mov    %eax,-0x654(%rbp)
mov    -0x650(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x650(%rbp)
jmp    12a4 <main+0x124>
mov    -0x654(%rbp),%edi
add    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13a9 <main+0x229>
mov    0x2c53(%rip),%rax
mov    (%rax),%edi
lea    0xcd0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e5 <main+0x365>
mov    -0x648(%rbp),%eax
add    $0x50,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x644(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x644(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
movl   $0x0,-0x650(%rbp)
mov    -0x650(%rbp),%eax
cmp    -0x64c(%rbp),%eax
jge    1478 <main+0x2f8>
movslq -0x650(%rbp),%rax
mov    -0x640(%rbp,%rax,4),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x644(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x644(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
movslq -0x644(%rbp),%rax
add    %rax,%rdi
imul   $0x64,-0x650(%rbp),%eax
cltq
lea    -0x600(%rbp),%rsi
add    %rax,%rsi
movslq -0x650(%rbp),%rax
mov    -0x640(%rbp,%rax,4),%edx
call   1060 <memcpy@plt>
movslq -0x650(%rbp),%rax
mov    -0x640(%rbp,%rax,4),%eax
add    -0x644(%rbp),%eax
mov    %eax,-0x644(%rbp)
mov    -0x650(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x650(%rbp)
jmp    13d9 <main+0x259>
mov    -0x64c(%rbp),%eax
add    $0x50,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x644(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x644(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x644(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x644(%rbp)
movslq %ecx,%rcx
movb   $0xae,(%rax,%rcx,1)
lea    0xbc7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x644(%rbp),%esi
call   1070 <displayBinary@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x660,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x638,%rsp
mov    %rsi,%r12
cmp    $0x2,%edi
jg     11bb <main+0x3b>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xe53(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1367 <main+0x1e7>
mov    %edi,%ebx
mov    0x8(%r12),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%r12),%rdi
call   1090 <atoi@plt>
test   %ebp,%ebp
je     124c <main+0xcc>
mov    %eax,%r15d
test   %eax,%eax
je     124c <main+0xcc>
cmp    $0xf,%r15d
jg     124c <main+0xcc>
cmp    %r15d,%ebp
jg     124c <main+0xcc>
lea    0x3(%r15),%eax
cmp    %ebx,%eax
jne    1261 <main+0xe1>
test   %r15d,%r15d
jle    1276 <main+0xf6>
mov    %ebp,0x8(%rsp)
mov    %r15d,%r14d
xor    %ebx,%ebx
lea    0x50(%rsp),%rbp
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    0x18(%r12,%rbx,8),%rdi
mov    %rbp,%rsi
mov    $0x64,%edx
call   10a0 <hexToBin@plt>
mov    %eax,0x10(%rsp,%rbx,4)
test   %eax,%eax
jle    132e <main+0x1ae>
add    %eax,%r13d
add    $0x1,%r13d
add    $0x1,%rbx
add    $0x64,%rbp
cmp    %rbx,%r14
jne    1210 <main+0x90>
add    $0x3,%r13d
mov    0x8(%rsp),%ebp
jmp    127c <main+0xfc>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    0xdc7(%rip),%rsi
jmp    135e <main+0x1de>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
lea    0xdc1(%rip),%rsi
jmp    135e <main+0x1de>
mov    $0x3,%r13d
mov    %r13d,%edi
call   1080 <malloc@plt>
test   %rax,%rax
je     134e <main+0x1ce>
mov    %rax,%r12
add    $0x50,%bpl
mov    %bpl,(%rax)
mov    $0x1,%eax
mov    %r15,0x8(%rsp)
test   %r15d,%r15d
jle    12f2 <main+0x172>
mov    0x8(%rsp),%r13d
mov    $0x1,%eax
lea    0x50(%rsp),%rbx
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%r14,4),%ebp
movslq %eax,%r15
mov    %bpl,(%r12,%r15,1)
lea    (%r12,%r15,1),%rdi
add    $0x1,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <memcpy@plt>
lea    (%r15,%rbp,1),%eax
add    $0x1,%eax
add    $0x1,%r14
add    $0x64,%rbx
cmp    %r14,%r13
jne    12c0 <main+0x140>
mov    0x8(%rsp),%rcx
add    $0x50,%ecx
cltq
mov    %cl,(%r12,%rax,1)
lea    0x2(%rax),%ebx
movb   $0xae,0x1(%r12,%rax,1)
lea    0xd78(%rip),%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %ebx,%esi
call   1070 <displayBinary@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    $0x1,%ebp
jmp    1367 <main+0x1e7>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
add    $0x1,%ebx
lea    0xd0e(%rip),%rsi
xor    %ebp,%ebp
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1367 <main+0x1e7>
mov    0x2c8b(%rip),%rax
mov    (%rax),%edi
lea    0xd08(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %ebp,%eax
add    $0x638,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Usage : %s [M] [N] N*[public key]\0A\00"
@.str.1 = [15 x i8] c"Invalid M / N\0A\00"
@.str.2 = [29 x i8] c"Invalid number of arguments\0A\00"
@.str.3 = [23 x i8] c"Invalid public key %d\0A\00"
@.str.4 = [34 x i8] c"Failed to allocate redeem script\0A\00"
@.str.5 = [17 x i8] c"Redeem script : \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [1500 x i8]
%8 = alloca [15 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %13
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 0, i32* %3
br label %171
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %10
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %11
%31 = load i32, i32* %10
%32 = icmp eq i32 %31, 0
br i1 %32, label %43, label %33
33: ; preds = %22
%34 = load i32, i32* %11
%35 = icmp eq i32 %34, 0
br i1 %35, label %43, label %36
36: ; preds = %33
%37 = load i32, i32* %11
%38 = icmp sgt i32 %37, 15
br i1 %38, label %43, label %39
39: ; preds = %36
%40 = load i32, i32* %10
%41 = load i32, i32* %11
%42 = icmp sgt i32 %40, %41
br i1 %42, label %43, label %46
43: ; preds = %39, %36, %33, %22
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %171
46: ; preds = %39
%47 = load i32, i32* %4
%48 = load i32, i32* %11
%49 = add nsw i32 3, %48
%50 = icmp ne i32 %47, %49
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %171
54: ; preds = %46
store i32 0, i32* %12
br label %55
55: ; preds = %92, %54
%56 = load i32, i32* %12
%57 = load i32, i32* %11
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %95
59: ; preds = %55
%60 = load i8**, i8*** %5
%61 = load i32, i32* %12
%62 = add nsw i32 3, %61
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %60, i64 %63
%65 = load i8*, i8** %64
%66 = load i32, i32* %12
%67 = mul nsw i32 100, %66
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [1500 x i8], [1500 x i8]* %7, i64 0, i64 %68
%70 = call i32 @hexToBin(i8* %65, i8* %69, i32 100)
%71 = load i32, i32* %12
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [15 x i32], [15 x i32]* %8, i64 0, i64 %72
store i32 %70, i32* %73
%74 = load i32, i32* %12
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [15 x i32], [15 x i32]* %8, i64 0, i64 %75
%77 = load i32, i32* %76
%78 = icmp sle i32 %77, 0
br i1 %78, label %79, label %84
79: ; preds = %59
%80 = load i32, i32* @stderr
%81 = load i32, i32* %12
%82 = add nsw i32 %81, 1
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %82)
store i32 0, i32* %3
br label %171
84: ; preds = %59
%85 = load i32, i32* %12
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [15 x i32], [15 x i32]* %8, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = add nsw i32 %88, 1
%90 = load i32, i32* %13
%91 = add nsw i32 %90, %89
store i32 %91, i32* %13
br label %92
92: ; preds = %84
%93 = load i32, i32* %12
%94 = add nsw i32 %93, 1
store i32 %94, i32* %12
br label %55
95: ; preds = %55
%96 = load i32, i32* %13
%97 = add nsw i32 %96, 3
%98 = call i64 @malloc(i32 %97)
%99 = inttoptr i64 %98 to i8*
store i8* %99, i8** %6
%100 = load i8*, i8** %6
%101 = icmp eq i8* %100, null
br i1 %101, label %102, label %105
102: ; preds = %95
%103 = load i32, i32* @stderr
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %171
105: ; preds = %95
%106 = load i32, i32* %10
%107 = add nsw i32 80, %106
%108 = trunc i32 %107 to i8
%109 = load i8*, i8** %6
%110 = load i32, i32* %9
%111 = add nsw i32 %110, 1
store i32 %111, i32* %9
%112 = sext i32 %110 to i64
%113 = getelementptr inbounds i8, i8* %109, i64 %112
store i8 %108, i8* %113
store i32 0, i32* %12
br label %114
114: ; preds = %148, %105
%115 = load i32, i32* %12
%116 = load i32, i32* %11
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %151
118: ; preds = %114
%119 = load i32, i32* %12
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [15 x i32], [15 x i32]* %8, i64 0, i64 %120
%122 = load i32, i32* %121
%123 = trunc i32 %122 to i8
%124 = load i8*, i8** %6
%125 = load i32, i32* %9
%126 = add nsw i32 %125, 1
store i32 %126, i32* %9
%127 = sext i32 %125 to i64
%128 = getelementptr inbounds i8, i8* %124, i64 %127
store i8 %123, i8* %128
%129 = load i8*, i8** %6
%130 = load i32, i32* %9
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %129, i64 %131
%133 = load i32, i32* %12
%134 = mul nsw i32 100, %133
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [1500 x i8], [1500 x i8]* %7, i64 0, i64 %135
%137 = load i32, i32* %12
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [15 x i32], [15 x i32]* %8, i64 0, i64 %138
%140 = load i32, i32* %139
%141 = call i32 @memcpy(i8* %132, i8* %136, i32 %140)
%142 = load i32, i32* %12
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [15 x i32], [15 x i32]* %8, i64 0, i64 %143
%145 = load i32, i32* %144
%146 = load i32, i32* %9
%147 = add nsw i32 %146, %145
store i32 %147, i32* %9
br label %148
148: ; preds = %118
%149 = load i32, i32* %12
%150 = add nsw i32 %149, 1
store i32 %150, i32* %12
br label %114
151: ; preds = %114
%152 = load i32, i32* %11
%153 = add nsw i32 80, %152
%154 = trunc i32 %153 to i8
%155 = load i8*, i8** %6
%156 = load i32, i32* %9
%157 = add nsw i32 %156, 1
store i32 %157, i32* %9
%158 = sext i32 %156 to i64
%159 = getelementptr inbounds i8, i8* %155, i64 %158
store i8 %154, i8* %159
%160 = load i8*, i8** %6
%161 = load i32, i32* %9
%162 = add nsw i32 %161, 1
store i32 %162, i32* %9
%163 = sext i32 %161 to i64
%164 = getelementptr inbounds i8, i8* %160, i64 %163
store i8 -82, i8* %164
%165 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%166 = load i8*, i8** %6
%167 = load i32, i32* %9
%168 = call i32 @displayBinary(i8* %166, i32 %167)
%169 = load i8*, i8** %6
%170 = call i32 @free(i8* %169)
store i32 1, i32* %3
br label %171
171: ; preds = %151, %102, %79, %51, %43, %16
%172 = load i32, i32* %3
ret i32 %172
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Usage : %s [M] [N] N*[public key]\0A\00"
@.str.1 = [15 x i8] c"Invalid M / N\0A\00"
@.str.2 = [29 x i8] c"Invalid number of arguments\0A\00"
@.str.3 = [23 x i8] c"Invalid public key %d\0A\00"
@.str.4 = [34 x i8] c"Failed to allocate redeem script\0A\00"
@.str.5 = [17 x i8] c"Redeem script : \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1500 x i8]
%4 = alloca [15 x i32]
%5 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 0
%6 = bitcast [15 x i32]* %4 to i8*
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %105
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = icmp eq i32 %15, 0
%20 = icmp eq i32 %18, 0
%21 = select i1 %19, i1 true, i1 %20
%22 = icmp sgt i32 %18, 15
%23 = select i1 %21, i1 true, i1 %22
%24 = icmp sgt i32 %15, %18
%25 = select i1 %23, i1 true, i1 %24
br i1 %25, label %26, label %29
26: ; preds = %12
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %105
29: ; preds = %12
%30 = add nsw i32 %18, 3
%31 = icmp eq i32 %30, %0
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = icmp sgt i32 %18, 0
br i1 %33, label %34, label %62
34: ; preds = %32
%35 = zext i32 %18 to i64
br label %39
36: ; preds = %29
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %105
39: ; preds = %34, %55
%40 = phi i64 [ 0, %34 ], [ %58, %55 ]
%41 = phi i32 [ 0, %34 ], [ %57, %55 ]
%42 = add nuw nsw i64 %40, 3
%43 = getelementptr inbounds i8*, i8** %1, i64 %42
%44 = load i8*, i8** %43
%45 = mul nuw nsw i64 %40, 100
%46 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 %45
%47 = call i32 @hexToBin(i8* %44, i8* %46, i32 100)
%48 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %40
store i32 %47, i32* %48
%49 = icmp slt i32 %47, 1
br i1 %49, label %50, label %55
50: ; preds = %39
%51 = trunc i64 %40 to i32
%52 = load i32, i32* @stderr
%53 = add nuw nsw i32 %51, 1
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %53)
br label %105
55: ; preds = %39
%56 = add i32 %41, 1
%57 = add i32 %56, %47
%58 = add nuw nsw i64 %40, 1
%59 = icmp eq i64 %58, %35
br i1 %59, label %60, label %39
60: ; preds = %55
%61 = add i32 %57, 3
br label %62
62: ; preds = %60, %32
%63 = phi i32 [ 3, %32 ], [ %61, %60 ]
%64 = call i64 @malloc(i32 %63)
%65 = inttoptr i64 %64 to i8*
%66 = icmp eq i64 %64, 0
br i1 %66, label %67, label %70
67: ; preds = %62
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %105
70: ; preds = %62
%71 = trunc i32 %15 to i8
%72 = add i8 %71, 80
store i8 %72, i8* %65
br i1 %33, label %73, label %92
73: ; preds = %70
%74 = zext i32 %18 to i64
br label %75
75: ; preds = %73, %75
%76 = phi i64 [ 0, %73 ], [ %90, %75 ]
%77 = phi i32 [ 1, %73 ], [ %89, %75 ]
%78 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %76
%79 = load i32, i32* %78
%80 = trunc i32 %79 to i8
%81 = add nsw i32 %77, 1
%82 = sext i32 %77 to i64
%83 = getelementptr inbounds i8, i8* %65, i64 %82
store i8 %80, i8* %83
%84 = sext i32 %81 to i64
%85 = getelementptr inbounds i8, i8* %65, i64 %84
%86 = mul nuw nsw i64 %76, 100
%87 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 %86
%88 = call i32 @memcpy(i8* %85, i8* %87, i32 %79)
%89 = add nsw i32 %79, %81
%90 = add nuw nsw i64 %76, 1
%91 = icmp eq i64 %90, %74
br i1 %91, label %92, label %75
92: ; preds = %75, %70
%93 = phi i32 [ 1, %70 ], [ %89, %75 ]
%94 = trunc i32 %18 to i8
%95 = add i8 %94, 80
%96 = add nsw i32 %93, 1
%97 = sext i32 %93 to i64
%98 = getelementptr inbounds i8, i8* %65, i64 %97
store i8 %95, i8* %98
%99 = add nsw i32 %93, 2
%100 = sext i32 %96 to i64
%101 = getelementptr inbounds i8, i8* %65, i64 %100
store i8 -82, i8* %101
%102 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%103 = call i32 @displayBinary(i8* %65, i32 %99)
%104 = call i32 @free(i8* %65)
br label %105
105: ; preds = %92, %67, %50, %36, %26, %8
%106 = phi i32 [ 0, %8 ], [ 0, %26 ], [ 0, %36 ], [ 0, %50 ], [ 0, %67 ], [ 1, %92 ]
ret i32 %106
}