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

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Usage: copy infile outfile\n");
    return 1;
  }
  char *rawFile = argv[1];
  FILE *inptr = fopen(rawFile, "r");
  if (inptr == NULL) {
    fprintf(stderr, "Could not open %s.\n", rawFile);
    return 2;
  }
  FILE *outptr = fopen("outfile.jpeg", "w");
  if (outptr == NULL) {
    fclose(inptr);
    fprintf(stderr, "Could not create outfile.jpeg.\n");
    return 3;
  }
  uint8_t dataBuffer[512];
  int dataByte;
  int jpegFound = 0;
  int block = 0;
  int jpegCount = 0;
  while ((dataByte = fgetc(inptr)) != EOF) {
    printf("\n\n");
    fread(dataBuffer, sizeof(uint8_t), 512, inptr);
    for (int i = 0; i < 512; i++) {
      if (((dataBuffer[i] == 0xFF) && (dataBuffer[i + 1] == 0xD8) &&
           (dataBuffer[i + 2] == 0xFF))) {
        if (jpegFound == 1) {
          return 0;
        }
        printf("\n\n\n\n");
        printf("-------------------------> NEW JPEG FOUND\n");
        jpegFound = 1;
        jpegCount++;
      }
      if (jpegFound == 1) {
        printf("%X ", dataBuffer[i]);
        fwrite(&dataBuffer[i], sizeof(uint8_t), 1, outptr);
      }
    }
    block++;
  }
  printf("JPEG COUNT: %i \n", jpegCount);
  fclose(inptr);
  fclose(outptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11b6 <main+0x46>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    141d <main+0x2ad>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1208 <main+0x98>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    141d <main+0x2ad>
lea    0xe23(%rip),%rdi
lea    0xe29(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1256 <main+0xe6>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    141d <main+0x2ad>
movl   $0x0,-0x838(%rbp)
movl   $0x0,-0x83c(%rbp)
movl   $0x0,-0x840(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x834(%rbp)
mov    0x2d5e(%rip),%rcx
cmp    (%rcx),%eax
je     13f0 <main+0x280>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x830(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x4,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
movl   $0x0,-0x844(%rbp)
cmpl   $0x200,-0x844(%rbp)
jge    13dc <main+0x26c>
movslq -0x844(%rbp),%rax
cmpl   $0xff,-0x830(%rbp,%rax,4)
jne    1372 <main+0x202>
mov    -0x844(%rbp),%eax
add    $0x1,%eax
cltq
cmpl   $0xd8,-0x830(%rbp,%rax,4)
jne    1372 <main+0x202>
mov    -0x844(%rbp),%eax
add    $0x2,%eax
cltq
cmpl   $0xff,-0x830(%rbp,%rax,4)
jne    1372 <main+0x202>
cmpl   $0x1,-0x838(%rbp)
jne    133d <main+0x1cd>
movl   $0x0,-0x4(%rbp)
jmp    141d <main+0x2ad>
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x838(%rbp)
mov    -0x840(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x840(%rbp)
cmpl   $0x1,-0x838(%rbp)
jne    13c3 <main+0x253>
movslq -0x844(%rbp),%rax
mov    -0x830(%rbp,%rax,4),%esi
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x844(%rbp),%rax
lea    -0x830(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
jmp    13c8 <main+0x258>
mov    -0x844(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x844(%rbp)
jmp    12c4 <main+0x154>
mov    -0x83c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x83c(%rbp)
jmp    1274 <main+0x104>
mov    -0x840(%rbp),%esi
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
cmp    $0x2,%edi
jne    121d <main+0x9d>
mov    0x8(%rsi),%rbx
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     123b <main+0xbb>
mov    %rax,%rbp
lea    0xe72(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     125c <main+0xdc>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1070 <fgetc@plt>
mov    0x2e01(%rip),%rcx
movl   $0x0,0x4(%rsp)
cmp    (%rcx),%eax
jne    1292 <main+0x112>
lea    0xe67(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    1280 <main+0x100>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
lea    0xdd3(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
jmp    1280 <main+0x100>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
lea    0xdd3(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%eax
jmp    1280 <main+0x100>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
lea    0xdcd(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x3,%eax
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdc8(%rip),%r12
movl   $0x0,0x4(%rsp)
xor    %r14d,%r14d
mov    %rbp,0x8(%rsp)
jmp    12cc <main+0x14c>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <fgetc@plt>
mov    0x2d24(%rip),%rcx
cmp    (%rcx),%eax
je     11f7 <main+0x77>
lea    0xda5(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
mov    $0x200,%edx
mov    %rbp,%rcx
call   1040 <fread@plt>
xor    %ebp,%ebp
jmp    135b <main+0x1db>
cmp    $0x1,%r14d
je     1219 <main+0x99>
lea    0xd72(%rip),%rdi
call   1030 <puts@plt>
lea    0xd6a(%rip),%rdi
call   1030 <puts@plt>
addl   $0x1,0x4(%rsp)
lea    (%rsp,%rbp,1),%r15
add    $0x10,%r15
mov    %r12,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%r14d
mov    %r15,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
add    $0x4,%rbp
cmp    $0x800,%rbp
je     12b0 <main+0x130>
mov    0x10(%rsp,%rbp,1),%r13d
cmp    $0xff,%r13d
jne    1390 <main+0x210>
cmpl   $0xd8,0x14(%rsp,%rbp,1)
jne    1390 <main+0x210>
cmpl   $0xff,0x18(%rsp,%rbp,1)
je     12f3 <main+0x173>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x1,%r14d
je     131a <main+0x19a>
jmp    134a <main+0x1ca>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: copy infile outfile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [20 x i8] c"Could not open %s.\0A\00"
@.str.3 = [13 x i8] c"outfile.jpeg\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [32 x i8] c"Could not create outfile.jpeg.\0A\00"
@EOF = global i32 0
@.str.6 = [3 x i8] c"\0A\0A\00"
@.str.7 = [5 x i8] c"\0A\0A\0A\0A\00"
@.str.8 = [43 x i8] c"-------------------------> NEW JPEG FOUND\0A\00"
@.str.9 = [4 x i8] c"%X \00"
@.str.10 = [17 x i8] c"JPEG COUNT: %i \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [512 x 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, 2
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %112
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %7
%26 = load i32*, i32** %7
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %20
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %6
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %30)
store i32 2, i32* %3
br label %112
32: ; preds = %20
%33 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %33, i32** %8
%34 = load i32*, i32** %8
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = load i32*, i32** %7
%38 = call i32 @fclose(i32* %37)
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
store i32 3, i32* %3
br label %112
41: ; preds = %32
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
br label %42
42: ; preds = %102, %41
%43 = load i32*, i32** %7
%44 = call i32 @fgetc(i32* %43)
store i32 %44, i32* %10
%45 = load i32, i32* @EOF
%46 = icmp ne i32 %44, %45
br i1 %46, label %47, label %105
47: ; preds = %42
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%49 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 0
%50 = load i32*, i32** %7
%51 = call i32 @fread(i32* %49, i32 4, i32 512, i32* %50)
store i32 0, i32* %14
br label %52
52: ; preds = %99, %47
%53 = load i32, i32* %14
%54 = icmp slt i32 %53, 512
br i1 %54, label %55, label %102
55: ; preds = %52
%56 = load i32, i32* %14
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = icmp eq i32 %59, 255
br i1 %60, label %61, label %84
61: ; preds = %55
%62 = load i32, i32* %14
%63 = add nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = icmp eq i32 %66, 216
br i1 %67, label %68, label %84
68: ; preds = %61
%69 = load i32, i32* %14
%70 = add nsw i32 %69, 2
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = icmp eq i32 %73, 255
br i1 %74, label %75, label %84
75: ; preds = %68
%76 = load i32, i32* %11
%77 = icmp eq i32 %76, 1
br i1 %77, label %78, label %79
78: ; preds = %75
store i32 0, i32* %3
br label %112
79: ; preds = %75
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %11
%82 = load i32, i32* %13
%83 = add nsw i32 %82, 1
store i32 %83, i32* %13
br label %84
84: ; preds = %79, %68, %61, %55
%85 = load i32, i32* %11
%86 = icmp eq i32 %85, 1
br i1 %86, label %87, label %98
87: ; preds = %84
%88 = load i32, i32* %14
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %91)
%93 = load i32, i32* %14
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [512 x i32], [512 x i32]* %9, i64 0, i64 %94
%96 = load i32*, i32** %8
%97 = call i32 @fwrite(i32* %95, i32 4, i32 1, i32* %96)
br label %98
98: ; preds = %87, %84
br label %99
99: ; preds = %98
%100 = load i32, i32* %14
%101 = add nsw i32 %100, 1
store i32 %101, i32* %14
br label %52
102: ; preds = %52
%103 = load i32, i32* %12
%104 = add nsw i32 %103, 1
store i32 %104, i32* %12
br label %42
105: ; preds = %42
%106 = load i32, i32* %13
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %106)
%108 = load i32*, i32** %7
%109 = call i32 @fclose(i32* %108)
%110 = load i32*, i32** %8
%111 = call i32 @fclose(i32* %110)
store i32 0, i32* %3
br label %112
112: ; preds = %105, %78, %36, %28, %17
%113 = load i32, i32* %3
ret i32 %113
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: copy infile outfile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [20 x i8] c"Could not open %s.\0A\00"
@.str.3 = [13 x i8] c"outfile.jpeg\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [32 x i8] c"Could not create outfile.jpeg.\0A\00"
@EOF = global i32 0
@.str.9 = [4 x i8] c"%X \00"
@.str.10 = [17 x i8] c"JPEG COUNT: %i \0A\00"
@str = [2 x i8] c"\0A\00"
@str.11 = [4 x i8] c"\0A\0A\0A\00"
@str.12 = [42 x i8] c"-------------------------> NEW JPEG FOUND\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i32]
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %79
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %79
16: ; preds = %8
%17 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = tail call i32 @fclose(i32* %11)
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %79
23: ; preds = %16
%24 = bitcast [512 x i32]* %3 to i8*
%25 = tail call i32 @fgetc(i32* %11)
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %73, label %28
28: ; preds = %23
%29 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 0
br label %34
30: ; preds = %68
%31 = tail call i32 @fgetc(i32* %11)
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %73, label %34
34: ; preds = %28, %30
%35 = phi i32 [ 0, %28 ], [ %69, %30 ]
%36 = phi i32 [ 0, %28 ], [ %70, %30 ]
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%38 = call i32 @fread(i32* %29, i32 4, i32 512, i32* %11)
br label %39
39: ; preds = %34, %68
%40 = phi i64 [ 0, %34 ], [ %71, %68 ]
%41 = phi i32 [ %35, %34 ], [ %69, %68 ]
%42 = phi i32 [ %36, %34 ], [ %70, %68 ]
%43 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %40
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 255
br i1 %45, label %46, label %62
46: ; preds = %39
%47 = add nuw nsw i64 %40, 1
%48 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 216
br i1 %50, label %51, label %62
51: ; preds = %46
%52 = add nuw nsw i64 %40, 2
%53 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = icmp eq i32 %54, 255
br i1 %55, label %56, label %62
56: ; preds = %51
%57 = icmp eq i32 %42, 1
br i1 %57, label %78, label %58
58: ; preds = %56
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.12, i64 0, i64 0))
%61 = add nsw i32 %41, 1
br label %64
62: ; preds = %51, %46, %39
%63 = icmp eq i32 %42, 1
br i1 %63, label %64, label %68
64: ; preds = %58, %62
%65 = phi i32 [ %61, %58 ], [ %41, %62 ]
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %44)
%67 = call i32 @fwrite(i32* %43, i32 4, i32 1, i32* %17)
br label %68
68: ; preds = %62, %64
%69 = phi i32 [ %41, %62 ], [ %65, %64 ]
%70 = phi i32 [ %42, %62 ], [ 1, %64 ]
%71 = add nuw nsw i64 %40, 1
%72 = icmp eq i64 %71, 512
br i1 %72, label %30, label %39
73: ; preds = %30, %23
%74 = phi i32 [ 0, %23 ], [ %69, %30 ]
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %74)
%76 = tail call i32 @fclose(i32* %11)
%77 = tail call i32 @fclose(i32* %17)
br label %78
78: ; preds = %56, %73
br label %79
79: ; preds = %13, %78, %19, %5
%80 = phi i32 [ 1, %5 ], [ 2, %13 ], [ 3, %19 ], [ 0, %78 ]
ret i32 %80
}