#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 fread(char *, int, unsigned int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  char *Buf, *a;
  int BufLen;
  int nbytes, fileLen;
  unsigned int checksum, count;
  int i;
  if (argc != 3) {
    printf("Usage: mkbl1 <source file> <destination file>\n");
    return -1;
  }
  BufLen = (8 * 1024);
  Buf = (char *)malloc(BufLen);
  if (!Buf) {
    printf("Alloc buffer failed!\n");
    return -1;
  }
  memset(Buf, 0x00, BufLen);
  fp = fopen(argv[1], "rb");
  if (fp == NULL) {
    printf("source file open error\n");
    free(Buf);
    return -1;
  }
  fseek(fp, 0L, SEEK_END);
  fileLen = ftell(fp);
  fseek(fp, 0L, SEEK_SET);
  count = (fileLen < ((8 * 1024) - 16)) ? fileLen : ((8 * 1024) - 16);
  memcpy(&Buf[0], "S5PC110 HEADER  ", 16);
  nbytes = fread(Buf + 16, 1, count, fp);
  if (nbytes != count) {
    printf("source file read error\n");
    free(Buf);
    fclose(fp);
    return -1;
  }
  fclose(fp);
  a = Buf + 16;
  for (i = 0, checksum = 0; i < (8 * 1024) - 16; i++)
    checksum += (0x000000FF) & *a++;
  a = Buf + 8;
  *((unsigned int *)a) = checksum;
  a = Buf + 0;
  *((unsigned int *)a) = (8 * 1024);
  fp = fopen(argv[2], "wb");
  if (fp == NULL) {
    printf("destination file open error\n");
    free(Buf);
    return -1;
  }
  a = Buf;
  nbytes = fwrite(a, 1, BufLen, fp);
  if (nbytes != BufLen) {
    printf("destination file write error\n");
    free(Buf);
    fclose(fp);
    return -1;
  }
  free(Buf);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11e8 <main+0x38>
