#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 */
struct SymTab {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ *stderr;
scalar_t__ symtab_lookup(struct SymTab **, char *, int /*<<< orphan*/ *, int *);
int asmout_make_mif(struct SymTab **curSyms, char *out, char *data) {
  FILE *handle;
  int x, t, datasize, mifwords, mifbytes;
  ;
  int bytewidth, mifwidth = 8;
  if (symtab_lookup(curSyms, "$filesize", NULL, &datasize) != 0) {
    fprintf(stderr, "ERROR - Unknown file size\n");
    return -1;
  }
  if (symtab_lookup(curSyms, "$mifwords", NULL, &mifwords) != 0) {
    fprintf(stderr, "ERROR - Unknown MIF output size\n");
    return -1;
  }
  if (symtab_lookup(curSyms, "$mifwidth", NULL, &mifwidth) == 0) {
    if ((mifwidth == 0) && ((mifwidth % 8) != 0)) {
      fprintf(stderr, "ERROR - Illegal MIF width size "
                      "(must be multiple of 8)\n");
      return -1;
    }
  }
  bytewidth = mifwidth / 8;
  mifbytes = mifwords * bytewidth;
  if (datasize > mifbytes) {
    fprintf(stderr, "ERROR - Assembled file will not fit within "
                    "mif filesize\n");
    return -1;
  }
  if ((handle = fopen(out, "w")) == NULL) {
    perror("ERROR - Could not open output file");
    return -1;
  }
  fprintf(handle,
          "-- caspr\n\n"
          "WIDTH=%d;\n"
          "DEPTH=%d;\n\n"
          "ADDRESS_RADIX=HEX;\n"
          "DATA_RADIX=HEX;\n\n"
          "CONTENT BEGIN\n",
          mifwidth, mifwords);
  for (x = 0; x < mifbytes; x += bytewidth) {
    fprintf(handle, "\t%x  :   ", x / bytewidth);
    for (t = 0; t < bytewidth; t++) {
      if ((x + t) < datasize) {
        fprintf(handle, "%02X", data[x + t] & 0xff);
      } else {
        fprintf(handle, "00");
      }
    }
    fprintf(handle, ";\n");
  }
  fprintf(handle, "END;\n");
  fclose(handle);
  return 0;
}


x86 assembly (clang, -O0):
<asmout_make_mif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x8,-0x44(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x34(%rbp),%rcx
call   1030 <symtab_lookup@plt>
cmp    $0x0,%rax
je     11b1 <asmout_make_mif+0x61>
mov    0x2e4c(%rip),%rax
mov    (%rax),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <asmout_make_mif+0x28b>
mov    -0x10(%rbp),%rdi
lea    0xe69(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x38(%rbp),%rcx
call   1030 <symtab_lookup@plt>
cmp    $0x0,%rax
je     11f7 <asmout_make_mif+0xa7>
mov    0x2e06(%rip),%rax
mov    (%rax),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <asmout_make_mif+0x28b>
mov    -0x10(%rbp),%rdi
lea    0xe4e(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x44(%rbp),%rcx
call   1030 <symtab_lookup@plt>
cmp    $0x0,%rax
jne    1260 <asmout_make_mif+0x110>
cmpl   $0x0,-0x44(%rbp)
jne    125b <asmout_make_mif+0x10b>
mov    -0x44(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     125b <asmout_make_mif+0x10b>
mov    0x2da2(%rip),%rax
mov    (%rax),%rdi
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <asmout_make_mif+0x28b>
jmp    1260 <asmout_make_mif+0x110>
mov    -0x44(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%eax
imul   -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    12a8 <asmout_make_mif+0x158>
mov    0x2d55(%rip),%rax
mov    (%rax),%rdi
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <asmout_make_mif+0x28b>
mov    -0x18(%rbp),%rdi
lea    0xe18(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    12de <asmout_make_mif+0x18e>
lea    0xe00(%rip),%rdi
call   1070 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13db <asmout_make_mif+0x28b>
mov    -0x28(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x38(%rbp),%ecx
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    13b9 <asmout_make_mif+0x269>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x40(%rbp)
mov    %eax,%edx
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1399 <asmout_make_mif+0x249>
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1374 <asmout_make_mif+0x224>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
and    $0xff,%edx
lea    0xde4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1386 <asmout_make_mif+0x236>
mov    -0x28(%rbp),%rdi
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    138b <asmout_make_mif+0x23b>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    132b <asmout_make_mif+0x1db>
mov    -0x28(%rbp),%rdi
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x40(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    12fd <asmout_make_mif+0x1ad>
mov    -0x28(%rbp),%rdi
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asmout_make_mif>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%rbp
movl   $0x8,(%rsp)
lea    0xe7b(%rip),%rsi
lea    0xc(%rsp),%rcx
xor    %edx,%edx
call   1030 <symtab_lookup@plt>
test   %rax,%rax
je     11b1 <asmout_make_mif+0x51>
mov    0x2e43(%rip),%rax
mov    (%rax),%rcx
lea    0xe63(%rip),%rdi
mov    $0x1a,%esi
jmp    1235 <asmout_make_mif+0xd5>
lea    0xe6d(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    %rbp,%rdi
xor    %edx,%edx
call   1030 <symtab_lookup@plt>
test   %rax,%rax
je     11e4 <asmout_make_mif+0x84>
mov    0x2e0d(%rip),%rax
mov    (%rax),%rcx
lea    0xe52(%rip),%rdi
mov    $0x20,%esi
jmp    1235 <asmout_make_mif+0xd5>
lea    0xe65(%rip),%rsi
mov    %rsp,%rcx
mov    %rbp,%rdi
xor    %edx,%edx
call   1030 <symtab_lookup@plt>
mov    (%rsp),%eax
lea    0x7(%rax),%ecx
test   %eax,%eax
mov    %rax,0x20(%rsp)
cmovns %eax,%ecx
sar    $0x3,%ecx
mov    0x8(%rsp),%r14d
mov    %ecx,0x4(%rsp)
imul   %ecx,%r14d
cmp    %r14d,0xc(%rsp)
jle    1253 <asmout_make_mif+0xf3>
mov    0x2dba(%rip),%rax
mov    (%rax),%rcx
lea    0xe2a(%rip),%rdi
mov    $0x38,%esi
mov    $0x1,%edx
call   1080 <fwrite@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe39(%rip),%rsi
mov    %r15,%rdi
call   1060 <fopen@plt>
test   %rax,%rax
je     138c <asmout_make_mif+0x22c>
mov    %rax,%rbp
mov    (%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xe3c(%rip),%rsi
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <fprintf@plt>
test   %r14d,%r14d
jle    1364 <asmout_make_mif+0x204>
mov    0x4(%rsp),%eax
movslq %eax,%rcx
mov    %rcx,0x18(%rsp)
mov    %r14d,%ecx
mov    %rcx,0x10(%rsp)
mov    %eax,%r14d
lea    0xe6c(%rip),%r13
xor    %r15d,%r15d
jmp    12eb <asmout_make_mif+0x18b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe4e(%rip),%rdi
mov    %rbp,%rcx
call   1080 <fwrite@plt>
mov    0x18(%rsp),%rax
add    %rax,%r15
add    %rax,%rbx
cmp    0x10(%rsp),%r15
jge    1364 <asmout_make_mif+0x204>
mov    %r15d,%eax
cltd
idivl  0x4(%rsp)
mov    %rbp,%rdi
lea    0xe0d(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
cmpl   $0x8,0x20(%rsp)
jl     12c0 <asmout_make_mif+0x160>
xor    %r12d,%r12d
jmp    133e <asmout_make_mif+0x1de>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbp,%rcx
call   1080 <fwrite@plt>
add    $0x1,%r12
cmp    %r12,%r14
je     12c0 <asmout_make_mif+0x160>
lea    (%r15,%r12,1),%rax
movslq 0xc(%rsp),%rcx
cmp    %rcx,%rax
jge    1320 <asmout_make_mif+0x1c0>
movzbl (%rbx,%r12,1),%edx
mov    %rbp,%rdi
lea    0xdb9(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1335 <asmout_make_mif+0x1d5>
lea    0xdb1(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1080 <fwrite@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1244 <asmout_make_mif+0xe4>
lea    0xd02(%rip),%rdi
call   1070 <perror@plt>
jmp    123f <asmout_make_mif+0xdf>

LLVM IR (-O0):
%struct.SymTab = type { i32 }
@.str = [10 x i8] c"$filesize\00"
@stderr = global i32* null
@.str.1 = [27 x i8] c"ERROR - Unknown file size\0A\00"
@.str.2 = [10 x i8] c"$mifwords\00"
@.str.3 = [33 x i8] c"ERROR - Unknown MIF output size\0A\00"
@.str.4 = [10 x i8] c"$mifwidth\00"
@.str.5 = [56 x i8] c"ERROR - Illegal MIF width size (must be multiple of 8)\0A\00"
@.str.6 = [57 x i8] c"ERROR - Assembled file will not fit within mif filesize\0A\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [35 x i8] c"ERROR - Could not open output file\00"
@.str.9 = [82 x i8] c"-- caspr\0A\0AWIDTH=%d;\0ADEPTH=%d;\0A\0AADDRESS_RADIX=HEX;\0ADATA_RADIX=HEX;\0A\0ACONTENT BEGIN\0A\00"
@.str.10 = [10 x i8] c"\09%x : \00"
@.str.11 = [5 x i8] c"%02X\00"
@.str.12 = [3 x i8] c"00\00"
@.str.13 = [3 x i8] c";\0A\00"
@.str.14 = [6 x i8] c"END;\0A\00"
define i32 @asmout_make_mif(%struct.SymTab** %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.SymTab**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store %struct.SymTab** %0, %struct.SymTab*** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 8, i32* %15
%16 = load %struct.SymTab**, %struct.SymTab*** %5
%17 = call i64 @symtab_lookup(%struct.SymTab** %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null, i32* %11)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %3
%20 = load i32*, i32** @stderr
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %4
br label %118
22: ; preds = %3
%23 = load %struct.SymTab**, %struct.SymTab*** %5
%24 = call i64 @symtab_lookup(%struct.SymTab** %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* null, i32* %12)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32*, i32** @stderr
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %4
br label %118
29: ; preds = %22
%30 = load %struct.SymTab**, %struct.SymTab*** %5
%31 = call i64 @symtab_lookup(%struct.SymTab** %30, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* null, i32* %15)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %29
%34 = load i32, i32* %15
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %15
%38 = srem i32 %37, 8
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i32*, i32** @stderr
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %4
br label %118
43: ; preds = %36, %33
br label %44
44: ; preds = %43, %29
%45 = load i32, i32* %15
%46 = sdiv i32 %45, 8
store i32 %46, i32* %14
%47 = load i32, i32* %12
%48 = load i32, i32* %14
%49 = mul nsw i32 %47, %48
store i32 %49, i32* %13
%50 = load i32, i32* %11
%51 = load i32, i32* %13
%52 = icmp sgt i32 %50, %51
br i1 %52, label %53, label %56
53: ; preds = %44
%54 = load i32*, i32** @stderr
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %4
br label %118
56: ; preds = %44
%57 = load i8*, i8** %6
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %58, i32** %8
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
store i32 -1, i32* %4
br label %118
62: ; preds = %56
%63 = load i32*, i32** %8
%64 = load i32, i32* %15
%65 = load i32, i32* %12
%66 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.9, i64 0, i64 0), i32 %64, i32 %65)
store i32 0, i32* %9
br label %67
67: ; preds = %109, %62
%68 = load i32, i32* %9
%69 = load i32, i32* %13
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %113
71: ; preds = %67
%72 = load i32*, i32** %8
%73 = load i32, i32* %9
%74 = load i32, i32* %14
%75 = sdiv i32 %73, %74
%76 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %75)
store i32 0, i32* %10
br label %77
77: ; preds = %103, %71
%78 = load i32, i32* %10
%79 = load i32, i32* %14
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %106
81: ; preds = %77
%82 = load i32, i32* %9
%83 = load i32, i32* %10
%84 = add nsw i32 %82, %83
%85 = load i32, i32* %11
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %99
87: ; preds = %81
%88 = load i32*, i32** %8
%89 = load i8*, i8** %7
%90 = load i32, i32* %9
%91 = load i32, i32* %10
%92 = add nsw i32 %90, %91
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %89, i64 %93
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = and i32 %96, 255
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 %97)
br label %102
99: ; preds = %81
%100 = load i32*, i32** %8
%101 = call i32 (i32*, i8*, ...) @fprintf(i32* %100, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %102
102: ; preds = %99, %87
br label %103
103: ; preds = %102
%104 = load i32, i32* %10
%105 = add nsw i32 %104, 1
store i32 %105, i32* %10
br label %77
106: ; preds = %77
%107 = load i32*, i32** %8
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
br label %109
109: ; preds = %106
%110 = load i32, i32* %14
%111 = load i32, i32* %9
%112 = add nsw i32 %111, %110
store i32 %112, i32* %9
br label %67
113: ; preds = %67
%114 = load i32*, i32** %8
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %114, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%116 = load i32*, i32** %8
%117 = call i32 @fclose(i32* %116)
store i32 0, i32* %4
br label %118
118: ; preds = %113, %60, %53, %40, %26, %19
%119 = load i32, i32* %4
ret i32 %119
}

LLVM IR (-O2):
%struct.SymTab = type { i32 }
@.str = [10 x i8] c"$filesize\00"
@stderr = global i32* null
@.str.1 = [27 x i8] c"ERROR - Unknown file size\0A\00"
@.str.2 = [10 x i8] c"$mifwords\00"
@.str.3 = [33 x i8] c"ERROR - Unknown MIF output size\0A\00"
@.str.4 = [10 x i8] c"$mifwidth\00"
@.str.6 = [57 x i8] c"ERROR - Assembled file will not fit within mif filesize\0A\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [35 x i8] c"ERROR - Could not open output file\00"
@.str.9 = [82 x i8] c"-- caspr\0A\0AWIDTH=%d;\0ADEPTH=%d;\0A\0AADDRESS_RADIX=HEX;\0ADATA_RADIX=HEX;\0A\0ACONTENT BEGIN\0A\00"
@.str.10 = [10 x i8] c"\09%x : \00"
@.str.11 = [5 x i8] c"%02X\00"
@.str.12 = [3 x i8] c"00\00"
@.str.13 = [3 x i8] c";\0A\00"
@.str.14 = [6 x i8] c"END;\0A\00"
define i32 @asmout_make_mif(%struct.SymTab** %0, i8* nocapture %1, i8* nocapture %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = bitcast i32* %6 to i8*
store i32 8, i32* %6
%10 = call i64 @symtab_lookup(%struct.SymTab** %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null, i32* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i32*, i32** @stderr
%14 = call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 26, i64 1, i32* %13)
br label %75
15: ; preds = %3
%16 = call i64 @symtab_lookup(%struct.SymTab** %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* null, i32* %5)
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32*, i32** @stderr
%20 = call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i64 32, i64 1, i32* %19)
br label %75
21: ; preds = %15
%22 = call i64 @symtab_lookup(%struct.SymTab** %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* null, i32* %6)
%23 = load i32, i32* %6
%24 = sdiv i32 %23, 8
%25 = load i32, i32* %5
%26 = mul nsw i32 %25, %24
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, %26
br i1 %28, label %29, label %32
29: ; preds = %21
%30 = load i32*, i32** @stderr
%31 = call i64 @fwrite(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i64 56, i64 1, i32* %30)
br label %75
32: ; preds = %21
%33 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %75
37: ; preds = %32
%38 = load i32, i32* %6
%39 = load i32, i32* %5
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.9, i64 0, i64 0), i32 %38, i32 %39)
%41 = icmp sgt i32 %26, 0
br i1 %41, label %42, label %72
42: ; preds = %37
%43 = icmp sgt i32 %23, 7
%44 = sext i32 %24 to i64
%45 = zext i32 %26 to i64
%46 = zext i32 %24 to i64
br label %47
47: ; preds = %42, %68
%48 = phi i64 [ 0, %42 ], [ %70, %68 ]
%49 = trunc i64 %48 to i32
%50 = sdiv i32 %49, %24
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %50)
br i1 %43, label %52, label %68
52: ; preds = %47, %65
%53 = phi i64 [ %66, %65 ], [ 0, %47 ]
%54 = add nsw i64 %53, %48
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = icmp slt i64 %54, %56
br i1 %57, label %58, label %63
58: ; preds = %52
%59 = getelementptr inbounds i8, i8* %2, i64 %54
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 %61)
br label %65
63: ; preds = %52
%64 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i64 2, i64 1, i32* %33)
br label %65
65: ; preds = %58, %63
%66 = add nuw nsw i64 %53, 1
%67 = icmp eq i64 %66, %46
br i1 %67, label %68, label %52
68: ; preds = %65, %47
%69 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i64 2, i64 1, i32* %33)
%70 = add i64 %48, %44
%71 = icmp slt i64 %70, %45
br i1 %71, label %47, label %72
72: ; preds = %68, %37
%73 = call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i64 5, i64 1, i32* %33)
%74 = call i32 @fclose(i32* %33)
br label %75
75: ; preds = %72, %35, %29, %18, %12
%76 = phi i32 [ -1, %12 ], [ -1, %18 ], [ -1, %29 ], [ -1, %35 ], [ 0, %72 ]
ret i32 %76
}