#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
size_t fread(void *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned int *);
size_t fwrite(unsigned int *, int, size_t, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  FILE *fp = NULL;
  char *filename, *nfilename;
  unsigned int cksum, *buff;
  size_t fsize;
  int i, ret = 0;
  if (argc != 3) {
    printf("Usage: %s infile outfile\n", argv[0]);
    return 1;
  }
  buff = (unsigned int *)malloc((512 * 1024));
  if (!buff) {
    printf("Error allocating memory for buffer\n");
    return 1;
  }
  filename = (char *)argv[1];
  fp = fopen((const char *)filename, "r");
  if (!fp) {
    printf("Error opening file %s\n", filename);
    ret = 1;
    goto free_buff;
  }
  fsize = fread((void *)buff, 1, (512 * 1024), fp);
  if (ferror(fp)) {
    printf("Error loading file %s\n", filename);
    ret = 1;
    goto close_file;
  }
  if (!feof(fp)) {
    printf("File %s is too large. The maximum size is "
           "limited by FLASH (%d bytes)\n",
           filename, (512 * 1024));
    ret = 1;
    goto close_file;
  }
  printf("File %s loaded with size %d bytes\n", filename, (int)fsize);
  fclose(fp);
  nfilename = (char *)argv[2];
  fp = fopen(nfilename, "w");
  if (!fp) {
    printf("Error creating new file %s\n", nfilename);
    ret = 1;
    goto free_buff;
  }
  cksum = 0;
  for (i = 0; i < 7; i++) {
    cksum += buff[i];
    printf("Word %d: 0x%08x\n", i, buff[i]);
  }
  buff[7] = 0xFFFFFFFF - cksum + 1;
  printf("Word 7: 0x%08x (cksum total: 0x%08x)\n", buff[7], (cksum + buff[7]));
  if (fwrite(buff, 1, fsize, fp) != fsize) {
    printf("Error writing new file %s\n", nfilename);
    ret = 1;
    goto close_file;
  }
  printf("File %s created with size %d bytes\n", nfilename, (int)fsize);
close_file:
  fclose(fp);
free_buff:
  free(buff);
  return ret;
}


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)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11e0 <main+0x50>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1439 <main+0x2a9>
mov    $0x80000,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1213 <main+0x83>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1439 <main+0x2a9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    125c <main+0xcc>
mov    -0x20(%rbp),%rsi
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x48(%rbp)
jmp    142a <main+0x29a>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x80000,%edx
call   1050 <fread@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <ferror@plt>
cmp    $0x0,%rax
je     12a8 <main+0x118>
mov    -0x20(%rbp),%rsi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x48(%rbp)
jmp    1421 <main+0x291>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
jne    12dd <main+0x14d>
mov    -0x20(%rbp),%rsi
lea    0xda9(%rip),%rdi
mov    $0x80000,%edx
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x48(%rbp)
jmp    1421 <main+0x291>
mov    -0x20(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    %eax,%edx
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1347 <main+0x1b7>
mov    -0x28(%rbp),%rsi
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x48(%rbp)
jmp    142a <main+0x29a>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x7,-0x44(%rbp)
jge    139a <main+0x20a>
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x44(%rbp),%esi
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1355 <main+0x1c5>
mov    $0xffffffff,%ecx
sub    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x38(%rbp),%rax
mov    0x1c(%rax),%esi
mov    -0x2c(%rbp),%edx
mov    -0x38(%rbp),%rax
add    0x1c(%rax),%edx
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10b0 <fwrite@plt>
cmp    -0x40(%rbp),%rax
je     1409 <main+0x279>
mov    -0x28(%rbp),%rsi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x48(%rbp)
jmp    1421 <main+0x291>
mov    -0x28(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    %eax,%edx
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1226 <main+0x86>
mov    $0x80000,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     123f <main+0x9f>
mov    %rax,%r14
mov    0x8(%rbx),%rbp
lea    0xf97(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1253 <main+0xb3>
mov    %rax,%r12
mov    $0x1,%r15d
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x80000,%edx
mov    %rax,%rcx
call   1060 <fread@plt>
mov    %rax,%r13
mov    %r12,%rdi
call   1050 <ferror@plt>
test   %rax,%rax
je     1284 <main+0xe4>
lea    0xe1f(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
call   1070 <fclose@plt>
jmp    126a <main+0xca>
mov    (%rbx),%rsi
lea    0xdd0(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%r15d
jmp    1272 <main+0xd2>
lea    0xf00(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r15d
jmp    1272 <main+0xd2>
lea    0xdc0(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%r15d
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     13cd <main+0x22d>
lea    0xdf4(%rip),%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
call   1070 <fclose@plt>
mov    0x10(%rbx),%rbx
lea    0xdf7(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13e8 <main+0x248>
mov    %rax,%r12
mov    %rbx,(%rsp)
mov    %r13,%rbp
mov    (%r14),%r13d
lea    0xdf0(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x4(%r14),%edx
add    %edx,%r13d
mov    $0x1,%r15d
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%r14),%edx
add    %edx,%r13d
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0xc(%r14),%edx
add    %edx,%r13d
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%r14),%edx
add    %edx,%r13d
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x14(%r14),%edx
add    %edx,%r13d
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x18(%r14),%edx
add    %edx,%r13d
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1080 <printf@plt>
neg    %r13d
mov    %r13d,0x1c(%r14)
lea    0xd5a(%rip),%rdi
mov    %r13d,%esi
mov    %rbp,%rbx
mov    (%rsp),%rbp
xor    %edx,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
call   10c0 <fwrite@plt>
cmp    %rbx,%rax
jne    13f7 <main+0x257>
lea    0xd69(%rip),%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <printf@plt>
xor    %r15d,%r15d
jmp    121c <main+0x7c>
lea    0xc74(%rip),%rdi
mov    %rbp,%rsi
mov    $0x80000,%edx
xor    %eax,%eax
call   1080 <printf@plt>
jmp    121c <main+0x7c>
lea    0xcc5(%rip),%rdi
mov    %rbx,%rsi
jmp    125d <main+0xbd>
lea    0xd09(%rip),%rdi
jmp    1212 <main+0x72>

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: %s infile outfile\0A\00"
@.str.1 = [36 x i8] c"Error allocating memory for buffer\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [23 x i8] c"Error opening file %s\0A\00"
@.str.4 = [23 x i8] c"Error loading file %s\0A\00"
@.str.5 = [71 x i8] c"File %s is too large. The maximum size is limited by FLASH (%d bytes)\0A\00"
@.str.6 = [35 x i8] c"File %s loaded with size %d bytes\0A\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [28 x i8] c"Error creating new file %s\0A\00"
@.str.9 = [17 x i8] c"Word %d: 0x%08x\0A\00"
@.str.10 = [38 x i8] c"Word 7: 0x%08x (cksum total: 0x%08x)\0A\00"
@.str.11 = [27 x i8] c"Error writing new file %s\0A\00"
@.str.12 = [36 x i8] c"File %s created with size %d bytes\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 i64
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32 0, i32* %13
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %132
21: ; preds = %2
%22 = call i64 @malloc(i32 524288)
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %10
%24 = load i32*, i32** %10
%25 = icmp ne i32* %24, null
br i1 %25, label %28, label %26
26: ; preds = %21
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %132
28: ; preds = %21
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
store i8* %31, i8** %7
%32 = load i8*, i8** %7
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %33, i32** %6
%34 = load i32*, i32** %6
%35 = icmp ne i32* %34, null
br i1 %35, label %39, label %36
36: ; preds = %28
%37 = load i8*, i8** %7
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %37)
store i32 1, i32* %13
br label %128
39: ; preds = %28
%40 = load i32*, i32** %10
%41 = bitcast i32* %40 to i8*
%42 = load i32*, i32** %6
%43 = call i64 @fread(i8* %41, i32 1, i32 524288, i32* %42)
store i64 %43, i64* %11
%44 = load i32*, i32** %6
%45 = call i64 @ferror(i32* %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %39
%48 = load i8*, i8** %7
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %48)
store i32 1, i32* %13
br label %125
50: ; preds = %39
%51 = load i32*, i32** %6
%52 = call i32 @feof(i32* %51)
%53 = icmp ne i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %50
%55 = load i8*, i8** %7
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0), i8* %55, i32 524288)
store i32 1, i32* %13
br label %125
57: ; preds = %50
%58 = load i8*, i8** %7
%59 = load i64, i64* %11
%60 = trunc i64 %59 to i32
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i8* %58, i32 %60)
%62 = load i32*, i32** %6
%63 = call i32 @fclose(i32* %62)
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 2
%66 = load i8*, i8** %65
store i8* %66, i8** %8
%67 = load i8*, i8** %8
%68 = call i32* @fopen(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %68, i32** %6
%69 = load i32*, i32** %6
%70 = icmp ne i32* %69, null
br i1 %70, label %74, label %71
71: ; preds = %57
%72 = load i8*, i8** %8
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %72)
store i32 1, i32* %13
br label %128
74: ; preds = %57
store i32 0, i32* %9
store i32 0, i32* %12
br label %75
75: ; preds = %93, %74
%76 = load i32, i32* %12
%77 = icmp slt i32 %76, 7
br i1 %77, label %78, label %96
78: ; preds = %75
%79 = load i32*, i32** %10
%80 = load i32, i32* %12
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
%83 = load i32, i32* %82
%84 = load i32, i32* %9
%85 = add i32 %84, %83
store i32 %85, i32* %9
%86 = load i32, i32* %12
%87 = load i32*, i32** %10
%88 = load i32, i32* %12
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i32, i32* %87, i64 %89
%91 = load i32, i32* %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %86, i32 %91)
br label %93
93: ; preds = %78
%94 = load i32, i32* %12
%95 = add nsw i32 %94, 1
store i32 %95, i32* %12
br label %75
96: ; preds = %75
%97 = load i32, i32* %9
%98 = sub i32 -1, %97
%99 = add i32 %98, 1
%100 = load i32*, i32** %10
%101 = getelementptr inbounds i32, i32* %100, i64 7
store i32 %99, i32* %101
%102 = load i32*, i32** %10
%103 = getelementptr inbounds i32, i32* %102, i64 7
%104 = load i32, i32* %103
%105 = load i32, i32* %9
%106 = load i32*, i32** %10
%107 = getelementptr inbounds i32, i32* %106, i64 7
%108 = load i32, i32* %107
%109 = add i32 %105, %108
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %104, i32 %109)
%111 = load i32*, i32** %10
%112 = load i64, i64* %11
%113 = load i32*, i32** %6
%114 = call i64 @fwrite(i32* %111, i32 1, i64 %112, i32* %113)
%115 = load i64, i64* %11
%116 = icmp ne i64 %114, %115
br i1 %116, label %117, label %120
117: ; preds = %96
%118 = load i8*, i8** %8
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i8* %118)
store i32 1, i32* %13
br label %125
120: ; preds = %96
%121 = load i8*, i8** %8
%122 = load i64, i64* %11
%123 = trunc i64 %122 to i32
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0), i8* %121, i32 %123)
br label %125
125: ; preds = %120, %117, %54, %47
%126 = load i32*, i32** %6
%127 = call i32 @fclose(i32* %126)
br label %128
128: ; preds = %125, %71, %36
%129 = load i32*, i32** %10
%130 = call i32 @free(i32* %129)
%131 = load i32, i32* %13
store i32 %131, i32* %3
br label %132
132: ; preds = %128, %26, %16
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@.str = [26 x i8] c"Usage: %s infile outfile\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [23 x i8] c"Error opening file %s\0A\00"
@.str.4 = [23 x i8] c"Error loading file %s\0A\00"
@.str.5 = [71 x i8] c"File %s is too large. The maximum size is limited by FLASH (%d bytes)\0A\00"
@.str.6 = [35 x i8] c"File %s loaded with size %d bytes\0A\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [28 x i8] c"Error creating new file %s\0A\00"
@.str.9 = [17 x i8] c"Word %d: 0x%08x\0A\00"
@.str.10 = [38 x i8] c"Word 7: 0x%08x (cksum total: 0x%08x)\0A\00"
@.str.11 = [27 x i8] c"Error writing new file %s\0A\00"
@.str.12 = [36 x i8] c"File %s created with size %d bytes\0A\00"
@str = [35 x i8] c"Error allocating memory for buffer\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %85
7: ; preds = %2
%8 = tail call i64 @malloc(i32 524288)
%9 = inttoptr i64 %8 to i32*
%10 = icmp eq i64 %8, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %85
13: ; preds = %7
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %15)
br label %82
20: ; preds = %13
%21 = inttoptr i64 %8 to i8*
%22 = tail call i64 @fread(i8* %21, i32 1, i32 524288, i32* %16)
%23 = tail call i64 @ferror(i32* %16)
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %20
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %15)
br label %78
27: ; preds = %20
%28 = tail call i32 @feof(i32* %16)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0), i8* %15, i32 524288)
br label %78
32: ; preds = %27
%33 = trunc i64 %22 to i32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i8* %15, i32 %33)
%35 = tail call i32 @fclose(i32* %16)
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = tail call i32* @fopen(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%39 = icmp eq i32* %38, null
br i1 %39, label %72, label %40
40: ; preds = %32
%41 = load i32, i32* %9
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 0, i32 %41)
%43 = getelementptr inbounds i32, i32* %9, i64 1
%44 = load i32, i32* %43
%45 = add i32 %44, %41
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 1, i32 %44)
%47 = getelementptr inbounds i32, i32* %9, i64 2
%48 = load i32, i32* %47
%49 = add i32 %48, %45
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 2, i32 %48)
%51 = getelementptr inbounds i32, i32* %9, i64 3
%52 = load i32, i32* %51
%53 = add i32 %52, %49
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 3, i32 %52)
%55 = getelementptr inbounds i32, i32* %9, i64 4
%56 = load i32, i32* %55
%57 = add i32 %56, %53
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 4, i32 %56)
%59 = getelementptr inbounds i32, i32* %9, i64 5
%60 = load i32, i32* %59
%61 = add i32 %60, %57
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 5, i32 %60)
%63 = getelementptr inbounds i32, i32* %9, i64 6
%64 = load i32, i32* %63
%65 = add i32 %64, %61
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 6, i32 %64)
%67 = sub i32 0, %65
%68 = getelementptr inbounds i32, i32* %9, i64 7
store i32 %67, i32* %68
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %67, i32 0)
%70 = tail call i64 @fwrite(i32* %9, i32 1, i64 %22, i32* %38)
%71 = icmp eq i64 %70, %22
br i1 %71, label %76, label %74
72: ; preds = %32
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %37)
br label %82
74: ; preds = %40
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i8* %37)
br label %78
76: ; preds = %40
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0), i8* %37, i32 %33)
br label %78
78: ; preds = %76, %74, %30, %25
%79 = phi i32* [ %16, %25 ], [ %38, %74 ], [ %38, %76 ], [ %16, %30 ]
%80 = phi i32 [ 1, %25 ], [ 1, %74 ], [ 0, %76 ], [ 1, %30 ]
%81 = tail call i32 @fclose(i32* %79)
br label %82
82: ; preds = %78, %72, %18
%83 = phi i32 [ %80, %78 ], [ 1, %72 ], [ 1, %18 ]
%84 = tail call i32 @free(i32* %9)
br label %85
85: ; preds = %82, %11, %4
%86 = phi i32 [ 1, %4 ], [ %83, %82 ], [ 1, %11 ]
ret i32 %86
}