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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
scalar_t__ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fix_header(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, size_t, int, int /*<<< orphan*/ *);
int getopt(int, char **, char *);
char *optarg;
int optind;
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  char buf[1024];
  FILE *in = stdin, *out = stdout;
  char *ifn = NULL, *ofn = NULL;
  size_t n;
  int c, first_block = 1;
  while ((c = getopt(argc, argv, "i:o:h")) != -1) {
    switch (c) {
    case 'i':
      ifn = optarg;
      break;
    case 'o':
      ofn = optarg;
      break;
    case 'h':
    default:
      usage();
    }
  }
  if (optind != argc || optind == 1) {
    fprintf(stderr, "illegal arg \"%s\"\n", argv[optind]);
    usage();
  }
  if (ifn && !(in = fopen(ifn, "r"))) {
    fprintf(stderr, "can not open \"%s\" for reading\n", ifn);
    usage();
  }
  if (ofn && !(out = fopen(ofn, "w"))) {
    fprintf(stderr, "can not open \"%s\" for writing\n", ofn);
    usage();
  }
  while ((n = fread(buf, 1, sizeof(buf), in)) > 0) {
    if (n < sizeof(buf)) {
      if (ferror(in)) {
      FREAD_ERROR:
        fprintf(stderr, "fread error\n");
        return EXIT_FAILURE;
      }
    }
    if (first_block && n >= 256) {
      fix_header(buf);
      first_block = 0;
    }
    if (!fwrite(buf, n, 1, out)) {
    FWRITE_ERROR:
      fprintf(stderr, "fwrite error\n");
      return EXIT_FAILURE;
    }
  }
  if (ferror(in)) {
    goto FREAD_ERROR;
  }
  if (fflush(out)) {
    goto FWRITE_ERROR;
  }
  fclose(in);
  fclose(out);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e20(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x418(%rbp)
mov    0x2de7(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x420(%rbp)
movq   $0x0,-0x428(%rbp)
movq   $0x0,-0x430(%rbp)
movl   $0x1,-0x440(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdf7(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x43c(%rbp)
cmp    $0xffffffff,%eax
je     129c <main+0xfc>
mov    -0x43c(%rbp),%eax
mov    %eax,-0x444(%rbp)
sub    $0x68,%eax
je     128b <main+0xeb>
jmp    1237 <main+0x97>
mov    -0x444(%rbp),%eax
sub    $0x69,%eax
je     125f <main+0xbf>
jmp    124b <main+0xab>
mov    -0x444(%rbp),%eax
sub    $0x6f,%eax
je     1275 <main+0xd5>
jmp    1290 <main+0xf0>
mov    0x2d92(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x428(%rbp)
jmp    1297 <main+0xf7>
mov    0x2d7c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x430(%rbp)
jmp    1297 <main+0xf7>
jmp    1290 <main+0xf0>
mov    $0x0,%al
call   1090 <usage@plt>
jmp    11fb <main+0x5b>
mov    0x2d35(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    12be <main+0x11e>
mov    0x2d23(%rip),%rax
cmpl   $0x1,(%rax)
jne    12ee <main+0x14e>
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x2d06(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd26(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1090 <usage@plt>
cmpq   $0x0,-0x428(%rbp)
je     1345 <main+0x1a5>
mov    -0x428(%rbp),%rdi
lea    0xd0e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
jne    1345 <main+0x1a5>
mov    0x2ca1(%rip),%rax
mov    (%rax),%edi
mov    -0x428(%rbp),%rdx
lea    0xce3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1090 <usage@plt>
cmpq   $0x0,-0x430(%rbp)
je     139c <main+0x1fc>
mov    -0x430(%rbp),%rdi
lea    0xcd8(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x420(%rbp)
cmp    $0x0,%rax
jne    139c <main+0x1fc>
mov    0x2c4a(%rip),%rax
mov    (%rax),%edi
mov    -0x430(%rbp),%rdx
lea    0xcad(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1090 <usage@plt>
jmp    13a1 <main+0x201>
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1040 <fread@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
jbe    14b6 <main+0x316>
cmpq   $0x400,-0x438(%rbp)
jae    1428 <main+0x288>
mov    -0x418(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1423 <main+0x283>
jmp    13fb <main+0x25b>
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
lea    0xc4f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2ba7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1510 <main+0x370>
jmp    1428 <main+0x288>
cmpl   $0x0,-0x440(%rbp)
je     145c <main+0x2bc>
cmpq   $0x100,-0x438(%rbp)
jb     145c <main+0x2bc>
lea    -0x410(%rbp),%rdi
call   1060 <fix_header@plt>
movl   $0x0,-0x440(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x438(%rbp),%rsi
mov    -0x420(%rbp),%rcx
mov    $0x1,%edx
call   10c0 <fwrite@plt>
cmp    $0x0,%eax
jne    14b1 <main+0x311>
jmp    1489 <main+0x2e9>
mov    0x2b38(%rip),%rax
mov    (%rax),%edi
lea    0xbce(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2b19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1510 <main+0x370>
jmp    13a1 <main+0x201>
mov    -0x418(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     14d1 <main+0x331>
jmp    13fb <main+0x25b>
mov    -0x420(%rbp),%rdi
call   1080 <fflush@plt>
cmp    $0x0,%rax
je     14ec <main+0x34c>
jmp    1489 <main+0x2e9>
mov    -0x418(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x420(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2aa5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e23(%rip),%rax
mov    (%rax),%r13
mov    0x2df1(%rip),%rax
mov    (%rax),%r14
lea    0xe2f(%rip),%r15
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   10b0 <getopt@plt>
cmp    $0xffffffff,%eax
je     122c <main+0x8c>
cmp    $0x6f,%eax
je     1220 <main+0x80>
cmp    $0x69,%eax
je     1205 <main+0x65>
xor    %eax,%eax
call   1090 <usage@plt>
jmp    11e0 <main+0x40>
mov    0x2dec(%rip),%rax
mov    (%rax),%r12
jmp    11e0 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2dd1(%rip),%rax
mov    (%rax),%rax
jmp    11d6 <main+0x36>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
cmp    %ebp,%eax
jne    123e <main+0x9e>
cmp    $0x1,%eax
jne    1262 <main+0xc2>
cltq
mov    0x2d81(%rip),%rcx
mov    (%rcx),%edi
mov    (%rbx,%rax,8),%rdx
lea    0xdb2(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1090 <usage@plt>
test   %r12,%r12
je     12a2 <main+0x102>
lea    0xdaa(%rip),%rsi
mov    %r12,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    12a2 <main+0x102>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
lea    0xd8c(%rip),%rsi
xor    %r13d,%r13d
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1090 <usage@plt>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     12e7 <main+0x147>
lea    0xd86(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    12e7 <main+0x147>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
lea    0xd68(%rip),%rsi
xor    %r14d,%r14d
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1090 <usage@plt>
mov    $0x1,%ebx
lea    0x10(%rsp),%r15
jmp    1317 <main+0x177>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
test   %eax,%eax
je     138e <main+0x1ee>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r13,%rcx
call   1040 <fread@plt>
test   %rax,%rax
je     1362 <main+0x1c2>
mov    %rax,%rbp
cmp    $0x3ff,%rax
ja     1349 <main+0x1a9>
mov    %r13,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    136f <main+0x1cf>
test   %ebx,%ebx
je     1300 <main+0x160>
cmp    $0x100,%rbp
jb     1300 <main+0x160>
mov    %r15,%rdi
call   1060 <fix_header@plt>
xor    %ebx,%ebx
jmp    1300 <main+0x160>
mov    %r13,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
je     1381 <main+0x1e1>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
lea    0xcdb(%rip),%rsi
jmp    139e <main+0x1fe>
mov    %r14,%rdi
call   1080 <fflush@plt>
test   %rax,%rax
je     13c0 <main+0x220>
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
lea    0xcc9(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2c14(%rip),%rax
mov    (%rax),%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x2bd9(%rip),%rax
jmp    13ac <main+0x20c>

LLVM IR (-O0):
@stdin = global i32* null
@stdout = global i32* null
@.str = [6 x i8] c"i:o:h\00"
@optarg = global i8* null
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [18 x i8] c"illegal arg \22%s\22\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"can not open \22%s\22 for reading\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [31 x i8] c"can not open \22%s\22 for writing\0A\00"
@.str.6 = [13 x i8] c"fread error\0A\00"
@EXIT_FAILURE = global i32 0
@.str.7 = [14 x i8] c"fwrite error\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32*, i32** @stdin
store i32* %14, i32** %7
%15 = load i32*, i32** @stdout
store i32* %15, i32** %8
store i8* null, i8** %9
store i8* null, i8** %10
store i32 1, i32* %13
br label %16
16: ; preds = %30, %2
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
%19 = call i32 @getopt(i32 %17, i8** %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %19, i32* %12
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %31
21: ; preds = %16
%22 = load i32, i32* %12
switch i32 %22, label %28 [
i32 105, label %23
i32 111, label %25
i32 104, label %27
]
23: ; preds = %21
%24 = load i8*, i8** @optarg
store i8* %24, i8** %9
br label %30
25: ; preds = %21
%26 = load i8*, i8** @optarg
store i8* %26, i8** %10
br label %30
27: ; preds = %21
br label %28
28: ; preds = %21, %27
%29 = call i32 (...) @usage()
br label %30
30: ; preds = %28, %25, %23
br label %16
31: ; preds = %16
%32 = load i32, i32* @optind
%33 = load i32, i32* %4
%34 = icmp ne i32 %32, %33
br i1 %34, label %38, label %35
35: ; preds = %31
%36 = load i32, i32* @optind
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %47
38: ; preds = %35, %31
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %5
%41 = load i32, i32* @optind
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %44)
%46 = call i32 (...) @usage()
br label %47
47: ; preds = %38, %35
%48 = load i8*, i8** %9
%49 = icmp ne i8* %48, null
br i1 %49, label %50, label %59
50: ; preds = %47
%51 = load i8*, i8** %9
%52 = call i32* @fopen(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %52, i32** %7
%53 = icmp ne i32* %52, null
br i1 %53, label %59, label %54
54: ; preds = %50
%55 = load i32, i32* @stderr
%56 = load i8*, i8** %9
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = call i32 (...) @usage()
br label %59
59: ; preds = %54, %50, %47
%60 = load i8*, i8** %10
%61 = icmp ne i8* %60, null
br i1 %61, label %62, label %71
62: ; preds = %59
%63 = load i8*, i8** %10
%64 = call i32* @fopen(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %64, i32** %8
%65 = icmp ne i32* %64, null
br i1 %65, label %71, label %66
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = load i8*, i8** %10
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %68)
%70 = call i32 (...) @usage()
br label %71
71: ; preds = %66, %62, %59
br label %72
72: ; preds = %110, %71
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%74 = load i32*, i32** %7
%75 = call i64 @fread(i8* %73, i32 1, i32 1024, i32* %74)
store i64 %75, i64* %11
%76 = icmp ugt i64 %75, 0
br i1 %76, label %77, label %111
77: ; preds = %72
%78 = load i64, i64* %11
%79 = icmp ult i64 %78, 1024
br i1 %79, label %80, label %90
80: ; preds = %77
%81 = load i32*, i32** %7
%82 = call i64 @ferror(i32* %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %89
84: ; preds = %80
br label %85
85: ; preds = %115, %84
%86 = load i32, i32* @stderr
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%88 = load i32, i32* @EXIT_FAILURE
store i32 %88, i32* %3
br label %127
89: ; preds = %80
br label %90
90: ; preds = %89, %77
%91 = load i32, i32* %13
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %99
93: ; preds = %90
%94 = load i64, i64* %11
%95 = icmp uge i64 %94, 256
br i1 %95, label %96, label %99
96: ; preds = %93
%97 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%98 = call i32 @fix_header(i8* %97)
store i32 0, i32* %13
br label %99
99: ; preds = %96, %93, %90
%100 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%101 = load i64, i64* %11
%102 = load i32*, i32** %8
%103 = call i32 @fwrite(i8* %100, i64 %101, i32 1, i32* %102)
%104 = icmp ne i32 %103, 0
br i1 %104, label %110, label %105
105: ; preds = %99
br label %106
106: ; preds = %120, %105
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%109 = load i32, i32* @EXIT_FAILURE
store i32 %109, i32* %3
br label %127
110: ; preds = %99
br label %72
111: ; preds = %72
%112 = load i32*, i32** %7
%113 = call i64 @ferror(i32* %112)
%114 = icmp ne i64 %113, 0
br i1 %114, label %115, label %116
115: ; preds = %111
br label %85
116: ; preds = %111
%117 = load i32*, i32** %8
%118 = call i64 @fflush(i32* %117)
%119 = icmp ne i64 %118, 0
br i1 %119, label %120, label %121
120: ; preds = %116
br label %106
121: ; preds = %116
%122 = load i32*, i32** %7
%123 = call i32 @fclose(i32* %122)
%124 = load i32*, i32** %8
%125 = call i32 @fclose(i32* %124)
%126 = load i32, i32* @EXIT_SUCCESS
store i32 %126, i32* %3
br label %127
127: ; preds = %121, %106, %85
%128 = load i32, i32* %3
ret i32 %128
}

LLVM IR (-O2):
@stdin = global i32* null
@stdout = global i32* null
@.str = [6 x i8] c"i:o:h\00"
@optarg = global i8* null
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [18 x i8] c"illegal arg \22%s\22\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"can not open \22%s\22 for reading\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [31 x i8] c"can not open \22%s\22 for writing\0A\00"
@.str.6 = [13 x i8] c"fread error\0A\00"
@EXIT_FAILURE = global i32 0
@.str.7 = [14 x i8] c"fwrite error\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i32*, i32** @stdin
%6 = load i32*, i32** @stdout
br label %7
7: ; preds = %14, %2
%8 = phi i8* [ %15, %14 ], [ null, %2 ]
%9 = phi i8* [ %11, %14 ], [ null, %2 ]
br label %10
10: ; preds = %7, %16
%11 = phi i8* [ %9, %7 ], [ %17, %16 ]
br label %12
12: ; preds = %10, %18
%13 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %13, label %18 [
i32 -1, label %20
i32 105, label %14
i32 111, label %16
]
14: ; preds = %12
%15 = load i8*, i8** @optarg
br label %7
16: ; preds = %12
%17 = load i8*, i8** @optarg
br label %10
18: ; preds = %12
%19 = tail call i32 (...) @usage()
br label %12
20: ; preds = %12
%21 = load i32, i32* @optind
%22 = icmp ne i32 %21, %0
%23 = icmp eq i32 %21, 1
%24 = or i1 %22, %23
br i1 %24, label %25, label %32
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = sext i32 %21 to i64
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = tail call i32 (...) @usage()
br label %32
32: ; preds = %20, %25
%33 = icmp eq i8* %8, null
br i1 %33, label %41, label %34
34: ; preds = %32
%35 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%40 = tail call i32 (...) @usage()
br label %41
41: ; preds = %37, %34, %32
%42 = phi i32* [ %35, %34 ], [ null, %37 ], [ %5, %32 ]
%43 = icmp eq i8* %11, null
br i1 %43, label %51, label %44
44: ; preds = %41
%45 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = load i32, i32* @stderr
%49 = tail call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%50 = tail call i32 (...) @usage()
br label %51
51: ; preds = %47, %44, %41
%52 = phi i32* [ %45, %44 ], [ null, %47 ], [ %6, %41 ]
br label %53
53: ; preds = %71, %51
%54 = phi i32 [ 1, %51 ], [ %72, %71 ]
%55 = call i64 @fread(i8* %4, i32 1, i32 1024, i32* %42)
%56 = icmp eq i64 %55, 0
br i1 %56, label %78, label %57
57: ; preds = %53
%58 = icmp ult i64 %55, 1024
br i1 %58, label %59, label %65
59: ; preds = %57
%60 = call i64 @ferror(i32* %42)
%61 = icmp eq i64 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %59, %78
%63 = load i32, i32* @stderr
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %87
65: ; preds = %59, %57
%66 = icmp ne i32 %54, 0
%67 = icmp ugt i64 %55, 255
%68 = and i1 %66, %67
br i1 %68, label %69, label %71
69: ; preds = %65
%70 = call i32 @fix_header(i8* %4)
br label %71
71: ; preds = %69, %65
%72 = phi i32 [ 0, %69 ], [ %54, %65 ]
%73 = call i32 @fwrite(i8* %4, i64 %55, i32 1, i32* %52)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %53
75: ; preds = %71, %81
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %87
78: ; preds = %53
%79 = call i64 @ferror(i32* %42)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %62
81: ; preds = %78
%82 = call i64 @fflush(i32* %52)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %75
84: ; preds = %81
%85 = call i32 @fclose(i32* %42)
%86 = call i32 @fclose(i32* %52)
br label %87
87: ; preds = %84, %75, %62
%88 = phi i32* [ @EXIT_FAILURE, %62 ], [ @EXIT_FAILURE, %75 ], [ @EXIT_SUCCESS, %84 ]
%89 = load i32, i32* %88
ret i32 %89
}