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

/* Variables and functions */
int MAP_ANONYMOUS;
int /*<<< orphan*/ *MAP_FAILED;
int MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int fwrite(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htonl(int);
scalar_t__ memcmp(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *mmap(int /*<<< orphan*/ *, int, int, int,
                         int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(void) {
  FILE *f;
  int i, n;
  uint32_t *buf1, *buf2, *p;
  printf("Hello, World!\nHello again");
  printf(" - and some more - ");
  printf("and some more\n");
  buf1 = mmap(NULL, 2 * 4 * (1024 * 1024), PROT_READ | PROT_WRITE,
              MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
  if (buf1 == MAP_FAILED) {
    perror("mmap");
    return 1;
  }
  buf2 = buf1 + (1024 * 1024);
  p = buf1;
  for (i = 0; i < (1024 * 1024); i++)
    *p++ = htonl(i);
  f = fopen("test.out", "w+b");
  if (!f) {
    perror("fopen");
    return 1;
  }
  for (i = 2; i < (1024 * 1024); i += (i >> 1)) {
    n = fwrite(buf1, 4, i, f);
    if (n != i) {
      perror("fwrite");
      return 1;
    }
  }
  fprintf(f, "Writing to the file...\n");
  fprintf(f, "Writing to the file ");
  fprintf(f, "some more\n");
  fseek(f, 0, SEEK_SET);
  for (i = 2; i < (1024 * 1024); i += (i >> 1)) {
    n = fread(buf2, 4, i, f);
    if (n != i) {
      perror("fread");
      return 1;
    }
    if (memcmp(buf1, buf2, i * 4)) {
      fprintf(stderr, "memory mismatch error, i = %d\n", i);
      return 1;
    }
  }
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe3a(%rip),%rdi
call   1060 <printf@plt>
lea    0xe48(%rip),%rdi
call   1060 <printf@plt>
lea    0xe50(%rip),%rdi
call   1060 <printf@plt>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edx
mov    0x2dcd(%rip),%rax
or     (%rax),%edx
mov    0x2de4(%rip),%rax
mov    (%rax),%ecx
mov    0x2db3(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0x800000,%esi
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1050 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2d86(%rip),%rcx
cmp    (%rcx),%rax
jne    124b <main+0x9b>
lea    0xe03(%rip),%rdi
call   10c0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1447 <main+0x297>
mov    -0x20(%rbp),%rax
add    $0x400000,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x100000,-0x14(%rbp)
jge    129e <main+0xee>
mov    -0x14(%rbp),%edi
call   1070 <htonl@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x30(%rbp)
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1268 <main+0xb8>
lea    0xd9d(%rip),%rdi
lea    0xd9f(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    12d8 <main+0x128>
lea    0xd88(%rip),%rdi
call   10c0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1447 <main+0x297>
movl   $0x2,-0x14(%rbp)
cmpl   $0x100000,-0x14(%rbp)
jge    133e <main+0x18e>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x4,%esi
call   10d0 <fwrite@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1328 <main+0x178>
lea    0xd3e(%rip),%rdi
call   10c0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1447 <main+0x297>
jmp    132d <main+0x17d>
mov    -0x14(%rbp),%eax
sar    $0x1,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    12df <main+0x12f>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
lea    0xd11(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
lea    0xd15(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
lea    0xcbf(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2c43(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
movl   $0x2,-0x14(%rbp)
cmpl   $0x100000,-0x14(%rbp)
jge    1437 <main+0x287>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     13de <main+0x22e>
lea    0xcbc(%rip),%rdi
call   10c0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1447 <main+0x297>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
shl    $0x2,%edx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
je     1421 <main+0x271>
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xc81(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1447 <main+0x297>
jmp    1426 <main+0x276>
mov    -0x14(%rbp),%eax
sar    $0x1,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1395 <main+0x1e5>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe31(%rip),%rdi
call   1070 <printf@plt>
lea    0xe3f(%rip),%rdi
call   1070 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e05(%rip),%rax
mov    0x2dc6(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2ddb(%rip),%rax
mov    0x2dac(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
xor    %edi,%edi
mov    $0x800000,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1060 <mmap@plt>
mov    %rax,%r12
mov    0x2d84(%rip),%rax
cmp    (%rax),%r12
je     1373 <main+0x1b3>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1080 <htonl@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    $0x100000,%ebx
jne    1240 <main+0x80>
lea    0xdd5(%rip),%rdi
lea    0xdd7(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     137c <main+0x1bc>
mov    %rax,%r14
mov    %r12,%r15
add    $0x400000,%r15
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    $0x4,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   10e0 <fwrite@plt>
cmp    %ebx,%eax
jne    1385 <main+0x1c5>
mov    %ebx,%eax
sar    %eax
add    %eax,%ebx
cmp    $0x100000,%ebx
jl     1290 <main+0xd0>
lea    0xd8e(%rip),%rsi
mov    %r14d,%edi
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xd95(%rip),%rsi
mov    %r14d,%edi
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xd99(%rip),%rsi
mov    %r14d,%edi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    $0x4,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    %ebx,%eax
jne    138e <main+0x1ce>
lea    0x0(,%rbx,4),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1090 <memcmp@plt>
test   %rax,%rax
jne    1358 <main+0x198>
mov    %ebx,%eax
sar    %eax
add    %ebx,%eax
mov    %eax,%ebx
cmp    $0x100000,%eax
jl     1310 <main+0x150>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    139f <main+0x1df>
mov    0x2c71(%rip),%rax
mov    (%rax),%edi
lea    0xd23(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    139a <main+0x1da>
lea    0xcb4(%rip),%rdi
jmp    1395 <main+0x1d5>
lea    0xcbd(%rip),%rdi
jmp    1395 <main+0x1d5>
lea    0xcba(%rip),%rdi
jmp    1395 <main+0x1d5>
lea    0xcf0(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Hello, World!\0AHello again\00"
@.str.1 = [20 x i8] c" - and some more - \00"
@.str.2 = [15 x i8] c"and some more\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i32* null
@.str.3 = [5 x i8] c"mmap\00"
@.str.4 = [9 x i8] c"test.out\00"
@.str.5 = [4 x i8] c"w+b\00"
@.str.6 = [6 x i8] c"fopen\00"
@.str.7 = [7 x i8] c"fwrite\00"
@.str.8 = [24 x i8] c"Writing to the file...\0A\00"
@.str.9 = [21 x i8] c"Writing to the file \00"
@.str.10 = [11 x i8] c"some more\0A\00"
@SEEK_SET = global i32 0
@.str.11 = [6 x i8] c"fread\00"
@stderr = global i32 0
@.str.12 = [31 x i8] c"memory mismatch error, i = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @PROT_READ
%12 = load i32, i32* @PROT_WRITE
%13 = or i32 %11, %12
%14 = load i32, i32* @MAP_ANONYMOUS
%15 = load i32, i32* @MAP_PRIVATE
%16 = or i32 %14, %15
%17 = call i32* @mmap(i32* null, i32 8388608, i32 %13, i32 %16, i32 0, i32 0)
store i32* %17, i32** %5
%18 = load i32*, i32** %5
%19 = load i32*, i32** @MAP_FAILED
%20 = icmp eq i32* %18, %19
br i1 %20, label %21, label %23
21: ; preds = %0
%22 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %110
23: ; preds = %0
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 1048576
store i32* %25, i32** %6
%26 = load i32*, i32** %5
store i32* %26, i32** %7
store i32 0, i32* %3
br label %27
27: ; preds = %35, %23
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 1048576
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i32, i32* %3
%32 = call i32 @htonl(i32 %31)
%33 = load i32*, i32** %7
%34 = getelementptr inbounds i32, i32* %33, i32 1
store i32* %34, i32** %7
store i32 %32, i32* %33
br label %35
35: ; preds = %30
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %27
38: ; preds = %27
%39 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
store i32* %39, i32** %2
%40 = load i32*, i32** %2
%41 = icmp ne i32* %40, null
br i1 %41, label %44, label %42
42: ; preds = %38
%43 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %1
br label %110
44: ; preds = %38
store i32 2, i32* %3
br label %45
45: ; preds = %59, %44
%46 = load i32, i32* %3
%47 = icmp slt i32 %46, 1048576
br i1 %47, label %48, label %64
48: ; preds = %45
%49 = load i32*, i32** %5
%50 = load i32, i32* %3
%51 = load i32*, i32** %2
%52 = call i32 @fwrite(i32* %49, i32 4, i32 %50, i32* %51)
store i32 %52, i32* %4
%53 = load i32, i32* %4
%54 = load i32, i32* %3
%55 = icmp ne i32 %53, %54
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %110
58: ; preds = %48
br label %59
59: ; preds = %58
%60 = load i32, i32* %3
%61 = ashr i32 %60, 1
%62 = load i32, i32* %3
%63 = add nsw i32 %62, %61
store i32 %63, i32* %3
br label %45
64: ; preds = %45
%65 = load i32*, i32** %2
%66 = ptrtoint i32* %65 to i32
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%68 = load i32*, i32** %2
%69 = ptrtoint i32* %68 to i32
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%71 = load i32*, i32** %2
%72 = ptrtoint i32* %71 to i32
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%74 = load i32*, i32** %2
%75 = load i32, i32* @SEEK_SET
%76 = call i32 @fseek(i32* %74, i32 0, i32 %75)
store i32 2, i32* %3
br label %77
77: ; preds = %102, %64
%78 = load i32, i32* %3
%79 = icmp slt i32 %78, 1048576
br i1 %79, label %80, label %107
80: ; preds = %77
%81 = load i32*, i32** %6
%82 = load i32, i32* %3
%83 = load i32*, i32** %2
%84 = call i32 @fread(i32* %81, i32 4, i32 %82, i32* %83)
store i32 %84, i32* %4
%85 = load i32, i32* %4
%86 = load i32, i32* %3
%87 = icmp ne i32 %85, %86
br i1 %87, label %88, label %90
88: ; preds = %80
%89 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %1
br label %110
90: ; preds = %80
%91 = load i32*, i32** %5
%92 = load i32*, i32** %6
%93 = load i32, i32* %3
%94 = mul nsw i32 %93, 4
%95 = call i64 @memcmp(i32* %91, i32* %92, i32 %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %90
%98 = load i32, i32* @stderr
%99 = load i32, i32* %3
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i32 %99)
store i32 1, i32* %1
br label %110
101: ; preds = %90
br label %102
102: ; preds = %101
%103 = load i32, i32* %3
%104 = ashr i32 %103, 1
%105 = load i32, i32* %3
%106 = add nsw i32 %105, %104
store i32 %106, i32* %3
br label %77
107: ; preds = %77
%108 = load i32*, i32** %2
%109 = call i32 @fclose(i32* %108)
store i32 0, i32* %1
br label %110
110: ; preds = %107, %97, %88, %56, %42, %21
%111 = load i32, i32* %1
ret i32 %111
}

LLVM IR (-O2):
@.str = [26 x i8] c"Hello, World!\0AHello again\00"
@.str.1 = [20 x i8] c" - and some more - \00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i32* null
@.str.3 = [5 x i8] c"mmap\00"
@.str.4 = [9 x i8] c"test.out\00"
@.str.5 = [4 x i8] c"w+b\00"
@.str.6 = [6 x i8] c"fopen\00"
@.str.7 = [7 x i8] c"fwrite\00"
@.str.8 = [24 x i8] c"Writing to the file...\0A\00"
@.str.9 = [21 x i8] c"Writing to the file \00"
@.str.10 = [11 x i8] c"some more\0A\00"
@SEEK_SET = global i32 0
@.str.11 = [6 x i8] c"fread\00"
@stderr = global i32 0
@.str.12 = [31 x i8] c"memory mismatch error, i = %d\0A\00"
@str = [14 x i8] c"and some more\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @PROT_READ
%5 = load i32, i32* @PROT_WRITE
%6 = or i32 %5, %4
%7 = load i32, i32* @MAP_ANONYMOUS
%8 = load i32, i32* @MAP_PRIVATE
%9 = or i32 %8, %7
%10 = tail call i32* @mmap(i32* null, i32 8388608, i32 %6, i32 %9, i32 0, i32 0)
%11 = load i32*, i32** @MAP_FAILED
%12 = icmp eq i32* %10, %11
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %65
15: ; preds = %0, %15
%16 = phi i32* [ %19, %15 ], [ %10, %0 ]
%17 = phi i32 [ %20, %15 ], [ 0, %0 ]
%18 = tail call i32 @htonl(i32 %17)
%19 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %18, i32* %16
%20 = add nuw nsw i32 %17, 1
%21 = icmp eq i32 %20, 1048576
br i1 %21, label %22, label %15
22: ; preds = %15
%23 = getelementptr inbounds i32, i32* %10, i64 1048576
%24 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %65
28: ; preds = %22, %34
%29 = phi i32 [ %36, %34 ], [ 2, %22 ]
%30 = tail call i32 @fwrite(i32* %10, i32 4, i32 %29, i32* %24)
%31 = icmp eq i32 %30, %29
br i1 %31, label %34, label %32
32: ; preds = %28
%33 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %65
34: ; preds = %28
%35 = ashr i32 %29, 1
%36 = add nsw i32 %35, %29
%37 = icmp slt i32 %36, 1048576
br i1 %37, label %28, label %38
38: ; preds = %34
%39 = ptrtoint i32* %24 to i64
%40 = trunc i64 %39 to i32
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%44 = load i32, i32* @SEEK_SET
%45 = tail call i32 @fseek(i32* %24, i32 0, i32 %44)
br label %46
46: ; preds = %38, %59
%47 = phi i32 [ 2, %38 ], [ %61, %59 ]
%48 = tail call i32 @fread(i32* %23, i32 4, i32 %47, i32* %24)
%49 = icmp eq i32 %48, %47
br i1 %49, label %52, label %50
50: ; preds = %46
%51 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
br label %65
52: ; preds = %46
%53 = shl nsw i32 %47, 2
%54 = tail call i64 @memcmp(i32* %10, i32* %23, i32 %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = tail call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i32 %47)
br label %65
59: ; preds = %52
%60 = ashr i32 %47, 1
%61 = add nsw i32 %60, %47
%62 = icmp slt i32 %61, 1048576
br i1 %62, label %46, label %63
63: ; preds = %59
%64 = tail call i32 @fclose(i32* %24)
br label %65
65: ; preds = %63, %56, %50, %32, %26, %13
%66 = phi i32 [ 1, %13 ], [ 1, %32 ], [ 1, %50 ], [ 1, %56 ], [ 0, %63 ], [ 1, %26 ]
ret i32 %66
}