#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 /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
unsigned char *malloc(int);
int /*<<< orphan*/ *stderr;
int main(int argc, char *argv[]) {
  FILE *in, *out;
  unsigned char *data;
  int length, i;
  if (argc != 4) {
    fprintf(stderr, "Usage: bin2h file.dat outfile.h token_name\n");
    return 1;
  }
  in = fopen(argv[1], "rb");
  if (!in) {
    fprintf(stderr, "bin2h: open %s fail\n", argv[1]);
    return 1;
  }
  fseek(in, 0, SEEK_END);
  length = ftell(in);
  fseek(in, 0, SEEK_SET);
  if (length == 0) {
    fprintf(stderr, "bin2h: %s is empty\n", argv[1]);
    return 1;
  }
  if ((data = malloc(length)) == NULL) {
    fclose(in);
    fprintf(stderr, "bin2h: can\'t allocate memory\n");
    return 1;
  }
  if ((fread(data, 1, length, in)) != length) {
    fclose(in);
    fprintf(stderr, "bin2h: read %s fail\n", argv[1]);
    return 1;
  }
  fclose(in);
  out = fopen(argv[2], "wt");
  if (!out) {
    fclose(in);
    fprintf(stderr, "bin2h: open %s fail\n", argv[2]);
    return 1;
  }
  fprintf(out, "unsigned char %s[%d] = {", argv[3], length);
  for (i = 0; i < length; i++) {
    if (i % 20 == 0) {
      fprintf(out, "\n  ");
    }
    fprintf(out, "%d", data[i]);
    if (i != length - 1)
      fprintf(out, ",");
  }
  fprintf(out, "};\n");
  fclose(out);
  free(data);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11c4 <main+0x44>
mov    0x2e31(%rip),%rax
mov    (%rax),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1449 <main+0x2c9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe59(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1213 <main+0x93>
mov    0x2dea(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1449 <main+0x2c9>
mov    -0x18(%rbp),%rdi
mov    0x2dca(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d92(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    127d <main+0xfd>
mov    0x2d80(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdda(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1449 <main+0x2c9>
mov    -0x2c(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    12c0 <main+0x140>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2d35(%rip),%rax
mov    (%rax),%rdi
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1449 <main+0x2c9>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
cmp    -0x2c(%rbp),%eax
je     1313 <main+0x193>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2cea(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd76(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1449 <main+0x2c9>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd60(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1374 <main+0x1f4>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2c89(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xcce(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1449 <main+0x2c9>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x2c(%rbp),%ecx
lea    0xd04(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    141e <main+0x29e>
mov    -0x30(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13ca <main+0x24a>
mov    -0x20(%rbp),%rdi
lea    0xce4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xcca(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%eax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     140b <main+0x28b>
mov    -0x20(%rbp),%rdi
lea    0xcaa(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1410 <main+0x290>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1398 <main+0x218>
mov    -0x20(%rbp),%rdi
lea    0xc87(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    1309 <main+0x169>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe6a(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1334 <main+0x194>
mov    %rax,%rbp
mov    0x2e0e(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbp,%rdi
call   1080 <ftell@plt>
mov    %eax,%r13d
mov    0x2dd8(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
test   %r13d,%r13d
je     134b <main+0x1ab>
mov    %r13d,%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     1372 <main+0x1d2>
mov    %rax,%r14
mov    $0x1,%r15d
mov    %rax,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
call   1040 <fread@plt>
mov    %eax,%r12d
mov    %rbp,%rdi
call   1050 <fclose@plt>
cmp    %r13d,%r12d
jne    1392 <main+0x1f2>
mov    0x10(%rbx),%rdi
lea    0xe32(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13d4 <main+0x234>
mov    %rax,%r12
mov    0x18(%rbx),%rdx
lea    0xe19(%rip),%rsi
xor    %r15d,%r15d
mov    %rax,%rdi
mov    %r13d,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
test   %r13d,%r13d
jle    13a9 <main+0x209>
lea    -0x1(%r13),%ebx
mov    %r13d,%r13d
xor    %ebp,%ebp
jmp    12ad <main+0x10d>
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    %rbp,%r13
je     13a9 <main+0x209>
mov    %ebp,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x24,%rax
shl    $0x2,%eax
lea    (%rax,%rax,4),%eax
cmp    %eax,%ebp
jne    12df <main+0x13f>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xdd0(%rip),%rdi
mov    %r12,%rcx
call   10c0 <fwrite@plt>
movzbl (%r14,%rbp,1),%edx
mov    %r12,%rdi
lea    0xdbd(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
cmp    %rbp,%rbx
je     12a0 <main+0x100>
mov    $0x2c,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
jmp    12a0 <main+0x100>
mov    0x2cc8(%rip),%rax
mov    (%rax),%rcx
lea    0xce6(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    $0x1,%r15d
jmp    13f8 <main+0x258>
mov    0x2c9d(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%rbx),%rdx
lea    0xce6(%rip),%rsi
jmp    1360 <main+0x1c0>
mov    0x2c86(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%rbx),%rdx
lea    0xce4(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%r15d
jmp    13f8 <main+0x258>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    0x2c57(%rip),%rax
mov    (%rax),%rcx
lea    0xccd(%rip),%rdi
mov    $0x1d,%esi
jmp    131f <main+0x17f>
mov    0x2c3f(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%rbx),%rdx
lea    0xccf(%rip),%rsi
jmp    13f1 <main+0x251>
lea    0xcfe(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10c0 <fwrite@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    13f8 <main+0x258>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    0x2bf5(%rip),%rax
mov    (%rax),%rdi
mov    0x10(%rbx),%rdx
lea    0xc3e(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32* null
@.str = [44 x i8] c"Usage: bin2h file.dat outfile.h token_name\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [21 x i8] c"bin2h: open %s fail\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [20 x i8] c"bin2h: %s is empty\0A\00"
@.str.4 = [30 x i8] c"bin2h: can't allocate memory\0A\00"
@.str.5 = [21 x i8] c"bin2h: read %s fail\0A\00"
@.str.6 = [3 x i8] c"wt\00"
@.str.7 = [25 x i8] c"unsigned char %s[%d] = {\00"
@.str.8 = [4 x i8] c"\0A \00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [2 x i8] c",\00"
@.str.11 = [4 x i8] c"};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 4
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32*, i32** @stderr
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %132
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = load i32*, i32** %6
%22 = icmp ne i32* %21, null
br i1 %22, label %29, label %23
23: ; preds = %16
%24 = load i32*, i32** @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %27)
store i32 1, i32* %3
br label %132
29: ; preds = %16
%30 = load i32*, i32** %6
%31 = load i32, i32* @SEEK_END
%32 = call i32 @fseek(i32* %30, i32 0, i32 %31)
%33 = load i32*, i32** %6
%34 = call i32 @ftell(i32* %33)
store i32 %34, i32* %9
%35 = load i32*, i32** %6
%36 = load i32, i32* @SEEK_SET
%37 = call i32 @fseek(i32* %35, i32 0, i32 %36)
%38 = load i32, i32* %9
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %29
%41 = load i32*, i32** @stderr
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %44)
store i32 1, i32* %3
br label %132
46: ; preds = %29
%47 = load i32, i32* %9
%48 = call i8* @malloc(i32 %47)
store i8* %48, i8** %8
%49 = icmp eq i8* %48, null
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = load i32*, i32** %6
%52 = call i32 @fclose(i32* %51)
%53 = load i32*, i32** @stderr
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %132
55: ; preds = %46
%56 = load i8*, i8** %8
%57 = load i32, i32* %9
%58 = load i32*, i32** %6
%59 = call i32 @fread(i8* %56, i32 1, i32 %57, i32* %58)
%60 = load i32, i32* %9
%61 = icmp ne i32 %59, %60
br i1 %61, label %62, label %70
62: ; preds = %55
%63 = load i32*, i32** %6
%64 = call i32 @fclose(i32* %63)
%65 = load i32*, i32** @stderr
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 1
%68 = load i8*, i8** %67
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %68)
store i32 1, i32* %3
br label %132
70: ; preds = %55
%71 = load i32*, i32** %6
%72 = call i32 @fclose(i32* %71)
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 2
%75 = load i8*, i8** %74
%76 = call i32* @fopen(i8* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %76, i32** %7
%77 = load i32*, i32** %7
%78 = icmp ne i32* %77, null
br i1 %78, label %87, label %79
79: ; preds = %70
%80 = load i32*, i32** %6
%81 = call i32 @fclose(i32* %80)
%82 = load i32*, i32** @stderr
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 2
%85 = load i8*, i8** %84
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %85)
store i32 1, i32* %3
br label %132
87: ; preds = %70
%88 = load i32*, i32** %7
%89 = load i8**, i8*** %5
%90 = getelementptr inbounds i8*, i8** %89, i64 3
%91 = load i8*, i8** %90
%92 = load i32, i32* %9
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %91, i32 %92)
store i32 0, i32* %10
br label %94
94: ; preds = %122, %87
%95 = load i32, i32* %10
%96 = load i32, i32* %9
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %125
98: ; preds = %94
%99 = load i32, i32* %10
%100 = srem i32 %99, 20
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %98
%103 = load i32*, i32** %7
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %105
105: ; preds = %102, %98
%106 = load i32*, i32** %7
%107 = load i8*, i8** %8
%108 = load i32, i32* %10
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %107, i64 %109
%111 = load i8, i8* %110
%112 = zext i8 %111 to i32
%113 = call i32 (i32*, i8*, ...) @fprintf(i32* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %112)
%114 = load i32, i32* %10
%115 = load i32, i32* %9
%116 = sub nsw i32 %115, 1
%117 = icmp ne i32 %114, %116
br i1 %117, label %118, label %121
118: ; preds = %105
%119 = load i32*, i32** %7
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %121
121: ; preds = %118, %105
br label %122
122: ; preds = %121
%123 = load i32, i32* %10
%124 = add nsw i32 %123, 1
store i32 %124, i32* %10
br label %94
125: ; preds = %94
%126 = load i32*, i32** %7
%127 = call i32 (i32*, i8*, ...) @fprintf(i32* %126, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%128 = load i32*, i32** %7
%129 = call i32 @fclose(i32* %128)
%130 = load i8*, i8** %8
%131 = call i32 @free(i8* %130)
store i32 0, i32* %3
br label %132
132: ; preds = %125, %79, %62, %50, %40, %23, %13
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [44 x i8] c"Usage: bin2h file.dat outfile.h token_name\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [21 x i8] c"bin2h: open %s fail\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [20 x i8] c"bin2h: %s is empty\0A\00"
@.str.4 = [30 x i8] c"bin2h: can't allocate memory\0A\00"
@.str.5 = [21 x i8] c"bin2h: read %s fail\0A\00"
@.str.6 = [3 x i8] c"wt\00"
@.str.7 = [25 x i8] c"unsigned char %s[%d] = {\00"
@.str.8 = [4 x i8] c"\0A \00"
@.str.9 = [3 x i8] c"%d\00"
@.str.11 = [4 x i8] c"};\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32*, i32** @stderr
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 43, i64 1, i32* %5)
br label %83
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i32*, i32** @stderr
%14 = load i8*, i8** %8
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %83
16: ; preds = %7
%17 = load i32, i32* @SEEK_END
%18 = tail call i32 @fseek(i32* %10, i32 0, i32 %17)
%19 = tail call i32 @ftell(i32* %10)
%20 = load i32, i32* @SEEK_SET
%21 = tail call i32 @fseek(i32* %10, i32 0, i32 %20)
%22 = icmp eq i32 %19, 0
br i1 %22, label %23, label %27
23: ; preds = %16
%24 = load i32*, i32** @stderr
%25 = load i8*, i8** %8
%26 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %83
27: ; preds = %16
%28 = tail call i8* @malloc(i32 %19)
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = tail call i32 @fclose(i32* %10)
%32 = load i32*, i32** @stderr
%33 = tail call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i64 29, i64 1, i32* %32)
br label %83
34: ; preds = %27
%35 = tail call i32 @fread(i8* %28, i32 1, i32 %19, i32* %10)
%36 = icmp eq i32 %35, %19
%37 = tail call i32 @fclose(i32* %10)
br i1 %36, label %42, label %38
38: ; preds = %34
%39 = load i32*, i32** @stderr
%40 = load i8*, i8** %8
%41 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %40)
br label %83
42: ; preds = %34
%43 = getelementptr inbounds i8*, i8** %1, i64 2
%44 = load i8*, i8** %43
%45 = tail call i32* @fopen(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %52
47: ; preds = %42
%48 = tail call i32 @fclose(i32* %10)
%49 = load i32*, i32** @stderr
%50 = load i8*, i8** %43
%51 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %50)
br label %83
52: ; preds = %42
%53 = getelementptr inbounds i8*, i8** %1, i64 3
%54 = load i8*, i8** %53
%55 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %54, i32 %19)
%56 = icmp sgt i32 %19, 0
br i1 %56, label %57, label %79
57: ; preds = %52
%58 = add nsw i32 %19, -1
%59 = zext i32 %58 to i64
%60 = zext i32 %19 to i64
br label %61
61: ; preds = %57, %76
%62 = phi i64 [ 0, %57 ], [ %77, %76 ]
%63 = trunc i64 %62 to i32
%64 = urem i32 %63, 20
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %61
%67 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 3, i64 1, i32* %45)
br label %68
68: ; preds = %66, %61
%69 = getelementptr inbounds i8, i8* %28, i64 %62
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %71)
%73 = icmp eq i64 %62, %59
br i1 %73, label %76, label %74
74: ; preds = %68
%75 = tail call i32 @fputc(i32 44, i32* %45)
br label %76
76: ; preds = %68, %74
%77 = add nuw nsw i64 %62, 1
%78 = icmp eq i64 %77, %60
br i1 %78, label %79, label %61
79: ; preds = %76, %52
%80 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i64 3, i64 1, i32* %45)
%81 = tail call i32 @fclose(i32* %45)
%82 = tail call i32 @free(i8* %28)
br label %83
83: ; preds = %79, %47, %38, %30, %23, %12, %4
%84 = phi i32 [ 1, %4 ], [ 1, %23 ], [ 1, %30 ], [ 1, %38 ], [ 0, %79 ], [ 1, %47 ], [ 1, %12 ]
ret i32 %84
}