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

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
long fread(int *, int, long, int /*<<< orphan*/ *);
int fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
long fwrite(int *, int, long, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (2 != argc) {
    fprintf(stderr, "usage: nibble_reverse file.ima\n");
    return 1;
  }
  FILE *infile = fopen(argv[1], "r+b");
  if (!infile) {
    perror("fopen");
    return 1;
  }
  if (-1 == fseek(infile, 0, SEEK_END)) {
    perror("fseek");
    return 1;
  }
  long filesize = ftell(infile);
  if (-1 == filesize) {
    perror("ftell");
    return 1;
  }
  uint8_t buf[0x200];
  long offset = 0;
  while (offset < filesize) {
    long bytes_to_do = sizeof(buf);
    if (bytes_to_do > filesize - offset) {
      bytes_to_do = filesize - offset;
    }
    if (-1 == fseek(infile, offset, SEEK_SET)) {
      perror("fseek");
    }
    if (bytes_to_do != fread(buf, 1, bytes_to_do, infile)) {
      perror("fread");
      return 1;
    }
    for (long i = 0; i < bytes_to_do; i++) {
      buf[i] = (buf[i] >> 4) | (buf[i] << 4);
    }
    if (-1 == fseek(infile, offset, SEEK_SET)) {
      perror("fseek");
    }
    if (bytes_to_do != fwrite(buf, 1, bytes_to_do, infile)) {
      perror("fwrite");
      return 1;
    }
    offset += bytes_to_do;
  }
  if (EOF == fclose(infile)) {
    perror("fclose");
  }
}


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)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     11c8 <main+0x48>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1497 <main+0x317>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe49(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1203 <main+0x83>
lea    0xe32(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1497 <main+0x317>
mov    -0x18(%rbp),%rdi
mov    0x2dda(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1070 <fseek@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1240 <main+0xc0>
lea    0xdfb(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1497 <main+0x317>
mov    -0x18(%rbp),%rdi
call   1060 <ftell@plt>
mov    %rax,-0x20(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    -0x20(%rbp),%rax
jne    1276 <main+0xf6>
lea    0xdcb(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1497 <main+0x317>
movq   $0x0,-0x828(%rbp)
mov    -0x828(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    145e <main+0x2de>
movq   $0x800,-0x830(%rbp)
mov    -0x830(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    -0x828(%rbp),%rcx
cmp    %rcx,%rax
jle    12ca <main+0x14a>
mov    -0x20(%rbp),%rax
sub    -0x828(%rbp),%rax
mov    %rax,-0x830(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x828(%rbp),%rsi
mov    0x2cec(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    12fe <main+0x17e>
lea    0xd31(%rip),%rdi
call   1090 <perror@plt>
mov    -0x830(%rbp),%rax
mov    %rax,-0x840(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x830(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,%rcx
mov    -0x840(%rbp),%rax
cmp    %rcx,%rax
je     1353 <main+0x1d3>
lea    0xcf4(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1497 <main+0x317>
movq   $0x0,-0x838(%rbp)
mov    -0x838(%rbp),%rax
cmp    -0x830(%rbp),%rax
jge    13bb <main+0x23b>
mov    -0x838(%rbp),%rax
mov    -0x820(%rbp,%rax,4),%ecx
sar    $0x4,%ecx
mov    -0x838(%rbp),%rax
mov    -0x820(%rbp,%rax,4),%eax
shl    $0x4,%eax
or     %eax,%ecx
mov    -0x838(%rbp),%rax
mov    %ecx,-0x820(%rbp,%rax,4)
mov    -0x838(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x838(%rbp)
jmp    135e <main+0x1de>
mov    -0x18(%rbp),%rdi
mov    -0x828(%rbp),%rsi
mov    0x2bfb(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    13ef <main+0x26f>
lea    0xc40(%rip),%rdi
call   1090 <perror@plt>
mov    -0x830(%rbp),%rax
mov    %rax,-0x848(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x830(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10a0 <fwrite@plt>
mov    %rax,%rcx
mov    -0x848(%rbp),%rax
cmp    %rcx,%rax
je     1444 <main+0x2c4>
lea    0xc09(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1497 <main+0x317>
mov    -0x830(%rbp),%rax
add    -0x828(%rbp),%rax
mov    %rax,-0x828(%rbp)
jmp    1281 <main+0x101>
mov    0x2b7b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x850(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    %rax,%rcx
mov    -0x850(%rbp),%rax
cmp    %rcx,%rax
jne    1497 <main+0x317>
lea    0xbb1(%rip),%rdi
call   1090 <perror@plt>
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    $0x808,%rsp
cmp    $0x2,%edi
jne    1433 <main+0x2b3>
mov    0x8(%rsi),%rdi
lea    0xe7b(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     147f <main+0x2ff>
mov    %rax,%r12
mov    0x2e2b(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
cmp    $0xffffffff,%eax
je     1488 <main+0x308>
mov    %r12,%rdi
call   1060 <ftell@plt>
cmp    $0xffffffffffffffff,%rax
je     1491 <main+0x311>
mov    %rax,%rbp
test   %rax,%rax
jle    1450 <main+0x2d0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%r14
sub    %rbx,%r14
cmp    $0x800,%r14
mov    $0x800,%r15d
cmovl  %r14,%r15
mov    0x2daa(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <fseek@plt>
cmp    $0xffffffff,%eax
je     1393 <main+0x213>
mov    $0x1,%r13d
mov    %rsp,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <fread@plt>
cmp    %rax,%r15
jne    14ae <main+0x32e>
test   %r14,%r14
jle    13e9 <main+0x269>
cmp    $0x2,%r15
mov    $0x1,%eax
cmovge %r15,%rax
cmp    $0x8,%rax
jae    1280 <main+0x100>
xor    %ecx,%ecx
jmp    13d0 <main+0x250>
nopl   0x0(%rax)
mov    %rax,%rcx
movabs $0x7ffffffffffffff8,%rdx
ff ff 7f
and    %rdx,%rcx
lea    -0x8(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     134b <main+0x1cb>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqa (%rsp,%rdx,4),%xmm0
movdqa 0x10(%rsp,%rdx,4),%xmm1
movdqa 0x20(%rsp,%rdx,4),%xmm2
movdqa 0x30(%rsp,%rdx,4),%xmm3
movdqa %xmm0,%xmm4
psrad  $0x4,%xmm4
movdqa %xmm1,%xmm5
psrad  $0x4,%xmm5
pslld  $0x4,%xmm0
por    %xmm4,%xmm0
pslld  $0x4,%xmm1
por    %xmm5,%xmm1
movdqa %xmm0,(%rsp,%rdx,4)
movdqa %xmm1,0x10(%rsp,%rdx,4)
movdqa %xmm2,%xmm0
psrad  $0x4,%xmm0
movdqa %xmm3,%xmm1
psrad  $0x4,%xmm1
pslld  $0x4,%xmm2
por    %xmm0,%xmm2
pslld  $0x4,%xmm3
por    %xmm1,%xmm3
movdqa %xmm2,0x20(%rsp,%rdx,4)
movdqa %xmm3,0x30(%rsp,%rdx,4)
add    $0x10,%rdx
add    $0xfffffffffffffffe,%rdi
jne    12c0 <main+0x140>
test   $0x1,%sil
jne    1357 <main+0x1d7>
jmp    13e4 <main+0x264>
xor    %edx,%edx
test   $0x1,%sil
je     13e4 <main+0x264>
movdqa (%rsp,%rdx,4),%xmm0
movdqa 0x10(%rsp,%rdx,4),%xmm1
movdqa %xmm0,%xmm2
psrad  $0x4,%xmm2
movdqa %xmm1,%xmm3
psrad  $0x4,%xmm3
pslld  $0x4,%xmm0
por    %xmm2,%xmm0
pslld  $0x4,%xmm1
por    %xmm3,%xmm1
movdqa %xmm0,(%rsp,%rdx,4)
movdqa %xmm1,0x10(%rsp,%rdx,4)
jmp    13e4 <main+0x264>
lea    0xc90(%rip),%rdi
call   1090 <perror@plt>
jmp    1234 <main+0xb4>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %r15,%rbx
cmp    %rbx,%rbp
jg     1200 <main+0x80>
jmp    1450 <main+0x2d0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rcx,4),%edx
mov    %edx,%esi
sar    $0x4,%esi
shl    $0x4,%edx
or     %esi,%edx
mov    %edx,(%rsp,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    13d0 <main+0x250>
mov    0x2bd8(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <fseek@plt>
cmp    $0xffffffff,%eax
je     1425 <main+0x2a5>
mov    $0x1,%r13d
mov    %rsp,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
mov    %r12,%rcx
call   10a0 <fwrite@plt>
cmp    %rax,%r15
je     13b0 <main+0x230>
jmp    14b7 <main+0x337>
lea    0xbfe(%rip),%rdi
call   1090 <perror@plt>
jmp    1402 <main+0x282>
mov    0x2b96(%rip),%rax
mov    (%rax),%edi
lea    0xbbd(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%r13d
jmp    146a <main+0x2ea>
mov    0x2b89(%rip),%rax
mov    (%rax),%rbx
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %r13d,%r13d
cmp    %rax,%rbx
je     14a5 <main+0x325>
mov    %r13d,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb9e(%rip),%rdi
jmp    1498 <main+0x318>
lea    0xb9b(%rip),%rdi
jmp    1498 <main+0x318>
lea    0xb98(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%r13d
jmp    146a <main+0x2ea>
lea    0xb97(%rip),%rdi
jmp    14be <main+0x33e>
lea    0xb81(%rip),%rdi
jmp    14be <main+0x33e>
lea    0xb7e(%rip),%rdi
call   1090 <perror@plt>
jmp    146a <main+0x2ea>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"usage: nibble_reverse file.ima\0A\00"
@.str.1 = [4 x i8] c"r+b\00"
@.str.2 = [6 x i8] c"fopen\00"
@SEEK_END = global i32 0
@.str.3 = [6 x i8] c"fseek\00"
@.str.4 = [6 x i8] c"ftell\00"
@SEEK_SET = global i32 0
@.str.5 = [6 x i8] c"fread\00"
@.str.6 = [7 x i8] c"fwrite\00"
@EOF = global i64 0
@.str.7 = [7 x i8] c"fclose\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i64
%8 = alloca [512 x i32]
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 2, %12
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %120
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %6
%22 = load i32*, i32** %6
%23 = icmp ne i32* %22, null
br i1 %23, label %26, label %24
24: ; preds = %17
%25 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %120
26: ; preds = %17
%27 = load i32*, i32** %6
%28 = load i32, i32* @SEEK_END
%29 = call i32 @fseek(i32* %27, i64 0, i32 %28)
%30 = icmp eq i32 -1, %29
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %120
33: ; preds = %26
%34 = load i32*, i32** %6
%35 = call i64 @ftell(i32* %34)
store i64 %35, i64* %7
%36 = load i64, i64* %7
%37 = icmp eq i64 -1, %36
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %120
40: ; preds = %33
store i64 0, i64* %9
br label %41
41: ; preds = %109, %40
%42 = load i64, i64* %9
%43 = load i64, i64* %7
%44 = icmp slt i64 %42, %43
br i1 %44, label %45, label %113
45: ; preds = %41
store i64 2048, i64* %10
%46 = load i64, i64* %10
%47 = load i64, i64* %7
%48 = load i64, i64* %9
%49 = sub nsw i64 %47, %48
%50 = icmp sgt i64 %46, %49
br i1 %50, label %51, label %55
51: ; preds = %45
%52 = load i64, i64* %7
%53 = load i64, i64* %9
%54 = sub nsw i64 %52, %53
store i64 %54, i64* %10
br label %55
55: ; preds = %51, %45
%56 = load i32*, i32** %6
%57 = load i64, i64* %9
%58 = load i32, i32* @SEEK_SET
%59 = call i32 @fseek(i32* %56, i64 %57, i32 %58)
%60 = icmp eq i32 -1, %59
br i1 %60, label %61, label %63
61: ; preds = %55
%62 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %63
63: ; preds = %61, %55
%64 = load i64, i64* %10
%65 = getelementptr inbounds [512 x i32], [512 x i32]* %8, i64 0, i64 0
%66 = load i64, i64* %10
%67 = load i32*, i32** %6
%68 = call i64 @fread(i32* %65, i32 1, i64 %66, i32* %67)
%69 = icmp ne i64 %64, %68
br i1 %69, label %70, label %72
70: ; preds = %63
%71 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %120
72: ; preds = %63
store i64 0, i64* %11
br label %73
73: ; preds = %89, %72
%74 = load i64, i64* %11
%75 = load i64, i64* %10
%76 = icmp slt i64 %74, %75
br i1 %76, label %77, label %92
77: ; preds = %73
%78 = load i64, i64* %11
%79 = getelementptr inbounds [512 x i32], [512 x i32]* %8, i64 0, i64 %78
%80 = load i32, i32* %79
%81 = ashr i32 %80, 4
%82 = load i64, i64* %11
%83 = getelementptr inbounds [512 x i32], [512 x i32]* %8, i64 0, i64 %82
%84 = load i32, i32* %83
%85 = shl i32 %84, 4
%86 = or i32 %81, %85
%87 = load i64, i64* %11
%88 = getelementptr inbounds [512 x i32], [512 x i32]* %8, i64 0, i64 %87
store i32 %86, i32* %88
br label %89
89: ; preds = %77
%90 = load i64, i64* %11
%91 = add nsw i64 %90, 1
store i64 %91, i64* %11
br label %73
92: ; preds = %73
%93 = load i32*, i32** %6
%94 = load i64, i64* %9
%95 = load i32, i32* @SEEK_SET
%96 = call i32 @fseek(i32* %93, i64 %94, i32 %95)
%97 = icmp eq i32 -1, %96
br i1 %97, label %98, label %100
98: ; preds = %92
%99 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %100
100: ; preds = %98, %92
%101 = load i64, i64* %10
%102 = getelementptr inbounds [512 x i32], [512 x i32]* %8, i64 0, i64 0
%103 = load i64, i64* %10
%104 = load i32*, i32** %6
%105 = call i64 @fwrite(i32* %102, i32 1, i64 %103, i32* %104)
%106 = icmp ne i64 %101, %105
br i1 %106, label %107, label %109
107: ; preds = %100
%108 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %120
109: ; preds = %100
%110 = load i64, i64* %10
%111 = load i64, i64* %9
%112 = add nsw i64 %111, %110
store i64 %112, i64* %9
br label %41
113: ; preds = %41
%114 = load i64, i64* @EOF
%115 = load i32*, i32** %6
%116 = call i64 @fclose(i32* %115)
%117 = icmp eq i64 %114, %116
br i1 %117, label %118, label %120
118: ; preds = %113
%119 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %120
120: ; preds = %14, %24, %31, %38, %70, %107, %118, %113
%121 = load i32, i32* %3
ret i32 %121
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"usage: nibble_reverse file.ima\0A\00"
@.str.1 = [4 x i8] c"r+b\00"
@.str.2 = [6 x i8] c"fopen\00"
@SEEK_END = global i32 0
@.str.3 = [6 x i8] c"fseek\00"
@.str.4 = [6 x i8] c"ftell\00"
@SEEK_SET = global i32 0
@.str.5 = [6 x i8] c"fread\00"
@.str.6 = [7 x i8] c"fwrite\00"
@EOF = global i64 0
@.str.7 = [7 x i8] c"fclose\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 @fprintf(i32 %6, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %146
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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %146
15: ; preds = %8
%16 = load i32, i32* @SEEK_END
%17 = tail call i32 @fseek(i32* %11, i64 0, i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %146
21: ; preds = %15
%22 = tail call i64 @ftell(i32* %11)
%23 = icmp eq i64 %22, -1
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %146
26: ; preds = %21
%27 = bitcast [512 x i32]* %3 to i8*
%28 = icmp sgt i64 %22, 0
br i1 %28, label %29, label %136
29: ; preds = %26
%30 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 0
br label %33
31: ; preds = %132
%32 = icmp sgt i64 %22, %135
br i1 %32, label %33, label %136
33: ; preds = %29, %31
%34 = phi i64 [ 0, %29 ], [ %135, %31 ]
%35 = sub nsw i64 %22, %34
%36 = icmp slt i64 %35, 2048
%37 = select i1 %36, i64 %35, i64 2048
%38 = load i32, i32* @SEEK_SET
%39 = tail call i32 @fseek(i32* %11, i64 %34, i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %33
%42 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %33
%44 = call i64 @fread(i32* %30, i32 1, i64 %37, i32* %11)
%45 = icmp eq i64 %37, %44
br i1 %45, label %46, label %140
46: ; preds = %43
%47 = icmp sgt i64 %35, 0
br i1 %47, label %48, label %117
48: ; preds = %46
%49 = call i64 @llvm.smax.i64(i64 %37, i64 1)
%50 = icmp ult i64 %49, 8
br i1 %50, label %115, label %51
51: ; preds = %48
%52 = and i64 %49, 9223372036854775800
%53 = add nsw i64 %52, -8
%54 = lshr exact i64 %53, 3
%55 = add nuw nsw i64 %54, 1
%56 = and i64 %55, 1
%57 = icmp eq i64 %53, 0
br i1 %57, label %95, label %58
58: ; preds = %51
%59 = and i64 %55, 4611686018427387902
br label %60
60: ; preds = %60, %58
%61 = phi i64 [ 0, %58 ], [ %92, %60 ]
%62 = phi i64 [ 0, %58 ], [ %93, %60 ]
%63 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %61
%64 = bitcast i32* %63 to <4 x i32>*
%65 = load <4 x i32>, <4 x i32>* %64
%66 = getelementptr inbounds i32, i32* %63, i64 4
%67 = bitcast i32* %66 to <4 x i32>*
%68 = load <4 x i32>, <4 x i32>* %67
%69 = ashr <4 x i32> %65, <i32 4, i32 4, i32 4, i32 4>
%70 = ashr <4 x i32> %68, <i32 4, i32 4, i32 4, i32 4>
%71 = shl <4 x i32> %65, <i32 4, i32 4, i32 4, i32 4>
%72 = shl <4 x i32> %68, <i32 4, i32 4, i32 4, i32 4>
%73 = or <4 x i32> %69, %71
%74 = or <4 x i32> %70, %72
%75 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> %73, <4 x i32>* %75
%76 = bitcast i32* %66 to <4 x i32>*
store <4 x i32> %74, <4 x i32>* %76
%77 = or i64 %61, 8
%78 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %77
%79 = bitcast i32* %78 to <4 x i32>*
%80 = load <4 x i32>, <4 x i32>* %79
%81 = getelementptr inbounds i32, i32* %78, i64 4
%82 = bitcast i32* %81 to <4 x i32>*
%83 = load <4 x i32>, <4 x i32>* %82
%84 = ashr <4 x i32> %80, <i32 4, i32 4, i32 4, i32 4>
%85 = ashr <4 x i32> %83, <i32 4, i32 4, i32 4, i32 4>
%86 = shl <4 x i32> %80, <i32 4, i32 4, i32 4, i32 4>
%87 = shl <4 x i32> %83, <i32 4, i32 4, i32 4, i32 4>
%88 = or <4 x i32> %84, %86
%89 = or <4 x i32> %85, %87
%90 = bitcast i32* %78 to <4 x i32>*
store <4 x i32> %88, <4 x i32>* %90
%91 = bitcast i32* %81 to <4 x i32>*
store <4 x i32> %89, <4 x i32>* %91
%92 = add nuw i64 %61, 16
%93 = add i64 %62, 2
%94 = icmp eq i64 %93, %59
br i1 %94, label %95, label %60
95: ; preds = %60, %51
%96 = phi i64 [ 0, %51 ], [ %92, %60 ]
%97 = icmp eq i64 %56, 0
br i1 %97, label %113, label %98
98: ; preds = %95
%99 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %96
%100 = bitcast i32* %99 to <4 x i32>*
%101 = load <4 x i32>, <4 x i32>* %100
%102 = getelementptr inbounds i32, i32* %99, i64 4
%103 = bitcast i32* %102 to <4 x i32>*
%104 = load <4 x i32>, <4 x i32>* %103
%105 = ashr <4 x i32> %101, <i32 4, i32 4, i32 4, i32 4>
%106 = ashr <4 x i32> %104, <i32 4, i32 4, i32 4, i32 4>
%107 = shl <4 x i32> %101, <i32 4, i32 4, i32 4, i32 4>
%108 = shl <4 x i32> %104, <i32 4, i32 4, i32 4, i32 4>
%109 = or <4 x i32> %105, %107
%110 = or <4 x i32> %106, %108
%111 = bitcast i32* %99 to <4 x i32>*
store <4 x i32> %109, <4 x i32>* %111
%112 = bitcast i32* %102 to <4 x i32>*
store <4 x i32> %110, <4 x i32>* %112
br label %113
113: ; preds = %95, %98
%114 = icmp eq i64 %49, %52
br i1 %114, label %117, label %115
115: ; preds = %48, %113
%116 = phi i64 [ 0, %48 ], [ %52, %113 ]
br label %121
117: ; preds = %121, %113, %46
%118 = load i32, i32* @SEEK_SET
%119 = tail call i32 @fseek(i32* %11, i64 %34, i32 %118)
%120 = icmp eq i32 %119, -1
br i1 %120, label %130, label %132
121: ; preds = %115, %121
%122 = phi i64 [ %128, %121 ], [ %116, %115 ]
%123 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %122
%124 = load i32, i32* %123
%125 = ashr i32 %124, 4
%126 = shl i32 %124, 4
%127 = or i32 %125, %126
store i32 %127, i32* %123
%128 = add nuw nsw i64 %122, 1
%129 = icmp eq i64 %128, %49
br i1 %129, label %117, label %121
130: ; preds = %117
%131 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %132
132: ; preds = %130, %117
%133 = call i64 @fwrite(i32* %30, i32 1, i64 %37, i32* %11)
%134 = icmp eq i64 %37, %133
%135 = add nsw i64 %37, %34
br i1 %134, label %31, label %140
136: ; preds = %31, %26
%137 = load i64, i64* @EOF
%138 = tail call i64 @fclose(i32* %11)
%139 = icmp eq i64 %137, %138
br i1 %139, label %140, label %144
140: ; preds = %132, %43, %136
%141 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), %136 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %43 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), %132 ]
%142 = phi i32 [ 0, %136 ], [ 1, %43 ], [ 1, %132 ]
%143 = tail call i32 @perror(i8* %141)
br label %144
144: ; preds = %140, %136
%145 = phi i32 [ 0, %136 ], [ %142, %140 ]
br label %146
146: ; preds = %13, %19, %144, %24, %5
%147 = phi i32 [ 1, %5 ], [ 1, %19 ], [ 1, %13 ], [ 1, %24 ], [ %145, %144 ]
ret i32 %147
}