#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 */
char *BinString(char, char *, int);
int /*<<< orphan*/ DumpBinString(char *);
int embed(char *, int, char *, char **);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int read_image(char *, char **, int *, int *);
void TestFile(char *fname, char *testStr, char *resultData) {
  char *image_data = NULL;
  char *encoded = NULL;
  int arrsize;
  int width;
  int height;
  int idx;
  char buf[9];
  memset(buf, 0, sizeof(char) * 9);
  printf("--------------------------------------\n");
  printf(" Read image \"%s\"\n", fname);
  arrsize = read_image(fname, &image_data, &width, &height);
  if (arrsize <= 0) {
    printf("Unable to read image.\n");
    return;
  }
  printf("--------------------------------------\n");
  printf("Embed text in image\n");
  DumpBinString(testStr);
  printf("--------------------------------------\n");
  if (embed(image_data, arrsize, testStr, &encoded) == -1) {
    printf("Embed failed.\n");
    if (image_data != NULL) {
      free(image_data);
      image_data = NULL;
    }
    return;
  } else {
    printf("Embed succeeded.\n");
  }
  printf("--------------------------------------\n");
  printf("          image:              encoded:           expected:");
  for (idx = 0; idx < arrsize; idx++) {
    if ((idx % 8) == 0) {
      printf("\n");
    }
    printf("%3d: 0x%02x [%s] --> ", idx, (unsigned char)image_data[idx],
           BinString(image_data[idx], buf, 8));
    printf("0x%02x [%s] == ", (unsigned char)encoded[idx],
           BinString(encoded[idx], buf, 8));
    printf("0x%02x [%s] : %s\n", (unsigned char)resultData[idx],
           BinString(resultData[idx], buf, 8),
           ((unsigned char)encoded[idx] == (unsigned char)resultData[idx]
                ? "true"
                : "false"));
  }
  printf("--------------------------------------\n\n");
  if (image_data != NULL) {
    free(image_data);
    image_data = NULL;
  }
  if (encoded != NULL)
    ;
  {
    free(encoded);
    encoded = NULL;
  }
}