lea    0xe29(%rip),%rdi
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    146f <main+0x2bf>
movl   $0x2000,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    121e <main+0x6e>
lea    0xe22(%rip),%rdi
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    146f <main+0x2bf>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0a(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1270 <main+0xc0>
lea    0xdf2(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    146f <main+0x2bf>
mov    -0x18(%rbp),%rdi
mov    0x2d6d(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d3b(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <fseek@plt>
cmpl   $0x1ff0,-0x34(%rbp)
jge    12c0 <main+0x110>
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    12cd <main+0x11d>
mov    $0x1ff0,%eax
mov    %eax,-0x44(%rbp)
jmp    12cd <main+0x11d>
mov    -0x44(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xd82(%rip),%rsi
mov    $0x10,%edx
call   1090 <memcpy@plt>
mov    -0x20(%rbp),%rdi
add    $0x10,%rdi
mov    -0x3c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x3c(%rbp),%eax
je     133a <main+0x18a>
lea    0xd5a(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    146f <main+0x2bf>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x1ff0,-0x40(%rbp)
jge    1395 <main+0x1e5>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%eax
and    $0xff,%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    135d <main+0x1ad>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x38(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x2000,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xcbe(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1400 <main+0x250>
lea    0xca6(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    146f <main+0x2bf>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10d0 <fwrite@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
je     1456 <main+0x2a6>
lea    0xc76(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    146f <main+0x2bf>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x3,%edi
jne    135c <main+0x1ac>
mov    %rsi,%r14
mov    $0x2000,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1365 <main+0x1b5>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1070 <memset@plt>
mov    0x8(%r14),%rdi
lea    0xe0c(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     137f <main+0x1cf>
mov    %rax,%r15
mov    0x2ddc(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r15,%rdi
call   1080 <ftell@plt>
mov    %eax,%r12d
mov    0x2dae(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
cmp    $0x1ff0,%r12d
mov    $0x1ff0,%ebp
cmovl  %r12d,%ebp
lea    0xdb6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
call   1090 <memcpy@plt>
mov    %rbx,%rdi
add    $0x10,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    %ebp,%eax
jne    1388 <main+0x1d8>
mov    %r15,%rdi
call   1060 <fclose@plt>
pxor   %xmm0,%xmm0
mov    $0x1c,%eax
pxor   %xmm2,%xmm2
pxor   %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movd   -0xc(%rbx,%rax,1),%xmm3
movd   -0x8(%rbx,%rax,1),%xmm4
punpcklbw %xmm0,%xmm3
punpcklwd %xmm0,%xmm3
paddd  %xmm2,%xmm3
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
paddd  %xmm1,%xmm4
movd   -0x4(%rbx,%rax,1),%xmm2
movd   (%rbx,%rax,1),%xmm1
punpcklbw %xmm0,%xmm2
punpcklwd %xmm0,%xmm2
paddd  %xmm3,%xmm2
punpcklbw %xmm0,%xmm1
punpcklwd %xmm0,%xmm1
paddd  %xmm4,%xmm1
add    $0x10,%rax
cmp    $0x200c,%rax
jne    12a0 <main+0xf0>
paddd  %xmm2,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,0x8(%rbx)
movl   $0x2000,(%rbx)
mov    0x10(%r14),%rdi
lea    0xcf5(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     13a1 <main+0x1f1>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2000,%edx
mov    %rax,%rcx
call   10d0 <fwrite@plt>
cmp    $0x2000,%eax
jne    13b7 <main+0x207>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
jmp    1376 <main+0x1c6>
lea    0xd30(%rip),%rdi
jmp    136c <main+0x1bc>
lea    0xcab(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcf6(%rip),%rdi
jmp    13a8 <main+0x1f8>
lea    0xcd6(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
jmp    13ce <main+0x21e>
lea    0xca1(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    1371 <main+0x1c1>
lea    0xc6e(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
jmp    1371 <main+0x1c1>

LLVM IR (-O0):
@.str = [47 x i8] c"Usage: mkbl1 <source file> <destination file>\0A\00"
@.str.1 = [22 x i8] c"Alloc buffer failed!\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [24 x i8] c"source file open error\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [17 x i8] c"S5PC110 HEADER \00"
@.str.5 = [24 x i8] c"source file read error\0A\00"
@.str.6 = [3 x i8] c"wb\00"
@.str.7 = [29 x i8] c"destination file open error\0A\00"
@.str.8 = [30 x i8] c"destination file write error\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%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 ne i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %133
19: ; preds = %2
store i32 8192, i32* %9
%20 = load i32, i32* %9
%21 = call i64 @malloc(i32 %20)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %7
%23 = load i8*, i8** %7
%24 = icmp ne i8* %23, null
br i1 %24, label %27, label %25
25: ; preds = %19
%26 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %133
27: ; preds = %19
%28 = load i8*, i8** %7
%29 = load i32, i32* %9
%30 = call i32 @memset(i8* %28, i32 0, i32 %29)
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %34, i32** %6
%35 = load i32*, i32** %6
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %41
37: ; preds = %27
%38 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%39 = load i8*, i8** %7
%40 = call i32 @free(i8* %39)
store i32 -1, i32* %3
br label %133
41: ; preds = %27
%42 = load i32*, i32** %6
%43 = load i32, i32* @SEEK_END
%44 = call i32 @fseek(i32* %42, i64 0, i32 %43)
%45 = load i32*, i32** %6
%46 = call i32 @ftell(i32* %45)
store i32 %46, i32* %11
%47 = load i32*, i32** %6
%48 = load i32, i32* @SEEK_SET
%49 = call i32 @fseek(i32* %47, i64 0, i32 %48)
%50 = load i32, i32* %11
%51 = icmp slt i32 %50, 8176
br i1 %51, label %52, label %54
52: ; preds = %41
%53 = load i32, i32* %11
br label %55
54: ; preds = %41
br label %55
55: ; preds = %54, %52
%56 = phi i32 [ %53, %52 ], [ 8176, %54 ]
store i32 %56, i32* %13
%57 = load i8*, i8** %7
%58 = getelementptr inbounds i8, i8* %57, i64 0
%59 = call i32 @memcpy(i8* %58, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 16)
%60 = load i8*, i8** %7
%61 = getelementptr inbounds i8, i8* %60, i64 16
%62 = load i32, i32* %13
%63 = load i32*, i32** %6
%64 = call i32 @fread(i8* %61, i32 1, i32 %62, i32* %63)
store i32 %64, i32* %10
%65 = load i32, i32* %10
%66 = load i32, i32* %13
%67 = icmp ne i32 %65, %66
br i1 %67, label %68, label %74
68: ; preds = %55
%69 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%70 = load i8*, i8** %7
%71 = call i32 @free(i8* %70)
%72 = load i32*, i32** %6
%73 = call i32 @fclose(i32* %72)
store i32 -1, i32* %3
br label %133
74: ; preds = %55
%75 = load i32*, i32** %6
%76 = call i32 @fclose(i32* %75)
%77 = load i8*, i8** %7
%78 = getelementptr inbounds i8, i8* %77, i64 16
store i8* %78, i8** %8
store i32 0, i32* %14
store i32 0, i32* %12
br label %79
79: ; preds = %90, %74
%80 = load i32, i32* %14
%81 = icmp slt i32 %80, 8176
br i1 %81, label %82, label %93
82: ; preds = %79
%83 = load i8*, i8** %8
%84 = getelementptr inbounds i8, i8* %83, i32 1
store i8* %84, i8** %8
%85 = load i8, i8* %83
%86 = sext i8 %85 to i32
%87 = and i32 255, %86
%88 = load i32, i32* %12
%89 = add i32 %88, %87
store i32 %89, i32* %12
br label %90
90: ; preds = %82
%91 = load i32, i32* %14
%92 = add nsw i32 %91, 1
store i32 %92, i32* %14
br label %79
93: ; preds = %79
%94 = load i8*, i8** %7
%95 = getelementptr inbounds i8, i8* %94, i64 8
store i8* %95, i8** %8
%96 = load i32, i32* %12
%97 = load i8*, i8** %8
%98 = bitcast i8* %97 to i32*
store i32 %96, i32* %98
%99 = load i8*, i8** %7
%100 = getelementptr inbounds i8, i8* %99, i64 0
store i8* %100, i8** %8
%101 = load i8*, i8** %8
%102 = bitcast i8* %101 to i32*
store i32 8192, i32* %102
%103 = load i8**, i8*** %5
%104 = getelementptr inbounds i8*, i8** %103, i64 2
%105 = load i8*, i8** %104
%106 = call i32* @fopen(i8* %105, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %106, i32** %6
%107 = load i32*, i32** %6
%108 = icmp eq i32* %107, null
br i1 %108, label %109, label %113
109: ; preds = %93
%110 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%111 = load i8*, i8** %7
%112 = call i32 @free(i8* %111)
store i32 -1, i32* %3
br label %133
113: ; preds = %93
%114 = load i8*, i8** %7
store i8* %114, i8** %8
%115 = load i8*, i8** %8
%116 = load i32, i32* %9
%117 = load i32*, i32** %6
%118 = call i32 @fwrite(i8* %115, i32 1, i32 %116, i32* %117)
store i32 %118, i32* %10
%119 = load i32, i32* %10
%120 = load i32, i32* %9
%121 = icmp ne i32 %119, %120
br i1 %121, label %122, label %128
122: ; preds = %113
%123 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
%124 = load i8*, i8** %7
%125 = call i32 @free(i8* %124)
%126 = load i32*, i32** %6
%127 = call i32 @fclose(i32* %126)
store i32 -1, i32* %3
br label %133
128: ; preds = %113
%129 = load i8*, i8** %7
%130 = call i32 @free(i8* %129)
%131 = load i32*, i32** %6
%132 = call i32 @fclose(i32* %131)
store i32 0, i32* %3
br label %133
133: ; preds = %128, %122, %109, %68, %37, %25, %17
%134 = load i32, i32* %3
ret i32 %134
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [17 x i8] c"S5PC110 HEADER \00"
@.str.6 = [3 x i8] c"wb\00"
@str = [21 x i8] c"Alloc buffer failed!\00"
@str.9 = [29 x i8] c"destination file write error\00"
@str.10 = [28 x i8] c"destination file open error\00"
@str.11 = [23 x i8] c"source file read error\00"
@str.12 = [23 x i8] c"source file open error\00"
@str.13 = [46 x i8] c"Usage: mkbl1 <source file> <destination file>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.13, i64 0, i64 0))
br label %89
6: ; preds = %2
%7 = tail call i64 @malloc(i32 8192)
%8 = inttoptr i64 %7 to i8*
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %89
12: ; preds = %6
%13 = tail call i32 @memset(i8* %8, i32 0, i32 8192)
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.12, i64 0, i64 0))
%20 = tail call i32 @free(i8* %8)
br label %89
21: ; preds = %12
%22 = load i32, i32* @SEEK_END
%23 = tail call i32 @fseek(i32* %16, i64 0, i32 %22)
%24 = tail call i32 @ftell(i32* %16)
%25 = load i32, i32* @SEEK_SET
%26 = tail call i32 @fseek(i32* %16, i64 0, i32 %25)
%27 = icmp slt i32 %24, 8176
%28 = select i1 %27, i32 %24, i32 8176
%29 = tail call i32 @memcpy(i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 16)
%30 = getelementptr inbounds i8, i8* %8, i64 16
%31 = tail call i32 @fread(i8* %30, i32 1, i32 %28, i32* %16)
%32 = icmp eq i32 %31, %28
br i1 %32, label %37, label %33
33: ; preds = %21
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
%35 = tail call i32 @free(i8* %8)
%36 = tail call i32 @fclose(i32* %16)
br label %89
37: ; preds = %21
%38 = tail call i32 @fclose(i32* %16)
br label %39
39: ; preds = %39, %37
%40 = phi i64 [ 0, %37 ], [ %64, %39 ]
%41 = phi <4 x i32> [ zeroinitializer, %37 ], [ %62, %39 ]
%42 = phi <4 x i32> [ zeroinitializer, %37 ], [ %63, %39 ]
%43 = getelementptr i8, i8* %30, i64 %40
%44 = bitcast i8* %43 to <4 x i8>*
%45 = load <4 x i8>, <4 x i8>* %44
%46 = getelementptr i8, i8* %43, i64 4
%47 = bitcast i8* %46 to <4 x i8>*
%48 = load <4 x i8>, <4 x i8>* %47
%49 = zext <4 x i8> %45 to <4 x i32>
%50 = zext <4 x i8> %48 to <4 x i32>
%51 = add <4 x i32> %41, %49
%52 = add <4 x i32> %42, %50
%53 = or i64 %40, 8
%54 = getelementptr i8, i8* %30, i64 %53
%55 = bitcast i8* %54 to <4 x i8>*
%56 = load <4 x i8>, <4 x i8>* %55
%57 = getelementptr i8, i8* %54, i64 4
%58 = bitcast i8* %57 to <4 x i8>*
%59 = load <4 x i8>, <4 x i8>* %58
%60 = zext <4 x i8> %56 to <4 x i32>
%61 = zext <4 x i8> %59 to <4 x i32>
%62 = add <4 x i32> %51, %60
%63 = add <4 x i32> %52, %61
%64 = add nuw nsw i64 %40, 16
%65 = icmp eq i64 %64, 8176
br i1 %65, label %66, label %39
66: ; preds = %39
%67 = add <4 x i32> %63, %62
%68 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %67)
%69 = getelementptr inbounds i8, i8* %8, i64 8
%70 = bitcast i8* %69 to i32*
store i32 %68, i32* %70
%71 = inttoptr i64 %7 to i32*
store i32 8192, i32* %71
%72 = getelementptr inbounds i8*, i8** %1, i64 2
%73 = load i8*, i8** %72
%74 = tail call i32* @fopen(i8* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %79
76: ; preds = %66
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.10, i64 0, i64 0))
%78 = tail call i32 @free(i8* %8)
br label %89
79: ; preds = %66
%80 = tail call i32 @fwrite(i8* %8, i32 1, i32 8192, i32* %74)
%81 = icmp eq i32 %80, 8192
br i1 %81, label %86, label %82
82: ; preds = %79
%83 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.9, i64 0, i64 0))
%84 = tail call i32 @free(i8* %8)
%85 = tail call i32 @fclose(i32* %74)
br label %89
86: ; preds = %79
%87 = tail call i32 @free(i8* %8)
%88 = tail call i32 @fclose(i32* %74)
br label %89
89: ; preds = %86, %82, %76, %33, %18, %10, %4
%90 = phi i32 [ -1, %4 ], [ -1, %18 ], [ -1, %33 ], [ -1, %76 ], [ -1, %82 ], [ 0, %86 ], [ -1, %10 ]
ret i32 %90
}