#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 stat {
  long st_size;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
long fread(unsigned char *, int, long, int /*<<< orphan*/ *);
int /*<<< orphan*/ fstat(int /*<<< orphan*/, struct stat *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  const char *src_name;
  const char *dst_name;
  FILE *fi, *fo;
  struct stat st;
  long length, lenread;
  static unsigned char data[65536];
  int i, j;
  const char *pat;
  if (argc != 4) {
    fprintf(stderr, "Usage: tf2hex input_file output_file suffix\n");
    return 1;
  }
  src_name = argv[1];
  dst_name = argv[2];
  pat = argv[3];
  fi = fopen(src_name, "rb");
  if (fi == NULL) {
    fprintf(stderr, "Unable to open input file.\n");
    return 1;
  }
  fstat(fileno(fi), &st);
  length = st.st_size;
  lenread = fread(data, sizeof(char), length, fi);
  fprintf(stdout, "Read %ld bytes.\n", lenread);
  fclose(fi);
  if (lenread == length) {
    fo = fopen(dst_name, "wt");
    if (fo == NULL) {
      fprintf(stderr, "Unable to open output file.\n");
      return 1;
    }
    fprintf(fo, "static unsigned char romDump%s[] = {\n", pat);
    for (i = 0; i < length; i += 8) {
      for (j = 0; (j < 8) && (i + j < length); j++) {
        fprintf(fo, "0x%02x, ", data[i + j]);
      }
      fprintf(fo, "\n");
    }
    fprintf(fo, "};\nstatic unsigned int romDumpSize%s = %ld;\n", pat, length);
    fclose(fo);
  } else {
    fprintf(stderr, "Was unable to read the entire input file.\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11a4 <main+0x44>
mov    0x2e59(%rip),%rax
mov    (%rax),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <main+0x264>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    120b <main+0xab>
mov    0x2df2(%rip),%rax
mov    (%rax),%rdi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <main+0x264>
mov    -0x28(%rbp),%rdi
call   1060 <fileno@plt>
mov    %eax,%edi
lea    -0x38(%rbp),%rsi
call   1080 <fstat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0x2e2a(%rip),%rdi
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x48(%rbp)
mov    0x2d8d(%rip),%rax
movslq (%rax),%rdi
mov    -0x48(%rbp),%rdx
lea    0xdf3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    1399 <main+0x239>
mov    -0x20(%rbp),%rdi
lea    0xddb(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12ba <main+0x15a>
mov    0x2d43(%rip),%rax
mov    (%rax),%rdi
lea    0xdb9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <main+0x264>
mov    -0x30(%rbp),%rdi
mov    -0x58(%rbp),%rdx
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
cmp    -0x40(%rbp),%rax
jge    1371 <main+0x211>
movl   $0x0,-0x50(%rbp)
xor    %eax,%eax
cmpl   $0x8,-0x50(%rbp)
mov    %al,-0x59(%rbp)
jge    130d <main+0x1ad>
mov    -0x4c(%rbp),%eax
add    -0x50(%rbp),%eax
cltq
cmp    -0x40(%rbp),%rax
setl   %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    131d <main+0x1bd>
jmp    1351 <main+0x1f1>
mov    -0x30(%rbp),%rdi
mov    -0x4c(%rbp),%eax
add    -0x50(%rbp),%eax
movslq %eax,%rcx
lea    0x2d2f(%rip),%rax
movzbl (%rax,%rcx,1),%edx
lea    0xd67(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12ec <main+0x18c>
mov    -0x30(%rbp),%rdi
lea    0xda6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4c(%rbp)
jmp    12d7 <main+0x177>
mov    -0x30(%rbp),%rdi
mov    -0x58(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xd28(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
jmp    13bd <main+0x25d>
mov    0x2c40(%rip),%rax
mov    (%rax),%rdi
lea    0xd2f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <main+0x264>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x4,%edi
jne    1388 <main+0x208>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%r13
mov    0x18(%rsi),%rbx
lea    0xe83(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13a0 <main+0x220>
mov    %rax,%rbp
mov    %rbx,0x8(%rsp)
mov    %rax,%rdi
call   1070 <fileno@plt>
lea    0x10(%rsp),%rsi
mov    %eax,%edi
call   10a0 <fstat@plt>
mov    0x10(%rsp),%r15
lea    0x2e90(%rip),%r12
mov    $0x1,%ebx
mov    %r12,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
mov    %rbp,%rcx
call   1030 <fread@plt>
mov    %rax,%r14
mov    0x2dd6(%rip),%rax
movslq (%rax),%rdi
lea    0xe40(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
cmp    %r15,%r14
jne    13c7 <main+0x247>
lea    0xe2f(%rip),%rsi
mov    %r13,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1402 <main+0x282>
mov    %rax,%rbp
lea    0xe34(%rip),%rsi
mov    %rax,%rdi
mov    0x8(%rsp),%r14
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
test   %r15,%r15
jle    13df <main+0x25f>
mov    $0x7,%ebx
lea    0xe33(%rip),%r13
jmp    12a1 <main+0x121>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %rbp,%rsi
call   1050 <fputc@plt>
lea    0x8(%rbx),%rax
add    $0x1,%rbx
cmp    %rbx,%r15
mov    %rax,%rbx
jle    13df <main+0x25f>
movzbl -0x7(%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    -0x6(%rbx),%rax
cmp    %rax,%r15
jle    1280 <main+0x100>
movzbl -0x6(%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    -0x5(%rbx),%rax
cmp    %rax,%r15
jle    1280 <main+0x100>
movzbl -0x5(%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    -0x4(%rbx),%rax
cmp    %rax,%r15
jle    1280 <main+0x100>
movzbl -0x4(%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    -0x3(%rbx),%rax
cmp    %rax,%r15
jle    1280 <main+0x100>
movzbl -0x3(%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    -0x2(%rbx),%rax
cmp    %rax,%r15
jle    1280 <main+0x100>
movzbl -0x2(%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    -0x1(%rbx),%rax
cmp    %rax,%r15
jle    1280 <main+0x100>
movzbl -0x1(%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    %rbx,%r15
jle    1280 <main+0x100>
movzbl (%rbx,%r12,1),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1280 <main+0x100>
mov    0x2c51(%rip),%rax
mov    (%rax),%rcx
lea    0xc67(%rip),%rdi
mov    $0x2c,%esi
jmp    13b6 <main+0x236>
mov    0x2c39(%rip),%rax
mov    (%rax),%rcx
lea    0xc7f(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
mov    $0x1,%ebx
jmp    1422 <main+0x2a2>
mov    0x2c12(%rip),%rax
mov    (%rax),%rcx
lea    0xd01(%rip),%rdi
mov    $0x2a,%esi
jmp    1418 <main+0x298>
lea    0xcc6(%rip),%rsi
mov    %rbp,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
xor    %ebx,%ebx
jmp    1422 <main+0x2a2>
mov    0x2bd7(%rip),%rax
mov    (%rax),%rcx
lea    0xc4d(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
@main.data = internal global [65536 x i8] zeroinitializer
@stderr = global i32* null
@.str = [45 x i8] c"Usage: tf2hex input_file output_file suffix\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [28 x i8] c"Unable to open input file.\0A\00"
@stdout = global i32 0
@.str.3 = [17 x i8] c"Read %ld bytes.\0A\00"
@.str.4 = [3 x i8] c"wt\00"
@.str.5 = [29 x i8] c"Unable to open output file.\0A\00"
@.str.6 = [38 x i8] c"static unsigned char romDump%s[] = {\0A\00"
@.str.7 = [9 x i8] c"0x%02x, \00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [45 x i8] c"};\0Astatic unsigned int romDumpSize%s = %ld;\0A\00"
@.str.10 = [43 x i8] c"Was unable to read the entire input file.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca %struct.stat
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 4
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i32*, i32** @stderr
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %117
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
store i8* %27, i8** %7
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
store i8* %30, i8** %15
%31 = load i8*, i8** %6
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %8
%33 = load i32*, i32** %8
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %38
35: ; preds = %21
%36 = load i32*, i32** @stderr
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %117
38: ; preds = %21
%39 = load i32*, i32** %8
%40 = call i32 @fileno(i32* %39)
%41 = call i32 @fstat(i32 %40, %struct.stat* %10)
%42 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%43 = load i64, i64* %42
store i64 %43, i64* %11
%44 = load i64, i64* %11
%45 = load i32*, i32** %8
%46 = call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @main.data, i64 0, i64 0), i32 1, i64 %44, i32* %45)
store i64 %46, i64* %12
%47 = load i32, i32* @stdout
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
%50 = load i64, i64* %12
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 %50)
%52 = load i32*, i32** %8
%53 = call i32 @fclose(i32* %52)
%54 = load i64, i64* %12
%55 = load i64, i64* %11
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %113
57: ; preds = %38
%58 = load i8*, i8** %7
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %59, i32** %9
%60 = load i32*, i32** %9
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %65
62: ; preds = %57
%63 = load i32*, i32** @stderr
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %117
65: ; preds = %57
%66 = load i32*, i32** %9
%67 = load i8*, i8** %15
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %67)
store i32 0, i32* %13
br label %69
69: ; preds = %103, %65
%70 = load i32, i32* %13
%71 = sext i32 %70 to i64
%72 = load i64, i64* %11
%73 = icmp slt i64 %71, %72
br i1 %73, label %74, label %106
74: ; preds = %69
store i32 0, i32* %14
br label %75
75: ; preds = %97, %74
%76 = load i32, i32* %14
%77 = icmp slt i32 %76, 8
br i1 %77, label %78, label %85
78: ; preds = %75
%79 = load i32, i32* %13
%80 = load i32, i32* %14
%81 = add nsw i32 %79, %80
%82 = sext i32 %81 to i64
%83 = load i64, i64* %11
%84 = icmp slt i64 %82, %83
br label %85
85: ; preds = %78, %75
%86 = phi i1 [ false, %75 ], [ %84, %78 ]
br i1 %86, label %87, label %100
87: ; preds = %85
%88 = load i32*, i32** %9
%89 = load i32, i32* %13
%90 = load i32, i32* %14
%91 = add nsw i32 %89, %90
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %92
%94 = load i8, i8* %93
%95 = zext i8 %94 to i32
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %95)
br label %97
97: ; preds = %87
%98 = load i32, i32* %14
%99 = add nsw i32 %98, 1
store i32 %99, i32* %14
br label %75
100: ; preds = %85
%101 = load i32*, i32** %9
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %103
103: ; preds = %100
%104 = load i32, i32* %13
%105 = add nsw i32 %104, 8
store i32 %105, i32* %13
br label %69
106: ; preds = %69
%107 = load i32*, i32** %9
%108 = load i8*, i8** %15
%109 = load i64, i64* %11
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), i8* %108, i64 %109)
%111 = load i32*, i32** %9
%112 = call i32 @fclose(i32* %111)
br label %116
113: ; preds = %38
%114 = load i32*, i32** @stderr
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %114, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %117
116: ; preds = %106
store i32 0, i32* %3
br label %117
117: ; preds = %116, %113, %62, %35, %18
%118 = load i32, i32* %3
ret i32 %118
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@main.data = internal global [65536 x i8] zeroinitializer
@stderr = global i32* null
@.str = [45 x i8] c"Usage: tf2hex input_file output_file suffix\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [28 x i8] c"Unable to open input file.\0A\00"
@stdout = global i32 0
@.str.3 = [17 x i8] c"Read %ld bytes.\0A\00"
@.str.4 = [3 x i8] c"wt\00"
@.str.5 = [29 x i8] c"Unable to open output file.\0A\00"
@.str.6 = [38 x i8] c"static unsigned char romDump%s[] = {\0A\00"
@.str.7 = [9 x i8] c"0x%02x, \00"
@.str.9 = [45 x i8] c"};\0Astatic unsigned int romDumpSize%s = %ld;\0A\00"
@.str.10 = [43 x i8] c"Was unable to read the entire input file.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp eq i32 %0, 4
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32*, i32** @stderr
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 44, i64 1, i32* %7)
br label %107
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %9
%19 = load i32*, i32** @stderr
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 27, i64 1, i32* %19)
br label %107
21: ; preds = %9
%22 = tail call i32 @fileno(i32* %16)
%23 = call i32 @fstat(i32 %22, %struct.stat* %3)
%24 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%25 = load i64, i64* %24
%26 = tail call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @main.data, i64 0, i64 0), i32 1, i64 %25, i32* %16)
%27 = load i32, i32* @stdout
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 %26)
%31 = tail call i32 @fclose(i32* %16)
%32 = icmp eq i64 %26, %25
br i1 %32, label %33, label %104
33: ; preds = %21
%34 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32*, i32** @stderr
%38 = tail call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i64 28, i64 1, i32* %37)
br label %107
39: ; preds = %33
%40 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %15)
%41 = icmp sgt i64 %25, 0
br i1 %41, label %42, label %101
42: ; preds = %39, %97
%43 = phi i64 [ %99, %97 ], [ 0, %39 ]
%44 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %46)
%48 = or i64 %43, 1
%49 = icmp sgt i64 %25, %48
br i1 %49, label %50, label %97
50: ; preds = %42
%51 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %48
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %53)
%55 = or i64 %43, 2
%56 = icmp sgt i64 %25, %55
br i1 %56, label %57, label %97
57: ; preds = %50
%58 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %55
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %60)
%62 = or i64 %43, 3
%63 = icmp sgt i64 %25, %62
br i1 %63, label %64, label %97
64: ; preds = %57
%65 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %62
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %67)
%69 = or i64 %43, 4
%70 = icmp sgt i64 %25, %69
br i1 %70, label %71, label %97
71: ; preds = %64
%72 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %69
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %74)
%76 = or i64 %43, 5
%77 = icmp sgt i64 %25, %76
br i1 %77, label %78, label %97
78: ; preds = %71
%79 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %76
%80 = load i8, i8* %79
%81 = zext i8 %80 to i32
%82 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %81)
%83 = or i64 %43, 6
%84 = icmp sgt i64 %25, %83
br i1 %84, label %85, label %97
85: ; preds = %78
%86 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %83
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %88)
%90 = or i64 %43, 7
%91 = icmp sgt i64 %25, %90
br i1 %91, label %92, label %97
92: ; preds = %85
%93 = getelementptr inbounds [65536 x i8], [65536 x i8]* @main.data, i64 0, i64 %90
%94 = load i8, i8* %93
%95 = zext i8 %94 to i32
%96 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %95)
br label %97
97: ; preds = %92, %85, %78, %71, %64, %57, %50, %42
%98 = tail call i32 @fputc(i32 10, i32* %34)
%99 = add nuw i64 %43, 8
%100 = icmp sgt i64 %25, %99
br i1 %100, label %42, label %101
101: ; preds = %97, %39
%102 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), i8* %15, i64 %25)
%103 = tail call i32 @fclose(i32* %34)
br label %107
104: ; preds = %21
%105 = load i32*, i32** @stderr
%106 = tail call i64 @fwrite(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i64 42, i64 1, i32* %105)
br label %107
107: ; preds = %101, %104, %36, %18, %6
%108 = phi i32 [ 1, %6 ], [ 1, %18 ], [ 1, %36 ], [ 0, %101 ], [ 1, %104 ]
ret i32 %108
}