#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*/ exit(int /*<<< orphan*/);
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*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int i, k, wc, rc;
  unsigned char bc[4] = {0};
  unsigned char buf[65536];
  char *progname = argv[0];
  char *ppos, oname[256];
  FILE *ifile, *ofile;
  if (argc < 2) {
    fprintf(stderr, "Usage:  %s image.tap {file1 ...}\n", progname);
    fprintf(stderr, "Extract records from image.tap to file1, file2, ....\n");
    exit(0);
  }
  ifile = fopen(argv[1], "rb");
  if (ifile == NULL) {
    printf("Error opening file: %s\n", argv[1]);
    exit(0);
  }
  for (i = 2; i < argc; i++) {
    ofile = fopen(argv[i], "wb");
    if (ofile == NULL) {
      printf("Error opening file: %s\n", argv[i]);
      exit(0);
    }
    printf("Processing file %s ... ", argv[i]);
    rc = 0;
    for (;;) {
      k = fread(bc, sizeof(char), 4, ifile);
      if (k == 0) {
        break;
      }
      if (bc[2] | bc[3]) {
        printf("Invalid record size, record %d, size = 0x%02X%02X%02X%02X\n",
               rc, bc[3], bc[2], bc[1], bc[0]);
        break;
      }
      wc = ((unsigned int)bc[1] << 8) | (unsigned int)bc[0];
      wc = (wc + 1) & ~1;
      if (wc) {
        k = fread(buf, sizeof(char), wc, ifile);
        for (; k < wc; k++)
          buf[k] = 0;
        fwrite(buf, sizeof(char), wc, ofile);
        k = fread(bc, sizeof(char), 4, ifile);
        rc++;
      } else {
        if (rc)
          printf("end of file, record count = %d\n", rc);
        else {
          break;
        }
        rc = 0;
      }
    }
    fclose(ofile);
  }
  fclose(ifile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x24(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10038(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11fd <main+0x7d>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    -0x10038(%rbp),%rdx
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4c(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10148(%rbp)
cmpq   $0x0,-0x10148(%rbp)
jne    1243 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1427 <main+0x2a7>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10150(%rbp)
cmpq   $0x0,-0x10150(%rbp)
jne    12a4 <main+0x124>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x20(%rbp)
lea    -0x24(%rbp),%rdi
mov    -0x10148(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    12f1 <main+0x171>
jmp    140d <main+0x28d>
movzbl -0x22(%rbp),%eax
movzbl -0x21(%rbp),%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     132c <main+0x1ac>
mov    -0x20(%rbp),%esi
movzbl -0x21(%rbp),%edx
movzbl -0x22(%rbp),%ecx
movzbl -0x23(%rbp),%r8d
movzbl -0x24(%rbp),%r9d
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140d <main+0x28d>
movzbl -0x23(%rbp),%eax
shl    $0x8,%eax
movzbl -0x24(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
and    $0xfffffffe,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     13dc <main+0x25c>
lea    -0x10030(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x10148(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1396 <main+0x216>
movslq -0x18(%rbp),%rax
movb   $0x0,-0x10030(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1370 <main+0x1f0>
lea    -0x10030(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x10150(%rbp),%rcx
mov    $0x1,%esi
call   10a0 <fwrite@plt>
lea    -0x24(%rbp),%rdi
mov    -0x10148(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1408 <main+0x288>
cmpl   $0x0,-0x20(%rbp)
je     13fc <main+0x27c>
mov    -0x20(%rbp),%esi
lea    0xcd9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1401 <main+0x281>
jmp    140d <main+0x28d>
movl   $0x0,-0x20(%rbp)
jmp    12c5 <main+0x145>
mov    -0x10150(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124a <main+0xca>
mov    -0x10148(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x10150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10028,%rsp
movl   $0x0,0xc(%rsp)
cmp    $0x1,%edi
jle    137b <main+0x1fb>
mov    %edi,%ebp
mov    %rsi,0x10(%rsp)
mov    0x8(%rsi),%rdi
lea    0xea4(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13ac <main+0x22c>
mov    %rax,%rbx
cmp    $0x3,%ebp
jb     135f <main+0x1df>
mov    %ebp,%eax
mov    %rax,0x18(%rsp)
mov    $0x2,%r15d
lea    0xc(%rsp),%r13
jmp    1223 <main+0xa3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0xd(%rsp),%r8d
movzbl 0xc(%rsp),%r9d
lea    0xe8b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
add    $0x1,%r15
cmp    0x18(%rsp),%r15
je     135f <main+0x1df>
mov    0x10(%rsp),%rbp
mov    0x0(%rbp,%r15,8),%rdi
lea    0xe3f(%rip),%rsi
call   1080 <fopen@plt>
mov    0x0(%rbp,%r15,8),%rsi
test   %rax,%rax
je     13b5 <main+0x235>
mov    %rax,%r12
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
test   %eax,%eax
je     120c <main+0x8c>
xor    %ebp,%ebp
jmp    12ca <main+0x14a>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %r12,%rcx
call   10a0 <fwrite@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
add    $0x1,%ebp
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
test   %eax,%eax
je     120c <main+0x8c>
movzbl 0xe(%rsp),%ecx
movzbl 0xf(%rsp),%edx
mov    %edx,%eax
or     %ecx,%eax
jne    11f0 <main+0x70>
movzwl 0xc(%rsp),%r14d
add    $0x1,%r14d
and    $0x1fffe,%r14d
je     1340 <main+0x1c0>
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmp    %r14d,%eax
jge    1280 <main+0x100>
movslq %eax,%rcx
lea    (%rsp,%rcx,1),%rdi
add    $0x20,%rdi
not    %eax
add    %r14d,%eax
add    $0x1,%rax
xor    %esi,%esi
mov    %rax,%rdx
call   1060 <memset@plt>
jmp    1280 <main+0x100>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %ebp,%ebp
je     120c <main+0x8c>
lea    0xd7a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %ebp,%ebp
jmp    12ad <main+0x12d>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x10028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rsi),%rdx
mov    0x2c5b(%rip),%rbx
mov    (%rbx),%edi
lea    0xc72(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%edi
lea    0xc84(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rax),%rsi
lea    0xc9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: %s image.tap {file1 ...}\0A\00"
@.str.1 = [54 x i8] c"Extract records from image.tap to file1, file2, ....\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [24 x i8] c"Error opening file: %s\0A\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [24 x i8] c"Processing file %s ... \00"
@.str.6 = [59 x i8] c"Invalid record size, record %d, size = 0x%02X%02X%02X%02X\0A\00"
@.str.7 = [32 x i8] c"end of file, record count = %d\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 i32
%9 = alloca i32
%10 = alloca [4 x i8]
%11 = alloca [65536 x i8]
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca [256 x i8]
%15 = alloca i32*
%16 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [4 x i8]* %10 to i8*
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
store i8* %20, i8** %12
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 2
br i1 %22, label %23, label %30
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %12
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @exit(i32 0)
unreachable
30: ; preds = %2
%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** %15
%35 = load i32*, i32** %15
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %43
37: ; preds = %30
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %30
store i32 2, i32* %6
br label %44
44: ; preds = %155, %43
%45 = load i32, i32* %6
%46 = load i32, i32* %4
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %158
48: ; preds = %44
%49 = load i8**, i8*** %5
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i32* @fopen(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %54, i32** %16
%55 = load i32*, i32** %16
%56 = icmp eq i32* %55, null
br i1 %56, label %57, label %65
57: ; preds = %48
%58 = load i8**, i8*** %5
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %62)
%64 = call i32 @exit(i32 0)
unreachable
65: ; preds = %48
%66 = load i8**, i8*** %5
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %70)
store i32 0, i32* %9
br label %72
72: ; preds = %151, %65
%73 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%74 = load i32*, i32** %15
%75 = call i32 @fread(i8* %73, i32 1, i32 4, i32* %74)
store i32 %75, i32* %7
%76 = load i32, i32* %7
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %72
br label %152
79: ; preds = %72
%80 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 2
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 3
%84 = load i8, i8* %83
%85 = zext i8 %84 to i32
%86 = or i32 %82, %85
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %103
88: ; preds = %79
%89 = load i32, i32* %9
%90 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 3
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 2
%94 = load i8, i8* %93
%95 = zext i8 %94 to i32
%96 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 1
%97 = load i8, i8* %96
%98 = zext i8 %97 to i32
%99 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%100 = load i8, i8* %99
%101 = zext i8 %100 to i32
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i32 %89, i32 %92, i32 %95, i32 %98, i32 %101)
br label %152
103: ; preds = %79
%104 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 1
%105 = load i8, i8* %104
%106 = zext i8 %105 to i32
%107 = shl i32 %106, 8
%108 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%109 = load i8, i8* %108
%110 = zext i8 %109 to i32
%111 = or i32 %107, %110
store i32 %111, i32* %8
%112 = load i32, i32* %8
%113 = add nsw i32 %112, 1
%114 = and i32 %113, -2
store i32 %114, i32* %8
%115 = load i32, i32* %8
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %143
117: ; preds = %103
%118 = getelementptr inbounds [65536 x i8], [65536 x i8]* %11, i64 0, i64 0
%119 = load i32, i32* %8
%120 = load i32*, i32** %15
%121 = call i32 @fread(i8* %118, i32 1, i32 %119, i32* %120)
store i32 %121, i32* %7
br label %122
122: ; preds = %130, %117
%123 = load i32, i32* %7
%124 = load i32, i32* %8
%125 = icmp slt i32 %123, %124
br i1 %125, label %126, label %133
126: ; preds = %122
%127 = load i32, i32* %7
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [65536 x i8], [65536 x i8]* %11, i64 0, i64 %128
store i8 0, i8* %129
br label %130
130: ; preds = %126
%131 = load i32, i32* %7
%132 = add nsw i32 %131, 1
store i32 %132, i32* %7
br label %122
133: ; preds = %122
%134 = getelementptr inbounds [65536 x i8], [65536 x i8]* %11, i64 0, i64 0
%135 = load i32, i32* %8
%136 = load i32*, i32** %16
%137 = call i32 @fwrite(i8* %134, i32 1, i32 %135, i32* %136)
%138 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%139 = load i32*, i32** %15
%140 = call i32 @fread(i8* %138, i32 1, i32 4, i32* %139)
store i32 %140, i32* %7
%141 = load i32, i32* %9
%142 = add nsw i32 %141, 1
store i32 %142, i32* %9
br label %151
143: ; preds = %103
%144 = load i32, i32* %9
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %149
146: ; preds = %143
%147 = load i32, i32* %9
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %147)
br label %150
149: ; preds = %143
br label %152
150: ; preds = %146
store i32 0, i32* %9
br label %151
151: ; preds = %150, %133
br label %72
152: ; preds = %149, %88, %78
%153 = load i32*, i32** %16
%154 = call i32 @fclose(i32* %153)
br label %155
155: ; preds = %152
%156 = load i32, i32* %6
%157 = add nsw i32 %156, 1
store i32 %157, i32* %6
br label %44
158: ; preds = %44
%159 = load i32*, i32** %15
%160 = call i32 @fclose(i32* %159)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: %s image.tap {file1 ...}\0A\00"
@.str.1 = [54 x i8] c"Extract records from image.tap to file1, file2, ....\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [24 x i8] c"Error opening file: %s\0A\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [24 x i8] c"Processing file %s ... \00"
@.str.6 = [59 x i8] c"Invalid record size, record %d, size = 0x%02X%02X%02X%02X\0A\00"
@.str.7 = [32 x i8] c"end of file, record count = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to [4 x i8]*
%5 = alloca [65536 x i8]
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 0
%8 = icmp slt i32 %0, 2
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %10)
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @exit(i32 0)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %28, label %21
21: ; preds = %16
%22 = icmp ugt i32 %0, 2
br i1 %22, label %23, label %96
23: ; preds = %21
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
%27 = zext i32 %0 to i64
br label %32
28: ; preds = %16
%29 = load i8*, i8** %17
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %29)
%31 = tail call i32 @exit(i32 0)
unreachable
32: ; preds = %23, %92
%33 = phi i64 [ 2, %23 ], [ %94, %92 ]
%34 = getelementptr inbounds i8*, i8** %1, i64 %33
%35 = load i8*, i8** %34
%36 = tail call i32* @fopen(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i32* %36, null
%38 = load i8*, i8** %34
br i1 %37, label %39, label %42
39: ; preds = %32
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %38)
%41 = tail call i32 @exit(i32 0)
unreachable
42: ; preds = %32
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %38)
%44 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %19)
%45 = icmp eq i32 %44, 0
br i1 %45, label %92, label %46
46: ; preds = %42, %88
%47 = phi i32 [ %89, %88 ], [ 0, %42 ]
%48 = load i8, i8* %24
%49 = load i8, i8* %25
%50 = or i8 %49, %48
%51 = icmp eq i8 %50, 0
br i1 %51, label %60, label %52
52: ; preds = %46
%53 = zext i8 %49 to i32
%54 = zext i8 %48 to i32
%55 = load i8, i8* %26
%56 = zext i8 %55 to i32
%57 = load i8, i8* %6
%58 = zext i8 %57 to i32
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i32 %47, i32 %53, i32 %54, i32 %56, i32 %58)
br label %92
60: ; preds = %46
%61 = load i8, i8* %26
%62 = zext i8 %61 to i32
%63 = shl nuw nsw i32 %62, 8
%64 = load i8, i8* %6
%65 = zext i8 %64 to i32
%66 = or i32 %63, %65
%67 = add nuw nsw i32 %66, 1
%68 = and i32 %67, 131070
%69 = icmp eq i32 %68, 0
br i1 %69, label %84, label %70
70: ; preds = %60
%71 = call i32 @fread(i8* %7, i32 1, i32 %68, i32* %19)
%72 = icmp slt i32 %71, %68
br i1 %72, label %73, label %80
73: ; preds = %70
%74 = sext i32 %71 to i64
%75 = getelementptr [65536 x i8], [65536 x i8]* %5, i64 0, i64 %74
%76 = xor i32 %71, -1
%77 = add i32 %68, %76
%78 = zext i32 %77 to i64
%79 = add nuw nsw i64 %78, 1
br label %80
80: ; preds = %73, %70
%81 = call i32 @fwrite(i8* %7, i32 1, i32 %68, i32* %36)
%82 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %19)
%83 = add nsw i32 %47, 1
br label %88
84: ; preds = %60
%85 = icmp eq i32 %47, 0
br i1 %85, label %92, label %86
86: ; preds = %84
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %47)
br label %88
88: ; preds = %86, %80
%89 = phi i32 [ %83, %80 ], [ 0, %86 ]
%90 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %19)
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %46
92: ; preds = %88, %84, %42, %52
%93 = tail call i32 @fclose(i32* %36)
%94 = add nuw nsw i64 %33, 1
%95 = icmp eq i64 %94, %27
br i1 %95, label %96, label %32
96: ; preds = %92, %21
%97 = tail call i32 @fclose(i32* %19)
ret i32 0
}