x86 assembly (clang, -O0):
<TestFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x41(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1050 <memset@plt>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
call   1070 <read_image@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jg     11f9 <TestFile+0x89>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1424 <TestFile+0x2b4>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <DumpBinString@plt>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1090 <embed@plt>
cmp    $0xffffffff,%eax
jne    1278 <TestFile+0x108>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1273 <TestFile+0x103>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
jmp    1424 <TestFile+0x2b4>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13d9 <TestFile+0x269>
mov    -0x38(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12d7 <TestFile+0x167>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%al
lea    -0x41(%rbp),%rsi
mov    $0x8,%edx
movsbl %al,%edi
call   1060 <BinString@plt>
mov    -0x54(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    %rax,%rcx
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%al
lea    -0x41(%rbp),%rsi
mov    $0x8,%edx
movsbl %al,%edi
call   1060 <BinString@plt>
mov    -0x4c(%rbp),%esi
mov    %rax,%rdx
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%al
lea    -0x41(%rbp),%rsi
mov    $0x8,%edx
movsbl %al,%edi
call   1060 <BinString@plt>
mov    -0x48(%rbp),%esi
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movzbl (%rax,%rcx,1),%r8d
lea    0xd50(%rip),%rcx
lea    0xd44(%rip),%rax
cmp    %r8d,%edi
cmove  %rax,%rcx
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12a9 <TestFile+0x139>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1403 <TestFile+0x293>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1413 <TestFile+0x2a3>
jmp    1413 <TestFile+0x2a3>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x28(%rbp)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rbp
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x1f(%rsp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <memset@plt>
lea    0xee5(%rip),%rdi
call   1050 <puts@plt>
lea    0xe24(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %rbp,%rdi
call   1090 <read_image@plt>
test   %eax,%eax
jle    137f <TestFile+0x1ef>
mov    %eax,%ebp
lea    0xea9(%rip),%r15
mov    %r15,%rdi
call   1050 <puts@plt>
lea    0xe75(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   10a0 <DumpBinString@plt>
mov    %r15,%rdi
call   1050 <puts@plt>
mov    (%rsp),%rdi
lea    0x8(%rsp),%rcx
mov    %ebp,%esi
mov    %rbx,%rdx
call   10b0 <embed@plt>
cmp    $0xffffffff,%eax
je     138d <TestFile+0x1fd>
lea    0xe51(%rip),%rdi
call   1050 <puts@plt>
lea    0xe56(%rip),%rdi
call   1050 <puts@plt>
lea    0xda7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%r13d
lea    0x1f(%rsp),%r12
xor    %ebp,%ebp
jmp    133d <TestFile+0x1ad>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%rax
movsbl (%rax,%rbp,1),%edi
movzbl %dil,%r15d
mov    %r12,%rsi
mov    $0x8,%edx
call   1080 <BinString@plt>
lea    0xd9d(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%rax
movsbl (%rax,%rbp,1),%edi
movzbl %dil,%ebx
mov    %r12,%rsi
mov    $0x8,%edx
call   1080 <BinString@plt>
lea    0xd83(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
movsbl (%r14,%rbp,1),%edi
movzbl %dil,%ebx
mov    %r12,%rsi
mov    $0x8,%edx
call   1080 <BinString@plt>
mov    0x8(%rsp),%rcx
movzbl (%rcx,%rbp,1),%ecx
cmp    (%r14,%rbp,1),%cl
lea    0xd74(%rip),%rcx
lea    0xd68(%rip),%rdx
cmove  %rdx,%rcx
lea    0xd4b(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     1356 <TestFile+0x1c6>
test   $0x7,%bpl
jne    1290 <TestFile+0x100>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1290 <TestFile+0x100>
lea    0xd7f(%rip),%rdi
call   1050 <puts@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     1378 <TestFile+0x1e8>
call   1030 <free@plt>
movq   $0x0,(%rsp)
mov    0x8(%rsp),%rdi
jmp    13a2 <TestFile+0x212>
lea    0xd8c(%rip),%rdi
call   1050 <puts@plt>
jmp    13a7 <TestFile+0x217>
lea    0xd70(%rip),%rdi
call   1050 <puts@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     13a7 <TestFile+0x217>
call   1030 <free@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"--------------------------------------\0A\00"
@.str.1 = [18 x i8] c" Read image \22%s\22\0A\00"
@.str.2 = [23 x i8] c"Unable to read image.\0A\00"
@.str.3 = [21 x i8] c"Embed text in image\0A\00"
@.str.4 = [15 x i8] c"Embed failed.\0A\00"
@.str.5 = [18 x i8] c"Embed succeeded.\0A\00"
@.str.6 = [59 x i8] c" image: encoded: expected:\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [22 x i8] c"%3d: 0x%02x [%s] --> \00"
@.str.9 = [16 x i8] c"0x%02x [%s] == \00"
@.str.10 = [18 x i8] c"0x%02x [%s] : %s\0A\00"
@.str.11 = [5 x i8] c"true\00"
@.str.12 = [6 x i8] c"false\00"
@.str.13 = [41 x i8] c"--------------------------------------\0A\0A\00"
define void @TestFile(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [9 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
%14 = getelementptr inbounds [9 x i8], [9 x i8]* %13, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i32 0, i32 9)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %4
%20 = call i32 @read_image(i8* %19, i8** %7, i32* %10, i32* %11)
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = icmp sle i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %135
25: ; preds = %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%28 = load i8*, i8** %5
%29 = call i32 @DumpBinString(i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%31 = load i8*, i8** %7
%32 = load i32, i32* %9
%33 = load i8*, i8** %5
%34 = call i32 @embed(i8* %31, i32 %32, i8* %33, i8** %8)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %44
36: ; preds = %25
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%38 = load i8*, i8** %7
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i8*, i8** %7
%42 = call i32 @free(i8* %41)
store i8* null, i8** %7
br label %43
43: ; preds = %40, %36
br label %135
44: ; preds = %25
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %12
br label %49
49: ; preds = %118, %46
%50 = load i32, i32* %12
%51 = load i32, i32* %9
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %121
53: ; preds = %49
%54 = load i32, i32* %12
%55 = srem i32 %54, 8
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %59
59: ; preds = %57, %53
%60 = load i32, i32* %12
%61 = load i8*, i8** %7
%62 = load i32, i32* %12
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %61, i64 %63
%65 = load i8, i8* %64
%66 = zext i8 %65 to i32
%67 = load i8*, i8** %7
%68 = load i32, i32* %12
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %67, i64 %69
%71 = load i8, i8* %70
%72 = getelementptr inbounds [9 x i8], [9 x i8]* %13, i64 0, i64 0
%73 = call i8* @BinString(i8 signext %71, i8* %72, i32 8)
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %60, i32 %66, i8* %73)
%75 = load i8*, i8** %8
%76 = load i32, i32* %12
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = load i8, i8* %78
%80 = zext i8 %79 to i32
%81 = load i8*, i8** %8
%82 = load i32, i32* %12
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = load i8, i8* %84
%86 = getelementptr inbounds [9 x i8], [9 x i8]* %13, i64 0, i64 0
%87 = call i8* @BinString(i8 signext %85, i8* %86, i32 8)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %80, i8* %87)
%89 = load i8*, i8** %6
%90 = load i32, i32* %12
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %89, i64 %91
%93 = load i8, i8* %92
%94 = zext i8 %93 to i32
%95 = load i8*, i8** %6
%96 = load i32, i32* %12
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %95, i64 %97
%99 = load i8, i8* %98
%100 = getelementptr inbounds [9 x i8], [9 x i8]* %13, i64 0, i64 0
%101 = call i8* @BinString(i8 signext %99, i8* %100, i32 8)
%102 = load i8*, i8** %8
%103 = load i32, i32* %12
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = load i8*, i8** %6
%109 = load i32, i32* %12
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %108, i64 %110
%112 = load i8, i8* %111
%113 = zext i8 %112 to i32
%114 = icmp eq i32 %107, %113
%115 = zext i1 %114 to i64
%116 = select i1 %114, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %94, i8* %101, i8* %116)
br label %118
118: ; preds = %59
%119 = load i32, i32* %12
%120 = add nsw i32 %119, 1
store i32 %120, i32* %12
br label %49
121: ; preds = %49
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0))
%123 = load i8*, i8** %7
%124 = icmp ne i8* %123, null
br i1 %124, label %125, label %128
125: ; preds = %121
%126 = load i8*, i8** %7
%127 = call i32 @free(i8* %126)
store i8* null, i8** %7
br label %128
128: ; preds = %125, %121
%129 = load i8*, i8** %8
%130 = icmp ne i8* %129, null
br i1 %130, label %131, label %132
131: ; preds = %128
br label %132
132: ; preds = %131, %128
%133 = load i8*, i8** %8
%134 = call i32 @free(i8* %133)
store i8* null, i8** %8
br label %135
135: ; preds = %132, %43, %23
ret void
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c" Read image \22%s\22\0A\00"
@.str.6 = [59 x i8] c" image: encoded: expected:\00"
@.str.8 = [22 x i8] c"%3d: 0x%02x [%s] --> \00"
@.str.9 = [16 x i8] c"0x%02x [%s] == \00"
@.str.10 = [18 x i8] c"0x%02x [%s] : %s\0A\00"
@.str.11 = [5 x i8] c"true\00"
@.str.12 = [6 x i8] c"false\00"
@str.15 = [20 x i8] c"Embed text in image\00"
@str.17 = [17 x i8] c"Embed succeeded.\00"
@str.18 = [39 x i8] c"--------------------------------------\00"
@str.19 = [40 x i8] c"--------------------------------------\0A\00"
@str.20 = [14 x i8] c"Embed failed.\00"
@str.21 = [22 x i8] c"Unable to read image.\00"
define void @TestFile(i8* %0, i8* %1, i8* nocapture %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [9 x i8]
%9 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%10 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %8, i64 0, i64 0
%14 = call i32 @memset(i8* %13, i32 0, i32 9)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.18, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%17 = call i32 @read_image(i8* %0, i8** %4, i32* %6, i32* %7)
%18 = icmp slt i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %3
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.21, i64 0, i64 0))
br label %82
21: ; preds = %3
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.18, i64 0, i64 0))
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.15, i64 0, i64 0))
%24 = call i32 @DumpBinString(i8* %1)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.18, i64 0, i64 0))
%26 = load i8*, i8** %4
%27 = call i32 @embed(i8* %26, i32 %17, i8* %1, i8** %5)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %35
29: ; preds = %21
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.20, i64 0, i64 0))
%31 = load i8*, i8** %4
%32 = icmp eq i8* %31, null
br i1 %32, label %82, label %33
33: ; preds = %29
%34 = call i32 @free(i8* %31)
br label %82
35: ; preds = %21
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.18, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0))
%39 = zext i32 %17 to i64
br label %40
40: ; preds = %35, %47
%41 = phi i64 [ 0, %35 ], [ %71, %47 ]
%42 = trunc i64 %41 to i32
%43 = and i32 %42, 7
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 @putchar(i32 10)
br label %47
47: ; preds = %45, %40
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i64 %41
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = call i8* @BinString(i8 signext %50, i8* %13, i32 8)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %42, i32 %51, i8* %52)
%54 = load i8*, i8** %5
%55 = getelementptr inbounds i8, i8* %54, i64 %41
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = call i8* @BinString(i8 signext %56, i8* %13, i32 8)
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %57, i8* %58)
%60 = getelementptr inbounds i8, i8* %2, i64 %41
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = call i8* @BinString(i8 signext %61, i8* %13, i32 8)
%64 = load i8*, i8** %5
%65 = getelementptr inbounds i8, i8* %64, i64 %41
%66 = load i8, i8* %65
%67 = load i8, i8* %60
%68 = icmp eq i8 %66, %67
%69 = select i1 %68, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %62, i8* %63, i8* %69)
%71 = add nuw nsw i64 %41, 1
%72 = icmp eq i64 %71, %39
br i1 %72, label %73, label %40
73: ; preds = %47
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.19, i64 0, i64 0))
%75 = load i8*, i8** %4
%76 = icmp eq i8* %75, null
br i1 %76, label %79, label %77
77: ; preds = %73
%78 = call i32 @free(i8* %75)
store i8* null, i8** %4
br label %79
79: ; preds = %77, %73
%80 = load i8*, i8** %5
%81 = call i32 @free(i8* %80)
br label %82
82: ; preds = %29, %33, %79, %19
ret void
}