#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*/ word;
typedef int int32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strrchr(char *, char);
int main(int argc, char *argv[]) {
  char base[100], opath[100], *name, *p;
  FILE *ifp, *ofp;
  int size, cnt;
  int32_t word;
  if (argc < 2 || argc > 3) {
    fprintf(stderr, "usage: bin2xbasic <infile> [ <outfile> ]\n");
    exit(1);
  }
  strcpy(base, argv[1]);
  if ((p = strrchr(base, '.')) != NULL)
    *p = '\0';
  if (argc >= 3)
    strcpy(opath, argv[2]);
  else {
    strcpy(opath, base);
    strcat(opath, ".bas");
  }
  if ((name = strrchr(base, '/')) != NULL)
    ++name;
  else
    name = base;
  if (!(ifp = fopen(argv[1], "rb"))) {
    fprintf(stderr, "error: can't open: %s\n", argv[1]);
    exit(1);
  }
  if (!(ofp = fopen(opath, "wb"))) {
    fprintf(stderr, "error: can't create: %s\n", argv[2]);
    exit(1);
  }
  fprintf(ofp, "dim %s_array() = {\n", name);
  size = cnt = 0;
  while (fread(&word, sizeof(word), 1, ifp) == 1) {
    if (cnt != 0)
      fprintf(ofp, ",");
    fprintf(ofp, " 0x%08x", word);
    if (++cnt == 4) {
      putc('\n', ofp);
      cnt = 0;
    }
    ++size;
  }
  if (cnt > 0)
    putc('\n', ofp);
  fprintf(ofp, "}\ndef %s_size = %d\n", name, size);
  fclose(ifp);
  fclose(ofp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11bd <main+0x2d>
cmpl   $0x3,-0x8(%rbp)
jle    11df <main+0x4f>
mov    0x2e1c(%rip),%rax
movslq (%rax),%rdi
lea    0xe32(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
mov    %rax,-0x100(%rbp)
cmp    $0x0,%rax
je     1219 <main+0x89>
mov    -0x100(%rbp),%rax
movb   $0x0,(%rax)
cmpl   $0x3,-0x8(%rbp)
jl     123c <main+0xac>
lea    -0xf0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
jmp    125f <main+0xcf>
lea    -0xf0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
mov    %rax,-0xf8(%rbp)
cmp    $0x0,%rax
je     1295 <main+0x105>
mov    -0xf8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf8(%rbp)
jmp    12a0 <main+0x110>
lea    -0x80(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd80(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x108(%rbp)
cmp    $0x0,%rax
jne    12ef <main+0x15f>
mov    0x2d14(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd54(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    -0xf0(%rbp),%rdi
lea    0xd4c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x110(%rbp)
cmp    $0x0,%rax
jne    133d <main+0x1ad>
mov    0x2cc6(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd20(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x110(%rbp),%rdi
mov    -0xf8(%rbp),%rdx
lea    0xd13(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x118(%rbp)
movl   $0x0,-0x114(%rbp)
mov    -0x108(%rbp),%rcx
lea    -0x11c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    1417 <main+0x287>
cmpl   $0x0,-0x118(%rbp)
je     13b5 <main+0x225>
mov    -0x110(%rbp),%rdi
lea    0xccb(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x110(%rbp),%rdi
mov    -0x11c(%rbp),%edx
lea    0xcb2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
cmp    $0x4,%eax
jne    1403 <main+0x273>
mov    -0x110(%rbp),%rsi
mov    $0xa,%edi
call   1070 <putc@plt>
movl   $0x0,-0x118(%rbp)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    136d <main+0x1dd>
cmpl   $0x0,-0x118(%rbp)
jle    1435 <main+0x2a5>
mov    -0x110(%rbp),%rsi
mov    $0xa,%edi
call   1070 <putc@plt>
mov    -0x110(%rbp),%rdi
mov    -0xf8(%rbp),%rdx
mov    -0x114(%rbp),%ecx
lea    0xc33(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x108(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x110(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %edi,%ebp
lea    -0x4(%rbp),%eax
cmp    $0xfffffffd,%eax
jbe    138d <main+0x1dd>
mov    %rsi,%r12
mov    0x8(%rsi),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
test   %rax,%rax
je     11fb <main+0x4b>
movb   $0x0,(%rax)
cmp    $0x3,%ebp
jb     1211 <main+0x61>
mov    0x10(%r12),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    1235 <main+0x85>
lea    0x10(%rsp),%rbp
lea    0x80(%rsp),%rsi
mov    %rbp,%rdi
call   1030 <strcpy@plt>
lea    0xdfd(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <strcat@plt>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
lea    0x1(%rax),%r14
test   %rax,%rax
cmove  %rbx,%r14
mov    0x8(%r12),%rdi
lea    0xdd6(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13b7 <main+0x207>
mov    %rax,%r15
lea    0xdd8(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13cf <main+0x21f>
mov    %rax,%rbx
lea    0xdd7(%rip),%rsi
xor    %ebp,%ebp
mov    %rax,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    1353 <main+0x1a3>
mov    %r14,0x8(%rsp)
lea    0xdb0(%rip),%r12
lea    0x4(%rsp),%r13
xor    %r14d,%r14d
xor    %ebp,%ebp
jmp    12fd <main+0x14d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
mov    %r13,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    133c <main+0x18c>
test   %r14d,%r14d
je     130f <main+0x15f>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1070 <fputc@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
add    $0x1,%r14d
cmp    $0x4,%r14d
jne    12e0 <main+0x130>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
xor    %r14d,%r14d
jmp    12e0 <main+0x130>
test   %r14d,%r14d
jle    134e <main+0x19e>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
mov    0x8(%rsp),%r14
lea    0xd27(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c4c(%rip),%rax
movslq (%rax),%rcx
lea    0xc62(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
call   10d0 <fwrite@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2c22(%rip),%rax
movslq (%rax),%rdi
mov    0x8(%r12),%rdx
lea    0xc65(%rip),%rsi
jmp    13e5 <main+0x235>
mov    0x2c0a(%rip),%rax
movslq (%rax),%rdi
mov    0x10(%r12),%rdx
lea    0xc67(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"usage: bin2xbasic <infile> [ <outfile> ]\0A\00"
@.str.1 = [5 x i8] c".bas\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [23 x i8] c"error: can't open: %s\0A\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [25 x i8] c"error: can't create: %s\0A\00"
@.str.6 = [20 x i8] c"dim %s_array() = {\0A\00"
@.str.7 = [2 x i8] c",\00"
@.str.8 = [8 x i8] c" 0x%08x\00"
@.str.9 = [20 x i8] c"}\0Adef %s_size = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
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, 2
br i1 %16, label %20, label %17
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 3
br i1 %19, label %20, label %26
20: ; preds = %17, %2
%21 = load i32, i32* @stderr
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %17
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strcpy(i8* %27, i8* %30)
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%33 = call i8* @strrchr(i8* %32, i8 signext 46)
store i8* %33, i8** %9
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %37
35: ; preds = %26
%36 = load i8*, i8** %9
store i8 0, i8* %36
br label %37
37: ; preds = %35, %26
%38 = load i32, i32* %4
%39 = icmp sge i32 %38, 3
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32 @strcpy(i8* %41, i8* %44)
br label %52
46: ; preds = %37
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%49 = call i32 @strcpy(i8* %47, i8* %48)
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %52
52: ; preds = %46, %40
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%54 = call i8* @strrchr(i8* %53, i8 signext 47)
store i8* %54, i8** %8
%55 = icmp ne i8* %54, null
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i8*, i8** %8
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %8
br label %61
59: ; preds = %52
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
store i8* %60, i8** %8
br label %61
61: ; preds = %59, %56
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i32* @fopen(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %65, i32** %10
%66 = icmp ne i32* %65, null
br i1 %66, label %76, label %67
67: ; preds = %61
%68 = load i32, i32* @stderr
%69 = sext i32 %68 to i64
%70 = inttoptr i64 %69 to i32*
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 1
%73 = load i8*, i8** %72
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %73)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %61
%77 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%78 = call i32* @fopen(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %78, i32** %11
%79 = icmp ne i32* %78, null
br i1 %79, label %89, label %80
80: ; preds = %76
%81 = load i32, i32* @stderr
%82 = sext i32 %81 to i64
%83 = inttoptr i64 %82 to i32*
%84 = load i8**, i8*** %5
%85 = getelementptr inbounds i8*, i8** %84, i64 2
%86 = load i8*, i8** %85
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %86)
%88 = call i32 @exit(i32 1)
unreachable
89: ; preds = %76
%90 = load i32*, i32** %11
%91 = load i8*, i8** %8
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %91)
store i32 0, i32* %13
store i32 0, i32* %12
br label %93
93: ; preds = %113, %89
%94 = load i32*, i32** %10
%95 = call i32 @fread(i32* %14, i32 4, i32 1, i32* %94)
%96 = icmp eq i32 %95, 1
br i1 %96, label %97, label %116
97: ; preds = %93
%98 = load i32, i32* %13
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %97
%101 = load i32*, i32** %11
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %103
103: ; preds = %100, %97
%104 = load i32*, i32** %11
%105 = load i32, i32* %14
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %104, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %105)
%107 = load i32, i32* %13
%108 = add nsw i32 %107, 1
store i32 %108, i32* %13
%109 = icmp eq i32 %108, 4
br i1 %109, label %110, label %113
110: ; preds = %103
%111 = load i32*, i32** %11
%112 = call i32 @putc(i8 signext 10, i32* %111)
store i32 0, i32* %13
br label %113
113: ; preds = %110, %103
%114 = load i32, i32* %12
%115 = add nsw i32 %114, 1
store i32 %115, i32* %12
br label %93
116: ; preds = %93
%117 = load i32, i32* %13
%118 = icmp sgt i32 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %116
%120 = load i32*, i32** %11
%121 = call i32 @putc(i8 signext 10, i32* %120)
br label %122
122: ; preds = %119, %116
%123 = load i32*, i32** %11
%124 = load i8*, i8** %8
%125 = load i32, i32* %12
%126 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8* %124, i32 %125)
%127 = load i32*, i32** %10
%128 = call i32 @fclose(i32* %127)
%129 = load i32*, i32** %11
%130 = call i32 @fclose(i32* %129)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"usage: bin2xbasic <infile> [ <outfile> ]\0A\00"
@.str.1 = [5 x i8] c".bas\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [23 x i8] c"error: can't open: %s\0A\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [25 x i8] c"error: can't create: %s\0A\00"
@.str.6 = [20 x i8] c"dim %s_array() = {\0A\00"
@.str.8 = [8 x i8] c" 0x%08x\00"
@.str.9 = [20 x i8] c"}\0Adef %s_size = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca i32
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
%9 = add i32 %0, -4
%10 = icmp ult i32 %9, -2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 41, i64 1, i32* %14)
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcpy(i8* %6, i8* %19)
%21 = call i8* @strrchr(i8* %6, i8 signext 46)
%22 = icmp eq i8* %21, null
br i1 %22, label %24, label %23
23: ; preds = %17
store i8 0, i8* %21
br label %24
24: ; preds = %23, %17
%25 = icmp ugt i32 %0, 2
br i1 %25, label %26, label %30
26: ; preds = %24
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %7, i8* %28)
br label %33
30: ; preds = %24
%31 = call i32 @strcpy(i8* %7, i8* %6)
%32 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %30, %26
%34 = call i8* @strrchr(i8* %6, i8 signext 47)
%35 = icmp eq i8* %34, null
%36 = getelementptr inbounds i8, i8* %34, i64 1
%37 = select i1 %35, i8* %6, i8* %36
%38 = load i8*, i8** %18
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %48
41: ; preds = %33
%42 = load i32, i32* @stderr
%43 = sext i32 %42 to i64
%44 = inttoptr i64 %43 to i32*
%45 = load i8*, i8** %18
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %33
%49 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %59
51: ; preds = %48
%52 = load i32, i32* @stderr
%53 = sext i32 %52 to i64
%54 = inttoptr i64 %53 to i32*
%55 = getelementptr inbounds i8*, i8** %1, i64 2
%56 = load i8*, i8** %55
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %48
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %37)
%61 = call i32 @fread(i32* %5, i32 4, i32 1, i32* %39)
%62 = icmp eq i32 %61, 1
br i1 %62, label %63, label %85
63: ; preds = %59, %76
%64 = phi i32 [ %77, %76 ], [ 0, %59 ]
%65 = phi i32 [ %78, %76 ], [ 0, %59 ]
%66 = icmp eq i32 %64, 0
br i1 %66, label %69, label %67
67: ; preds = %63
%68 = call i32 @fputc(i32 44, i32* %49)
br label %69
69: ; preds = %67, %63
%70 = load i32, i32* %5
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %70)
%72 = add nsw i32 %64, 1
%73 = icmp eq i32 %72, 4
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = call i32 @putc(i8 signext 10, i32* %49)
br label %76
76: ; preds = %74, %69
%77 = phi i32 [ 0, %74 ], [ %72, %69 ]
%78 = add nuw nsw i32 %65, 1
%79 = call i32 @fread(i32* %5, i32 4, i32 1, i32* %39)
%80 = icmp eq i32 %79, 1
br i1 %80, label %63, label %81
81: ; preds = %76
%82 = icmp sgt i32 %77, 0
br i1 %82, label %83, label %85
83: ; preds = %81
%84 = call i32 @putc(i8 signext 10, i32* %49)
br label %85
85: ; preds = %59, %83, %81
%86 = phi i32 [ %78, %83 ], [ %78, %81 ], [ 0, %59 ]
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8* %37, i32 %86)
%88 = call i32 @fclose(i32* %39)
%89 = call i32 @fclose(i32* %49)
ret i32 0
}