#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*/ _read_int(int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ _read_word(int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *, char *,
                          char *, char *);
void *malloc(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int boxen_read(char *name, unsigned char **d, int *dx, int *dy, int **size,
               int *type, int *number_mipmaps) {
  char tmp[8];
  FILE *f;
  int i, n, p;
  if (name == NULL || d == NULL || dx == NULL || dy == NULL || size == NULL ||
      type == NULL)
    return 0;
  f = fopen(name, "rb");
  if (f == NULL) {
    fprintf(stderr, "BOXEN_READ: Could not open file \"%s\" for reading.\n",
            name);
    return 0;
  }
  fscanf(f, "%c%c%c%c%c", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4]);
  tmp[5] = 0;
  if (strcmp(tmp, "BOXEM") != 0) {
    fprintf(stderr, "BOXEN_READ: File \"%s\" is not a S3TC-BOXEN file.\n",
            name);
    fclose(f);
    return 0;
  }
  _read_int(f, type);
  _read_word(f, dx);
  _read_word(f, dy);
  _read_int(f, number_mipmaps);
  *size = malloc(sizeof(int) * (*number_mipmaps));
  if (*size == NULL) {
    fprintf(stderr, "BOXEN_READ: Out of memory error.\n");
    fclose(f);
    return 0;
  }
  for (p = 0, i = 0; i < *number_mipmaps; i++) {
    _read_int(f, &n);
    (*size)[i] = n;
    p += n;
  }
  *d = malloc(p);
  if (*d == NULL) {
    fprintf(stderr, "BOXEN_READ: Out of memory error.\n");
    fclose(f);
    return 0;
  }
  fread(*d, 1, p, f);
  fclose(f);
  return 1;
}


