#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 = (16 * 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 < ((16 * 1024) - 16)) ? fileLen : ((16 * 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 < (16 * 1024) - 16; i++)
    checksum += (0x000000FF) & *a++;
  a = Buf + 8;
  *((unsigned int *)a) = checksum;
  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    145d <main+0x2ad>
movl   $0x4000,-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    145d <main+0x2ad>
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    145d <main+0x2ad>
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   $0x3ff0,-0x34(%rbp)
jge    12c0 <main+0x110>
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    12cd <main+0x11d>
mov    $0x3ff0,%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    145d <main+0x2ad>
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   $0x3ff0,-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    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xcd0(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13ee <main+0x23e>
lea    0xcb8(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145d <main+0x2ad>
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     1444 <main+0x294>
lea    0xc88(%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    145d <main+0x2ad>
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    137a <main+0x1ca>
mov    %rsi,%r14
mov    $0x4000,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1383 <main+0x1d3>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1070 <memset@plt>
mov    0x8(%r14),%rdi
lea    0xe0c(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     139d <main+0x1ed>
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    $0x3ff0,%r12d
mov    $0x3ff0,%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    13a6 <main+0x1f6>
mov    %r15,%rdi
call   1060 <fclose@plt>
pxor   %xmm0,%xmm0
mov    $0x24,%eax
pxor   %xmm2,%xmm2
pxor   %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movd   -0x14(%rbx,%rax,1),%xmm4
movd   -0x10(%rbx,%rax,1),%xmm3
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
paddd  %xmm2,%xmm4
punpcklbw %xmm0,%xmm3
punpcklwd %xmm0,%xmm3
paddd  %xmm1,%xmm3
movd   -0xc(%rbx,%rax,1),%xmm5
movd   -0x8(%rbx,%rax,1),%xmm6
punpcklbw %xmm0,%xmm5
punpcklwd %xmm0,%xmm5
punpcklbw %xmm0,%xmm6
punpcklwd %xmm0,%xmm6
movd   -0x4(%rbx,%rax,1),%xmm2
movd   (%rbx,%rax,1),%xmm1
punpcklbw %xmm0,%xmm2
punpcklwd %xmm0,%xmm2
paddd  %xmm5,%xmm2
paddd  %xmm4,%xmm2
punpcklbw %xmm0,%xmm1
punpcklwd %xmm0,%xmm1
paddd  %xmm6,%xmm1
paddd  %xmm3,%xmm1
add    $0x18,%rax
cmp    $0x4014,%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)
mov    0x10(%r14),%rdi
lea    0xcd7(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     13bf <main+0x20f>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4000,%edx
mov    %rax,%rcx
call   10d0 <fwrite@plt>
cmp    $0x4000,%eax
jne    13d5 <main+0x225>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
jmp    1394 <main+0x1e4>
lea    0xd12(%rip),%rdi
jmp    138a <main+0x1da>
lea    0xc8d(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcd8(%rip),%rdi
jmp    13c6 <main+0x216>
lea    0xcb8(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
jmp    13ec <main+0x23c>
lea    0xc83(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    138f <main+0x1df>
lea    0xc50(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
jmp    138f <main+0x1df>

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 %129
19: ; preds = %2
store i32 16384, 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 %129
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 %129
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, 16368
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 ], [ 16368, %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 %129
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, 16368
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*** %5
%100 = getelementptr inbounds i8*, i8** %99, i64 2
%101 = load i8*, i8** %100
%102 = call i32* @fopen(i8* %101, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %102, i32** %6
%103 = load i32*, i32** %6
%104 = icmp eq i32* %103, null
br i1 %104, label %105, label %109
105: ; preds = %93
%106 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%107 = load i8*, i8** %7
%108 = call i32 @free(i8* %107)
store i32 -1, i32* %3
br label %129
109: ; preds = %93
%110 = load i8*, i8** %7
store i8* %110, i8** %8
%111 = load i8*, i8** %8
%112 = load i32, i32* %9
%113 = load i32*, i32** %6
%114 = call i32 @fwrite(i8* %111, i32 1, i32 %112, i32* %113)
store i32 %114, i32* %10
%115 = load i32, i32* %10
%116 = load i32, i32* %9
%117 = icmp ne i32 %115, %116
br i1 %117, label %118, label %124
118: ; preds = %109
%119 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
%120 = load i8*, i8** %7
%121 = call i32 @free(i8* %120)
%122 = load i32*, i32** %6
%123 = call i32 @fclose(i32* %122)
store i32 -1, i32* %3
br label %129
124: ; preds = %109
%125 = load i8*, i8** %7
%126 = call i32 @free(i8* %125)
%127 = load i32*, i32** %6
%128 = call i32 @fclose(i32* %127)
store i32 0, i32* %3
br label %129
129: ; preds = %124, %118, %105, %68, %37, %25, %17
%130 = load i32, i32* %3
ret i32 %130
}

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 %99
6: ; preds = %2
%7 = tail call i64 @malloc(i32 16384)
%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 %99
12: ; preds = %6
%13 = tail call i32 @memset(i8* %8, i32 0, i32 16384)
%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 %99
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, 16368
%28 = select i1 %27, i32 %24, i32 16368
%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 %99
37: ; preds = %21
%38 = tail call i32 @fclose(i32* %16)
br label %39
39: ; preds = %39, %37
%40 = phi i64 [ 0, %37 ], [ %75, %39 ]
%41 = phi <4 x i32> [ zeroinitializer, %37 ], [ %73, %39 ]
%42 = phi <4 x i32> [ zeroinitializer, %37 ], [ %74, %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 = add nuw nsw 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 = getelementptr i8, i8* %30, i64 %64
%66 = bitcast i8* %65 to <4 x i8>*
%67 = load <4 x i8>, <4 x i8>* %66
%68 = getelementptr i8, i8* %65, i64 4
%69 = bitcast i8* %68 to <4 x i8>*
%70 = load <4 x i8>, <4 x i8>* %69
%71 = zext <4 x i8> %67 to <4 x i32>
%72 = zext <4 x i8> %70 to <4 x i32>
%73 = add <4 x i32> %62, %71
%74 = add <4 x i32> %63, %72
%75 = add nuw nsw i64 %40, 24
%76 = icmp eq i64 %75, 16368
br i1 %76, label %77, label %39
77: ; preds = %39
%78 = add <4 x i32> %74, %73
%79 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %78)
%80 = getelementptr inbounds i8, i8* %8, i64 8
%81 = bitcast i8* %80 to i32*
store i32 %79, i32* %81
%82 = getelementptr inbounds i8*, i8** %1, i64 2
%83 = load i8*, i8** %82
%84 = tail call i32* @fopen(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %89
86: ; preds = %77
%87 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.10, i64 0, i64 0))
%88 = tail call i32 @free(i8* %8)
br label %99
89: ; preds = %77
%90 = tail call i32 @fwrite(i8* %8, i32 1, i32 16384, i32* %84)
%91 = icmp eq i32 %90, 16384
br i1 %91, label %96, label %92
92: ; preds = %89
%93 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.9, i64 0, i64 0))
%94 = tail call i32 @free(i8* %8)
%95 = tail call i32 @fclose(i32* %84)
br label %99
96: ; preds = %89
%97 = tail call i32 @free(i8* %8)
%98 = tail call i32 @fclose(i32* %84)
br label %99
99: ; preds = %96, %92, %86, %33, %18, %10, %4
%100 = phi i32 [ -1, %4 ], [ -1, %18 ], [ -1, %33 ], [ -1, %86 ], [ -1, %92 ], [ 0, %96 ], [ -1, %10 ]
ret i32 %100
}