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

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int *allocateOldObjectOfSizeAtPosition(int, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int getImageField(unsigned char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
void loadImageFile(char *filename) {
  FILE *imageFile = fopen(filename, "rb");
  if (imageFile == NULL) {
    error("Could not load image file.");
  }
  fseek(imageFile, 0L, SEEK_END);
  long filesize = ftell(imageFile);
  rewind(imageFile);
  int chunkSize = 4096;
  unsigned char *image =
      (unsigned char *)malloc(sizeof(*image) * (filesize + chunkSize));
  unsigned char *imageReadPosition = image;
  while (fread(imageReadPosition, 1, chunkSize, imageFile) == chunkSize) {
    imageReadPosition += chunkSize;
  }
  fclose(imageFile);
  int *object;
  int objectPointer;
  unsigned char *objectBytes;
  int objectSize;
  int index;
  int byteStart;
  int byteSize;
  unsigned char *imagePosition = image;
  while ((objectSize = getImageField(imagePosition)) != 0) {
    imagePosition += 4;
    int objectPointer = getImageField(imagePosition);
    imagePosition += 4;
    object = allocateOldObjectOfSizeAtPosition(objectSize, objectPointer >> 2);
    *object = objectSize;
    *(object + 1) = objectPointer;
    for (index = 2; index < 10; ++index) {
      *(object + index) = getImageField(imagePosition);
      imagePosition += 4;
    }
    byteStart = *(object + 8);
    byteSize = (*(object + 9) + 4 - 1) / 4 * 4;
    for (index = 10; index < byteStart; ++index) {
      *(object + index) = getImageField(imagePosition);
      imagePosition += 4;
    }
    if (byteSize) {
      objectBytes = (unsigned char *)(object + byteStart);
      memcpy(objectBytes, imagePosition, sizeof(*objectBytes) * byteSize);
      imagePosition += byteSize;
    }
  }
  free(image);
}


x86 assembly (clang, -O0):
<loadImageFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11f7 <loadImageFile+0x37>
lea    0xe11(%rip),%rdi
call   10d0 <error@plt>
mov    -0x10(%rbp),%rdi
mov    0x2de6(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10c0 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <rewind@plt>
movl   $0x1000,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fread@plt>
cmp    -0x1c(%rbp),%eax
jne    1280 <loadImageFile+0xc0>
mov    -0x1c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
jmp    124c <loadImageFile+0x8c>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
call   1090 <getImageField@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
je     13e2 <loadImageFile+0x222>
mov    -0x60(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
call   1090 <getImageField@plt>
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x60(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x64(%rbp),%esi
sar    $0x2,%esi
call   1040 <allocateOldObjectOfSizeAtPosition@plt>
mov    %rax,-0x38(%rbp)
mov    -0x4c(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x64(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,0x4(%rax)
movl   $0x2,-0x50(%rbp)
cmpl   $0xa,-0x50(%rbp)
jge    1330 <loadImageFile+0x170>
mov    -0x60(%rbp),%rdi
call   1090 <getImageField@plt>
mov    %eax,%edx
mov    -0x38(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12f6 <loadImageFile+0x136>
mov    -0x38(%rbp),%rax
mov    0x20(%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x38(%rbp),%rax
mov    0x24(%rax),%eax
add    $0x4,%eax
sub    $0x1,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
mov    %eax,-0x58(%rbp)
movl   $0xa,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1398 <loadImageFile+0x1d8>
mov    -0x60(%rbp),%rdi
call   1090 <getImageField@plt>
mov    %eax,%edx
mov    -0x38(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    135c <loadImageFile+0x19c>
cmpl   $0x0,-0x58(%rbp)
je     13dd <loadImageFile+0x21d>
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x60(%rbp),%rsi
movslq -0x58(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
call   10a0 <memcpy@plt>
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
jmp    1291 <loadImageFile+0xd1>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadImageFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe2b(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11ee <loadImageFile+0x2e>
lea    0xe1a(%rip),%rdi
call   10d0 <error@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    %rbx,%rdi
call   1080 <ftell@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1070 <rewind@plt>
add    $0x1000,%ebp
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
add    $0x1000,%rbp
cmp    $0x1000,%eax
je     1230 <loadImageFile+0x70>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %r14,0x8(%rsp)
mov    %r14,%rdi
call   1090 <getImageField@plt>
test   %eax,%eax
je     13ac <loadImageFile+0x1ec>
mov    %eax,%ebp
mov    0x8(%rsp),%r15
jmp    1292 <loadImageFile+0xd2>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1090 <getImageField@plt>
mov    %eax,%ebp
test   %eax,%eax
je     13ac <loadImageFile+0x1ec>
lea    0x4(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,%r12d
lea    0x8(%r15),%r13
mov    %eax,%esi
sar    $0x2,%esi
mov    %ebp,%edi
call   1040 <allocateOldObjectOfSizeAtPosition@plt>
mov    %rax,%rbx
mov    %ebp,(%rax)
mov    %r12d,0x4(%rax)
mov    %r13,%rdi
call   1090 <getImageField@plt>
mov    %eax,0x8(%rbx)
lea    0xc(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,0xc(%rbx)
lea    0x10(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,0x10(%rbx)
lea    0x14(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,0x14(%rbx)
lea    0x18(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,0x18(%rbx)
lea    0x1c(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,0x1c(%rbx)
lea    0x20(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,0x20(%rbx)
lea    0x24(%r15),%rdi
call   1090 <getImageField@plt>
mov    %eax,%r12d
mov    %eax,0x24(%rbx)
mov    0x20(%rbx),%eax
lea    0x3(%r12),%ebp
add    $0x6,%r12d
test   %ebp,%ebp
cmovs  %r12d,%ebp
cmp    $0xb,%eax
jl     1380 <loadImageFile+0x1c0>
mov    %rax,0x10(%rsp)
lea    0x0(,%rax,4),%r13
mov    $0x28,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r15,%r14,1),%rdi
call   1090 <getImageField@plt>
mov    %eax,(%rbx,%r14,1)
add    $0x4,%r14
cmp    %r14,%r13
jne    1350 <loadImageFile+0x190>
add    %r14,%r15
mov    0x10(%rsp),%rax
cmp    $0x7,%r12d
jb     1280 <loadImageFile+0xc0>
jmp    138e <loadImageFile+0x1ce>
nopw   0x0(%rax,%rax,1)
add    $0x28,%r15
cmp    $0x7,%r12d
jb     1280 <loadImageFile+0xc0>
and    $0xfffffffc,%ebp
cltq
lea    (%rbx,%rax,4),%rdi
movslq %ebp,%rbx
mov    %r15,%rsi
mov    %ebx,%edx
call   10a0 <memcpy@plt>
add    %rbx,%r15
jmp    1280 <loadImageFile+0xc0>
mov    0x8(%rsp),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [27 x i8] c"Could not load image file.\00"
@SEEK_END = global i32 0
define void @loadImageFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
store i8* %0, i8** %2
%17 = load i8*, i8** %2
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %3
%19 = load i32*, i32** %3
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %1
%22 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %1
%24 = load i32*, i32** %3
%25 = load i32, i32* @SEEK_END
%26 = call i32 @fseek(i32* %24, i64 0, i32 %25)
%27 = load i32*, i32** %3
%28 = call i64 @ftell(i32* %27)
store i64 %28, i64* %4
%29 = load i32*, i32** %3
%30 = call i32 @rewind(i32* %29)
store i32 4096, i32* %5
%31 = load i64, i64* %4
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = add nsw i64 %31, %33
%35 = mul i64 1, %34
%36 = trunc i64 %35 to i32
%37 = call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %6
%39 = load i8*, i8** %6
store i8* %39, i8** %7
br label %40
40: ; preds = %47, %23
%41 = load i8*, i8** %7
%42 = load i32, i32* %5
%43 = load i32*, i32** %3
%44 = call i32 @fread(i8* %41, i32 1, i32 %42, i32* %43)
%45 = load i32, i32* %5
%46 = icmp eq i32 %44, %45
br i1 %46, label %47, label %52
47: ; preds = %40
%48 = load i32, i32* %5
%49 = load i8*, i8** %7
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds i8, i8* %49, i64 %50
store i8* %51, i8** %7
br label %40
52: ; preds = %40
%53 = load i32*, i32** %3
%54 = call i32 @fclose(i32* %53)
%55 = load i8*, i8** %6
store i8* %55, i8** %15
br label %56
56: ; preds = %138, %52
%57 = load i8*, i8** %15
%58 = call i32 @getImageField(i8* %57)
store i32 %58, i32* %11
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %139
60: ; preds = %56
%61 = load i8*, i8** %15
%62 = getelementptr inbounds i8, i8* %61, i64 4
store i8* %62, i8** %15
%63 = load i8*, i8** %15
%64 = call i32 @getImageField(i8* %63)
store i32 %64, i32* %16
%65 = load i8*, i8** %15
%66 = getelementptr inbounds i8, i8* %65, i64 4
store i8* %66, i8** %15
%67 = load i32, i32* %11
%68 = load i32, i32* %16
%69 = ashr i32 %68, 2
%70 = call i32* @allocateOldObjectOfSizeAtPosition(i32 %67, i32 %69)
store i32* %70, i32** %8
%71 = load i32, i32* %11
%72 = load i32*, i32** %8
store i32 %71, i32* %72
%73 = load i32, i32* %16
%74 = load i32*, i32** %8
%75 = getelementptr inbounds i32, i32* %74, i64 1
store i32 %73, i32* %75
store i32 2, i32* %12
br label %76
76: ; preds = %88, %60
%77 = load i32, i32* %12
%78 = icmp slt i32 %77, 10
br i1 %78, label %79, label %91
79: ; preds = %76
%80 = load i8*, i8** %15
%81 = call i32 @getImageField(i8* %80)
%82 = load i32*, i32** %8
%83 = load i32, i32* %12
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i32, i32* %82, i64 %84
store i32 %81, i32* %85
%86 = load i8*, i8** %15
%87 = getelementptr inbounds i8, i8* %86, i64 4
store i8* %87, i8** %15
br label %88
88: ; preds = %79
%89 = load i32, i32* %12
%90 = add nsw i32 %89, 1
store i32 %90, i32* %12
br label %76
91: ; preds = %76
%92 = load i32*, i32** %8
%93 = getelementptr inbounds i32, i32* %92, i64 8
%94 = load i32, i32* %93
store i32 %94, i32* %13
%95 = load i32*, i32** %8
%96 = getelementptr inbounds i32, i32* %95, i64 9
%97 = load i32, i32* %96
%98 = add nsw i32 %97, 4
%99 = sub nsw i32 %98, 1
%100 = sdiv i32 %99, 4
%101 = mul nsw i32 %100, 4
store i32 %101, i32* %14
store i32 10, i32* %12
br label %102
102: ; preds = %115, %91
%103 = load i32, i32* %12
%104 = load i32, i32* %13
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %118
106: ; preds = %102
%107 = load i8*, i8** %15
%108 = call i32 @getImageField(i8* %107)
%109 = load i32*, i32** %8
%110 = load i32, i32* %12
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32, i32* %109, i64 %111
store i32 %108, i32* %112
%113 = load i8*, i8** %15
%114 = getelementptr inbounds i8, i8* %113, i64 4
store i8* %114, i8** %15
br label %115
115: ; preds = %106
%116 = load i32, i32* %12
%117 = add nsw i32 %116, 1
store i32 %117, i32* %12
br label %102
118: ; preds = %102
%119 = load i32, i32* %14
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %138
121: ; preds = %118
%122 = load i32*, i32** %8
%123 = load i32, i32* %13
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %122, i64 %124
%126 = bitcast i32* %125 to i8*
store i8* %126, i8** %10
%127 = load i8*, i8** %10
%128 = load i8*, i8** %15
%129 = load i32, i32* %14
%130 = sext i32 %129 to i64
%131 = mul i64 1, %130
%132 = trunc i64 %131 to i32
%133 = call i32 @memcpy(i8* %127, i8* %128, i32 %132)
%134 = load i32, i32* %14
%135 = load i8*, i8** %15
%136 = sext i32 %134 to i64
%137 = getelementptr inbounds i8, i8* %135, i64 %136
store i8* %137, i8** %15
br label %138
138: ; preds = %121, %118
br label %56
139: ; preds = %56
%140 = load i8*, i8** %6
%141 = call i32 @free(i8* %140)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [27 x i8] c"Could not load image file.\00"
@SEEK_END = global i32 0
define void @loadImageFile(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = load i32, i32* @SEEK_END
%8 = tail call i32 @fseek(i32* %2, i64 0, i32 %7)
%9 = tail call i64 @ftell(i32* %2)
%10 = tail call i32 @rewind(i32* %2)
%11 = trunc i64 %9 to i32
%12 = add i32 %11, 4096
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
br label %15
15: ; preds = %15, %6
%16 = phi i8* [ %14, %6 ], [ %19, %15 ]
%17 = tail call i32 @fread(i8* %16, i32 1, i32 4096, i32* %2)
%18 = icmp eq i32 %17, 4096
%19 = getelementptr inbounds i8, i8* %16, i64 4096
br i1 %18, label %15, label %20
20: ; preds = %15
%21 = tail call i32 @fclose(i32* %2)
%22 = tail call i32 @getImageField(i8* %14)
%23 = icmp eq i32 %22, 0
br i1 %23, label %87, label %24
24: ; preds = %20, %83
%25 = phi i32 [ %85, %83 ], [ %22, %20 ]
%26 = phi i8* [ %84, %83 ], [ %14, %20 ]
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = tail call i32 @getImageField(i8* %27)
%29 = getelementptr inbounds i8, i8* %26, i64 8
%30 = ashr i32 %28, 2
%31 = tail call i32* @allocateOldObjectOfSizeAtPosition(i32 %25, i32 %30)
store i32 %25, i32* %31
%32 = getelementptr inbounds i32, i32* %31, i64 1
store i32 %28, i32* %32
%33 = tail call i32 @getImageField(i8* %29)
%34 = getelementptr inbounds i32, i32* %31, i64 2
store i32 %33, i32* %34
%35 = getelementptr inbounds i8, i8* %26, i64 12
%36 = tail call i32 @getImageField(i8* %35)
%37 = getelementptr inbounds i32, i32* %31, i64 3
store i32 %36, i32* %37
%38 = getelementptr inbounds i8, i8* %26, i64 16
%39 = tail call i32 @getImageField(i8* %38)
%40 = getelementptr inbounds i32, i32* %31, i64 4
store i32 %39, i32* %40
%41 = getelementptr inbounds i8, i8* %26, i64 20
%42 = tail call i32 @getImageField(i8* %41)
%43 = getelementptr inbounds i32, i32* %31, i64 5
store i32 %42, i32* %43
%44 = getelementptr inbounds i8, i8* %26, i64 24
%45 = tail call i32 @getImageField(i8* %44)
%46 = getelementptr inbounds i32, i32* %31, i64 6
store i32 %45, i32* %46
%47 = getelementptr inbounds i8, i8* %26, i64 28
%48 = tail call i32 @getImageField(i8* %47)
%49 = getelementptr inbounds i32, i32* %31, i64 7
store i32 %48, i32* %49
%50 = getelementptr inbounds i8, i8* %26, i64 32
%51 = tail call i32 @getImageField(i8* %50)
%52 = getelementptr inbounds i32, i32* %31, i64 8
store i32 %51, i32* %52
%53 = getelementptr inbounds i8, i8* %26, i64 36
%54 = tail call i32 @getImageField(i8* %53)
%55 = getelementptr inbounds i32, i32* %31, i64 9
store i32 %54, i32* %55
%56 = getelementptr inbounds i8, i8* %26, i64 40
%57 = load i32, i32* %52
%58 = add nsw i32 %54, 3
%59 = sdiv i32 %58, 4
%60 = shl nsw i32 %59, 2
%61 = icmp sgt i32 %57, 10
br i1 %61, label %62, label %72
62: ; preds = %24
%63 = zext i32 %57 to i64
br label %64
64: ; preds = %62, %64
%65 = phi i64 [ 10, %62 ], [ %70, %64 ]
%66 = phi i8* [ %56, %62 ], [ %69, %64 ]
%67 = tail call i32 @getImageField(i8* %66)
%68 = getelementptr inbounds i32, i32* %31, i64 %65
store i32 %67, i32* %68
%69 = getelementptr inbounds i8, i8* %66, i64 4
%70 = add nuw nsw i64 %65, 1
%71 = icmp eq i64 %70, %63
br i1 %71, label %72, label %64
72: ; preds = %64, %24
%73 = phi i8* [ %56, %24 ], [ %69, %64 ]
%74 = add i32 %54, 6
%75 = icmp ult i32 %74, 7
br i1 %75, label %83, label %76
76: ; preds = %72
%77 = sext i32 %57 to i64
%78 = getelementptr inbounds i32, i32* %31, i64 %77
%79 = bitcast i32* %78 to i8*
%80 = sext i32 %60 to i64
%81 = tail call i32 @memcpy(i8* %79, i8* %73, i32 %60)
%82 = getelementptr inbounds i8, i8* %73, i64 %80
br label %83
83: ; preds = %76, %72
%84 = phi i8* [ %82, %76 ], [ %73, %72 ]
%85 = tail call i32 @getImageField(i8* %84)
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %24
87: ; preds = %83, %20
%88 = tail call i32 @free(i8* %14)
ret void
}