x86 assembly (clang, -O0):
<boxen_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11f6 <boxen_read+0x66>
cmpq   $0x0,-0x18(%rbp)
je     11f6 <boxen_read+0x66>
cmpq   $0x0,-0x20(%rbp)
je     11f6 <boxen_read+0x66>
cmpq   $0x0,-0x28(%rbp)
je     11f6 <boxen_read+0x66>
cmpq   $0x0,-0x30(%rbp)
je     11f6 <boxen_read+0x66>
cmpq   $0x0,-0x38(%rbp)
jne    1202 <boxen_read+0x72>
movl   $0x0,-0x4(%rbp)
jmp    141e <boxen_read+0x28e>
mov    -0x10(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1248 <boxen_read+0xb8>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    141e <boxen_read+0x28e>
mov    -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x40(%rbp),%rcx
add    $0x1,%rcx
lea    -0x40(%rbp),%r8
add    $0x2,%r8
lea    -0x40(%rbp),%r9
add    $0x3,%r9
lea    -0x40(%rbp),%rax
add    $0x4,%rax
lea    0xdbf(%rip),%rsi
mov    %rax,(%rsp)
call   1050 <fscanf@plt>
movb   $0x0,-0x3b(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12ce <boxen_read+0x13e>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xd95(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    141e <boxen_read+0x28e>
mov    -0x48(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1080 <_read_int@plt>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <_read_word@plt>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <_read_word@plt>
mov    -0x48(%rbp),%rdi
mov    0x10(%rbp),%rsi
call   1080 <_read_int@plt>
mov    0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1358 <boxen_read+0x1c8>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
lea    0xd3c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    141e <boxen_read+0x28e>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    13aa <boxen_read+0x21a>
mov    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1080 <_read_int@plt>
mov    -0x50(%rbp),%edx
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movslq -0x4c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%eax
add    -0x54(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1366 <boxen_read+0x1d6>
mov    -0x54(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    13f6 <boxen_read+0x266>
mov    0x2c0f(%rip),%rax
mov    (%rax),%edi
lea    0xc9e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    141e <boxen_read+0x28e>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x54(%rbp),%edx
mov    -0x48(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boxen_read>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %r12d,%r12d
test   %rdi,%rdi
je     136a <boxen_read+0x1da>
test   %rsi,%rsi
je     136a <boxen_read+0x1da>
mov    %rdx,%r14
test   %rdx,%rdx
je     136a <boxen_read+0x1da>
mov    %rcx,%rbx
test   %rcx,%rcx
je     136a <boxen_read+0x1da>
mov    %r8,%r15
test   %r8,%r8
je     136a <boxen_read+0x1da>
test   %r9,%r9
je     136a <boxen_read+0x1da>
mov    %rdi,%rbp
mov    %r9,0x20(%rsp)
mov    %rsi,0x18(%rsp)
lea    0xe0c(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     126b <boxen_read+0xdb>
mov    %rax,%r13
lea    0x11(%rsp),%rcx
lea    0x12(%rsp),%r8
lea    0x13(%rsp),%r9
lea    0x14(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe16(%rip),%rsi
lea    0x10(%rsp),%r12
mov    %r13,%rdi
mov    %r12,%rdx
call   1050 <fscanf@plt>
movb   $0x0,0x15(%rsp)
lea    0xe05(%rip),%rsi
mov    %r12,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     128d <boxen_read+0xfd>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
lea    0xdee(%rip),%rsi
xor    %r12d,%r12d
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1362 <boxen_read+0x1d2>
mov    0x2d6e(%rip),%rax
mov    (%rax),%edi
lea    0xd88(%rip),%rsi
xor    %r12d,%r12d
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    136a <boxen_read+0x1da>
mov    0x60(%rsp),%r12
mov    %r13,%rdi
mov    0x20(%rsp),%rsi
call   1080 <_read_int@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   10b0 <_read_word@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10b0 <_read_word@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1080 <_read_int@plt>
mov    (%r12),%ebx
lea    0x0(,%rbx,4),%edi
call   1090 <malloc@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     1348 <boxen_read+0x1b8>
test   %ebx,%ebx
jle    1318 <boxen_read+0x188>
xor    %ebx,%ebx
lea    0xc(%rsp),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %r14,%rsi
call   1080 <_read_int@plt>
mov    0xc(%rsp),%eax
mov    (%r15),%rcx
mov    %eax,(%rcx,%rbx,4)
add    0xc(%rsp),%ebp
add    $0x1,%rbx
movslq (%r12),%rax
cmp    %rax,%rbx
jl     12f0 <boxen_read+0x160>
jmp    131a <boxen_read+0x18a>
xor    %ebp,%ebp
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    0x18(%rsp),%rcx
mov    %rax,(%rcx)
test   %rax,%rax
je     1348 <boxen_read+0x1b8>
mov    $0x1,%r12d
mov    %rax,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %r13,%rcx
call   1030 <fread@plt>
jmp    1362 <boxen_read+0x1d2>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
lea    0xd20(%rip),%rsi
xor    %r12d,%r12d
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %r12d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [51 x i8] c"BOXEN_READ: Could not open file \22%s\22 for reading.\0A\00"
@.str.2 = [11 x i8] c"%c%c%c%c%c\00"
@.str.3 = [6 x i8] c"BOXEM\00"
@.str.4 = [49 x i8] c"BOXEN_READ: File \22%s\22 is not a S3TC-BOXEN file.\0A\00"
@.str.5 = [34 x i8] c"BOXEN_READ: Out of memory error.\0A\00"
define i32 @boxen_read(i8* %0, i8** writeonly %1, i32* %2, i32* %3, i32** %4, i32* %5, i32* %6) {
%8 = alloca [8 x i8]
%9 = alloca i32
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%11 = bitcast i32* %9 to i8*
%12 = icmp eq i8* %0, null
%13 = icmp eq i8** %1, null
%14 = or i1 %12, %13
%15 = icmp eq i32* %2, null
%16 = or i1 %14, %15
%17 = icmp eq i32* %3, null
%18 = or i1 %16, %17
%19 = icmp eq i32** %4, null
%20 = or i1 %18, %19
%21 = icmp eq i32* %5, null
%22 = or i1 %20, %21
br i1 %22, label %82, label %23
23: ; preds = %7
%24 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %82
29: ; preds = %23
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 1
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 2
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 3
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 4
%34 = call i32 @fscanf(i32* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %10, i8* %30, i8* %31, i8* %32, i8* %33)
%35 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 5
store i8 0, i8* %35
%36 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %29
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%41 = call i32 @fclose(i32* %24)
br label %82
42: ; preds = %29
%43 = call i32 @_read_int(i32* %24, i32* %5)
%44 = call i32 @_read_word(i32* %24, i32* %2)
%45 = call i32 @_read_word(i32* %24, i32* %3)
%46 = call i32 @_read_int(i32* %24, i32* %6)
%47 = load i32, i32* %6
%48 = shl i32 %47, 2
%49 = call i8* @malloc(i32 %48)
%50 = bitcast i32** %4 to i8**
store i8* %49, i8** %50
%51 = icmp eq i8* %49, null
br i1 %51, label %54, label %52
52: ; preds = %42
%53 = icmp sgt i32 %47, 0
br i1 %53, label %58, label %71
54: ; preds = %42
%55 = load i32, i32* @stderr
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @fclose(i32* %24)
br label %82
58: ; preds = %52, %58
%59 = phi i64 [ %67, %58 ], [ 0, %52 ]
%60 = phi i32 [ %66, %58 ], [ 0, %52 ]
%61 = call i32 @_read_int(i32* %24, i32* %9)
%62 = load i32, i32* %9
%63 = load i32*, i32** %4
%64 = getelementptr inbounds i32, i32* %63, i64 %59
store i32 %62, i32* %64
%65 = load i32, i32* %9
%66 = add nsw i32 %65, %60
%67 = add nuw nsw i64 %59, 1
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = icmp slt i64 %67, %69
br i1 %70, label %58, label %71
71: ; preds = %58, %52
%72 = phi i32 [ 0, %52 ], [ %66, %58 ]
%73 = call i8* @malloc(i32 %72)
store i8* %73, i8** %1
%74 = icmp eq i8* %73, null
br i1 %74, label %75, label %79
75: ; preds = %71
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%78 = call i32 @fclose(i32* %24)
br label %82
79: ; preds = %71
%80 = call i32 @fread(i8* %73, i32 1, i32 %72, i32* %24)
%81 = call i32 @fclose(i32* %24)
br label %82
82: ; preds = %7, %79, %75, %54, %38, %26
%83 = phi i32 [ 0, %26 ], [ 0, %38 ], [ 0, %54 ], [ 0, %75 ], [ 1, %79 ], [ 0, %7 ]
ret i32 %83
}