int main(argc, argv)
int argc;
char *argv[];
{
  char image_name[80], water_name[80];
  int i, j;
  long length, width;
  short factor;
  short **the_image;
  short **out_image;
  if (argc < 4) {
    printf("\n\nNot enough parameters:");
    printf("\n");
    printf("\n   usage: hidet image-file text-file-image factor  ");
    exit(0);
  }
  strcpy(image_name, argv[1]);
  strcpy(water_name, argv[2]);
  factor = atoi(argv[3]);
  if (does_not_exist(image_name)) {
    printf("\nERROR input file %s does not exist", image_name);
    exit(0);
  }
  if (does_not_exist(water_name)) {
    printf("\nERROR output file %s does not exist", water_name);
    exit(0);
  }
  if (are_not_same_size(image_name, water_name)) {
    printf("\nERROR images are not same size");
    exit(0);
  }
  get_image_size(image_name, &length, &width);
  the_image = allocate_image_array(length, width);
  out_image = allocate_image_array(length, width);
  read_image_array(image_name, the_image);
  read_image_array(water_name, out_image);
  for (i = 0; i < length; i++) {
    for (j = 0; j < width; j++) {
      if (out_image[i][j] != 0) {
        the_image[i][j] = the_image[i][j] + factor;
        if (the_image[i][j] > 255)
          the_image[i][j] = 255;
      }
    }
  }
  write_image_array(image_name, the_image);
  free_image_array(the_image, length);
  free_image_array(out_image, length);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1204 <main+0x54>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    $0x0,%al
call   10a0 <atoi@plt>
mov    %ax,-0xca(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   1070 <does_not_exist@plt>
cmp    $0x0,%eax
je     126c <main+0xbc>
lea    -0x60(%rbp),%rsi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x0,%al
call   1070 <does_not_exist@plt>
cmp    $0x0,%eax
je     129f <main+0xef>
lea    -0xb0(%rbp),%rsi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    $0x0,%al
call   1090 <are_not_same_size@plt>
cmp    $0x0,%eax
je     12cf <main+0x11f>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
lea    -0xc8(%rbp),%rdx
mov    $0x0,%al
call   1060 <get_image_size@plt>
mov    -0xc0(%rbp),%rdi
mov    -0xc8(%rbp),%rsi
mov    $0x0,%al
call   10c0 <allocate_image_array@plt>
cltq
mov    %rax,-0xd8(%rbp)
mov    -0xc0(%rbp),%rdi
mov    -0xc8(%rbp),%rsi
mov    $0x0,%al
call   10c0 <allocate_image_array@plt>
cltq
mov    %rax,-0xe0(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0xd8(%rbp),%rsi
mov    $0x0,%al
call   1080 <read_image_array@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
mov    $0x0,%al
call   1080 <read_image_array@plt>
movl   $0x0,-0xb4(%rbp)
movslq -0xb4(%rbp),%rax
cmp    -0xc0(%rbp),%rax
jge    1471 <main+0x2c1>
movl   $0x0,-0xb8(%rbp)
movslq -0xb8(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jge    1458 <main+0x2a8>
mov    -0xe0(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb8(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
je     143f <main+0x28f>
mov    -0xd8(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb8(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
movswl -0xca(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%dx
mov    -0xd8(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb8(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0xd8(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb8(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
cmp    $0xff,%eax
jle    143a <main+0x28a>
mov    -0xd8(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb8(%rbp),%rcx
movw   $0xff,(%rax,%rcx,2)
jmp    143f <main+0x28f>
jmp    1444 <main+0x294>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    1373 <main+0x1c3>
jmp    145d <main+0x2ad>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1355 <main+0x1a5>
lea    -0x60(%rbp),%rdi
mov    -0xd8(%rbp),%rsi
mov    $0x0,%al
call   1050 <write_image_array@plt>
mov    -0xd8(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
mov    $0x0,%al
call   10d0 <free_image_array@plt>
mov    -0xe0(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
mov    $0x0,%al
call   10d0 <free_image_array@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xb8,%rsp
cmp    $0x3,%edi
jle    1353 <main+0x193>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0x60(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    0x10(%rbx),%rsi
lea    0x10(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x18(%rbx),%rdi
xor    %eax,%eax
call   10b0 <atoi@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
xor    %eax,%eax
call   1080 <does_not_exist@plt>
test   %eax,%eax
jne    1374 <main+0x1b4>
lea    0x10(%rsp),%rdi
xor    %eax,%eax
call   1080 <does_not_exist@plt>
test   %eax,%eax
jne    1382 <main+0x1c2>
lea    0x60(%rsp),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10a0 <are_not_same_size@plt>
test   %eax,%eax
jne    139c <main+0x1dc>
lea    0x60(%rsp),%r15
mov    %rsp,%rsi
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <get_image_size@plt>
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   10d0 <allocate_image_array@plt>
movslq %eax,%rbx
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   10d0 <allocate_image_array@plt>
movslq %eax,%rbp
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <read_image_array@plt>
lea    0x10(%rsp),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <read_image_array@plt>
mov    (%rsp),%rsi
test   %rsi,%rsi
jle    1318 <main+0x158>
mov    0x8(%rsp),%rdx
xor    %eax,%eax
mov    $0xff,%ecx
jmp    12cd <main+0x10d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp),%rsi
add    $0x1,%rax
cmp    %rax,%rsi
jle    1318 <main+0x158>
test   %rdx,%rdx
jle    12c4 <main+0x104>
xor    %esi,%esi
jmp    12e9 <main+0x129>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rsi
cmp    %rsi,%rdx
jle    12c0 <main+0x100>
mov    0x0(%rbp,%rax,8),%rdi
cmpw   $0x0,(%rdi,%rsi,2)
je     12e0 <main+0x120>
mov    (%rbx,%rax,8),%rdx
movzwl (%rdx,%rsi,2),%edi
add    %r14w,%di
movswl %di,%edi
cmp    $0xff,%edi
cmovge %ecx,%edi
mov    %di,(%rdx,%rsi,2)
mov    0x8(%rsp),%rdx
jmp    12e0 <main+0x120>
lea    0x60(%rsp),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <write_image_array@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <free_image_array@plt>
mov    (%rsp),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   10e0 <free_image_array@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xca6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xca7(%rip),%rdi
jmp    13a3 <main+0x1e3>
lea    0xcd3(%rip),%rdi
lea    0x60(%rsp),%rsi
jmp    138e <main+0x1ce>
lea    0xce9(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    0xcf4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0A\0ANot enough parameters:\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [53 x i8] c"\0A usage: hidet image-file text-file-image factor \00"
@.str.3 = [36 x i8] c"\0AERROR input file %s does not exist\00"
@.str.4 = [37 x i8] c"\0AERROR output file %s does not exist\00"
@.str.5 = [32 x i8] c"\0AERROR images are not same size\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i16
%13 = alloca i16**
%14 = alloca i16**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
unreachable
21: ; preds = %2
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i8* @strcpy(i8* %22, i8* %25)
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i8* @strcpy(i8* %27, i8* %30)
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %34)
%36 = trunc i32 %35 to i16
store i16 %36, i16* %12
%37 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%38 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %37)
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %21
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %41)
unreachable
43: ; preds = %21
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%45 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %48)
unreachable
50: ; preds = %43
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%53 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @are_not_same_size to i32 (i8*, i8*, ...)*)(i8* %51, i8* %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
unreachable
57: ; preds = %50
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%59 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %58, i64* %10, i64* %11)
%60 = load i64, i64* %10
%61 = load i64, i64* %11
%62 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %60, i64 %61)
%63 = sext i32 %62 to i64
%64 = inttoptr i64 %63 to i16**
store i16** %64, i16*** %13
%65 = load i64, i64* %10
%66 = load i64, i64* %11
%67 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %65, i64 %66)
%68 = sext i32 %67 to i64
%69 = inttoptr i64 %68 to i16**
store i16** %69, i16*** %14
%70 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%71 = load i16**, i16*** %13
%72 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %70, i16** %71)
%73 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%74 = load i16**, i16*** %14
%75 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %73, i16** %74)
store i32 0, i32* %8
br label %76
76: ; preds = %148, %57
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = load i64, i64* %10
%80 = icmp slt i64 %78, %79
br i1 %80, label %81, label %151
81: ; preds = %76
store i32 0, i32* %9
br label %82
82: ; preds = %144, %81
%83 = load i32, i32* %9
%84 = sext i32 %83 to i64
%85 = load i64, i64* %11
%86 = icmp slt i64 %84, %85
br i1 %86, label %87, label %147
87: ; preds = %82
%88 = load i16**, i16*** %14
%89 = load i32, i32* %8
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i16*, i16** %88, i64 %90
%92 = load i16*, i16** %91
%93 = load i32, i32* %9
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i16, i16* %92, i64 %94
%96 = load i16, i16* %95
%97 = sext i16 %96 to i32
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %143
99: ; preds = %87
%100 = load i16**, i16*** %13
%101 = load i32, i32* %8
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i16*, i16** %100, i64 %102
%104 = load i16*, i16** %103
%105 = load i32, i32* %9
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i16, i16* %104, i64 %106
%108 = load i16, i16* %107
%109 = sext i16 %108 to i32
%110 = load i16, i16* %12
%111 = sext i16 %110 to i32
%112 = add nsw i32 %109, %111
%113 = trunc i32 %112 to i16
%114 = load i16**, i16*** %13
%115 = load i32, i32* %8
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i16*, i16** %114, i64 %116
%118 = load i16*, i16** %117
%119 = load i32, i32* %9
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i16, i16* %118, i64 %120
store i16 %113, i16* %121
%122 = load i16**, i16*** %13
%123 = load i32, i32* %8
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i16*, i16** %122, i64 %124
%126 = load i16*, i16** %125
%127 = load i32, i32* %9
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i16, i16* %126, i64 %128
%130 = load i16, i16* %129
%131 = sext i16 %130 to i32
%132 = icmp sgt i32 %131, 255
br i1 %132, label %133, label %142
133: ; preds = %99
%134 = load i16**, i16*** %13
%135 = load i32, i32* %8
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds i16*, i16** %134, i64 %136
%138 = load i16*, i16** %137
%139 = load i32, i32* %9
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i16, i16* %138, i64 %140
store i16 255, i16* %141
br label %142
142: ; preds = %133, %99
br label %143
143: ; preds = %142, %87
br label %144
144: ; preds = %143
%145 = load i32, i32* %9
%146 = add nsw i32 %145, 1
store i32 %146, i32* %9
br label %82
147: ; preds = %82
br label %148
148: ; preds = %147
%149 = load i32, i32* %8
%150 = add nsw i32 %149, 1
store i32 %150, i32* %8
br label %76
151: ; preds = %76
%152 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%153 = load i16**, i16*** %13
%154 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @write_image_array to i32 (i8*, i16**, ...)*)(i8* %152, i16** %153)
%155 = load i16**, i16*** %13
%156 = load i64, i64* %10
%157 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %155, i64 %156)
%158 = load i16**, i16*** %14
%159 = load i64, i64* %10
%160 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %158, i64 %159)
%161 = load i32, i32* %3
ret i32 %161
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0A\0ANot enough parameters:\00"
@.str.2 = [53 x i8] c"\0A usage: hidet image-file text-file-image factor \00"
@.str.3 = [36 x i8] c"\0AERROR input file %s does not exist\00"
@.str.4 = [37 x i8] c"\0AERROR output file %s does not exist\00"
@.str.5 = [32 x i8] c"\0AERROR images are not same size\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca i64
%6 = alloca i64
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%9 = bitcast i64* %5 to i8*
%10 = bitcast i64* %6 to i8*
%11 = icmp slt i32 %0, 4
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = call i8* @strcpy(i8* %7, i8* dereferenceable(1) %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = call i8* @strcpy(i8* %8, i8* dereferenceable(1) %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %24)
%26 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %7)
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %16
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %7)
unreachable
30: ; preds = %16
%31 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %8)
%32 = icmp eq i32 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %8)
unreachable
35: ; preds = %30
%36 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @are_not_same_size to i32 (i8*, i8*, ...)*)(i8* %7, i8* %8)
%37 = icmp eq i32 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
unreachable
40: ; preds = %35
%41 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %7, i64* %5, i64* %6)
%42 = load i64, i64* %5
%43 = load i64, i64* %6
%44 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %42, i64 %43)
%45 = sext i32 %44 to i64
%46 = inttoptr i64 %45 to i16**
%47 = load i64, i64* %5
%48 = load i64, i64* %6
%49 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %47, i64 %48)
%50 = sext i32 %49 to i64
%51 = inttoptr i64 %50 to i16**
%52 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %7, i16** %46)
%53 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %8, i16** %51)
%54 = load i64, i64* %5
%55 = icmp sgt i64 %54, 0
br i1 %55, label %56, label %95
56: ; preds = %40
%57 = trunc i32 %25 to i16
%58 = load i64, i64* %6
br label %59
59: ; preds = %56, %89
%60 = phi i64 [ %54, %56 ], [ %90, %89 ]
%61 = phi i64 [ %58, %56 ], [ %91, %89 ]
%62 = phi i64 [ %58, %56 ], [ %92, %89 ]
%63 = phi i64 [ 0, %56 ], [ %93, %89 ]
%64 = icmp sgt i64 %62, 0
br i1 %64, label %65, label %89
65: ; preds = %59
%66 = getelementptr inbounds i16*, i16** %51, i64 %63
%67 = getelementptr inbounds i16*, i16** %46, i64 %63
br label %68
68: ; preds = %65, %83
%69 = phi i64 [ %61, %65 ], [ %84, %83 ]
%70 = phi i64 [ 0, %65 ], [ %85, %83 ]
%71 = load i16*, i16** %66
%72 = getelementptr inbounds i16, i16* %71, i64 %70
%73 = load i16, i16* %72
%74 = icmp eq i16 %73, 0
br i1 %74, label %83, label %75
75: ; preds = %68
%76 = load i16*, i16** %67
%77 = getelementptr inbounds i16, i16* %76, i64 %70
%78 = load i16, i16* %77
%79 = add i16 %78, %57
%80 = icmp slt i16 %79, 255
%81 = select i1 %80, i16 %79, i16 255
store i16 %81, i16* %77
%82 = load i64, i64* %6
br label %83
83: ; preds = %75, %68
%84 = phi i64 [ %82, %75 ], [ %69, %68 ]
%85 = add nuw nsw i64 %70, 1
%86 = icmp sgt i64 %84, %85
br i1 %86, label %68, label %87
87: ; preds = %83
%88 = load i64, i64* %5
br label %89
89: ; preds = %87, %59
%90 = phi i64 [ %88, %87 ], [ %60, %59 ]
%91 = phi i64 [ %84, %87 ], [ %61, %59 ]
%92 = phi i64 [ %84, %87 ], [ %62, %59 ]
%93 = add nuw nsw i64 %63, 1
%94 = icmp sgt i64 %90, %93
br i1 %94, label %59, label %95
95: ; preds = %89, %40
%96 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @write_image_array to i32 (i8*, i16**, ...)*)(i8* %7, i16** %46)
%97 = load i64, i64* %5
%98 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %46, i64 %97)
%99 = load i64, i64* %5
%100 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %51, i64 %99)
ret i32 0
}