#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 */

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  printf("*** Boot stage 2 verification ***\n");
  int text = open("kernel/boot/boot-stage2.text", O_RDONLY);
  int text_end = lseek(text, 0, SEEK_END);
  int data = open("kernel/boot/boot-stage2.data", O_RDONLY);
  int data_end = lseek(data, 0, SEEK_END);
  int rodata = open("kernel/boot/boot-stage2.rodata", O_RDONLY);
  int rodata_end = lseek(rodata, 0, SEEK_END);
  int bss = open("kernel/boot/boot-stage2.bss", O_RDONLY);
  int bss_end = lseek(bss, 0, SEEK_END);
  if (text < 0 || data < 0 || rodata < 0 || bss < 0) {
    printf("FATAL ERROR: problem with program segment.\n");
    char *ok = "ok";
    char *bad = "bad";
    printf("text: %s data: %s rodata: %s bss: %s\n", text > 0 ? ok : bad,
           data > 0 ? ok : bad, rodata > 0 ? ok : bad, bss > 0 ? ok : bad);
    exit(1);
  }
  if (text_end > (512 * 128)) {
    printf("FATAL ERROR: Boot stage 2\n");
    printf("text section too large: %d\n", text_end);
    exit(1);
  }
  if (data_end > (512 * 4)) {
    printf("FATAL ERROR: Boot stage 2\n");
    printf("data section too large: %d\n", data_end);
    exit(1);
  }
  if (rodata_end > (512 * 4)) {
    printf("FATAL ERROR: Boot stage 2\n");
    printf("rodata section too large: %d\n", rodata_end);
    exit(1);
  }
  if (bss_end > (512 * 4)) {
    printf("FATAL ERROR: Boot stage 2\n");
    printf("bss section too large: %d\n", bss_end);
    exit(1);
  }
  close(text);
  close(data);
  close(rodata);
  close(bss);
  printf("Boot stage 2 has been verified.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
lea    0xe9c(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e4f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e34(%rip),%rax
mov    (%rax),%esi
lea    0xe8b(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    %eax,-0x20(%rbp)
mov    0x2e06(%rip),%rax
mov    (%rax),%esi
lea    0xe7a(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2df3(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    %eax,-0x28(%rbp)
mov    0x2dd8(%rip),%rax
mov    (%rax),%esi
lea    0xe6b(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    0x2dc5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1257 <main+0x107>
cmpl   $0x0,-0x1c(%rbp)
jl     1257 <main+0x107>
cmpl   $0x0,-0x24(%rbp)
jl     1257 <main+0x107>
cmpl   $0x0,-0x2c(%rbp)
jge    1337 <main+0x1e7>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe58(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe50(%rip),%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1292 <main+0x142>
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    129a <main+0x14a>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    12b9 <main+0x169>
mov    -0x38(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    12c1 <main+0x171>
mov    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    12e0 <main+0x190>
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    12e8 <main+0x198>
mov    -0x40(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    1307 <main+0x1b7>
mov    -0x38(%rbp),%rax
mov    %rax,-0x78(%rbp)
jmp    130f <main+0x1bf>
mov    -0x40(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x70(%rbp),%rcx
mov    -0x60(%rbp),%rdx
mov    -0x50(%rbp),%rsi
mov    -0x78(%rbp),%r8
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x10000,-0x18(%rbp)
jle    136d <main+0x21d>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x800,-0x20(%rbp)
jle    13a3 <main+0x253>
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x800,-0x28(%rbp)
jle    13d9 <main+0x289>
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x800,-0x30(%rbp)
jle    140f <main+0x2bf>
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    -0x24(%rbp),%edi
call   1050 <close@plt>
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf85(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e62(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1070 <open@plt>
mov    %eax,%r14d
mov    0x2e51(%rip),%r15
mov    (%r15),%edx
mov    %eax,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,(%rsp)
mov    0x0(%rbp),%esi
lea    0xe6d(%rip),%rdi
call   1070 <open@plt>
mov    %eax,%r12d
mov    (%r15),%edx
mov    %eax,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,0x4(%rsp)
mov    0x0(%rbp),%esi
lea    0xe68(%rip),%rdi
call   1070 <open@plt>
mov    %eax,%ebx
mov    (%r15),%edx
mov    %eax,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,%r13d
mov    0x0(%rbp),%esi
lea    0xe67(%rip),%rdi
call   1070 <open@plt>
mov    %eax,%ebp
mov    (%r15),%edx
mov    %eax,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %r12d,%ecx
or     %r14d,%ecx
or     %ebx,%ecx
or     %ebp,%ecx
js     1283 <main+0x123>
cmpl   $0x10001,(%rsp)
jge    12d8 <main+0x178>
mov    0x4(%rsp),%r15d
cmp    $0x801,%r15d
jge    12f0 <main+0x190>
cmp    $0x801,%r13d
jge    1308 <main+0x1a8>
cmp    $0x801,%eax
jge    1320 <main+0x1c0>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %r12d,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   1060 <close@plt>
mov    %ebp,%edi
call   1060 <close@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
test   %r14d,%r14d
lea    0xddc(%rip),%rax
lea    0xdd8(%rip),%r8
mov    %r8,%rsi
cmovg  %rax,%rsi
test   %r12d,%r12d
mov    %r8,%rdx
cmovg  %rax,%rdx
test   %ebx,%ebx
mov    %r8,%rcx
cmovg  %rax,%rcx
test   %ebp,%ebp
cmovg  %rax,%r8
lea    0xdb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xe5a(%rip),%rdi
call   1030 <puts@plt>
lea    0xdb7(%rip),%rdi
mov    (%rsp),%esi
jmp    1337 <main+0x1d7>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
lea    0xdbd(%rip),%rdi
mov    %r15d,%esi
jmp    1337 <main+0x1d7>
lea    0xe2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xda3(%rip),%rdi
mov    %r13d,%esi
jmp    1337 <main+0x1d7>
lea    0xe12(%rip),%rdi
mov    %eax,%ebx
call   1030 <puts@plt>
lea    0xda7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"*** Boot stage 2 verification ***\0A\00"
@.str.1 = [29 x i8] c"kernel/boot/boot-stage2.text\00"
@O_RDONLY = global i32 0
@SEEK_END = global i32 0
@.str.2 = [29 x i8] c"kernel/boot/boot-stage2.data\00"
@.str.3 = [31 x i8] c"kernel/boot/boot-stage2.rodata\00"
@.str.4 = [28 x i8] c"kernel/boot/boot-stage2.bss\00"
@.str.5 = [44 x i8] c"FATAL ERROR: problem with program segment.\0A\00"
@.str.6 = [3 x i8] c"ok\00"
@.str.7 = [4 x i8] c"bad\00"
@.str.8 = [38 x i8] c"text: %s data: %s rodata: %s bss: %s\0A\00"
@.str.9 = [27 x i8] c"FATAL ERROR: Boot stage 2\0A\00"
@.str.10 = [28 x i8] c"text section too large: %d\0A\00"
@.str.11 = [28 x i8] c"data section too large: %d\0A\00"
@.str.12 = [30 x i8] c"rodata section too large: %d\0A\00"
@.str.13 = [27 x i8] c"bss section too large: %d\0A\00"
@.str.14 = [33 x i8] c"Boot stage 2 has been verified.\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 i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @O_RDONLY
%18 = call i32 @open(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %17)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = load i32, i32* @SEEK_END
%21 = call i32 @lseek(i32 %19, i32 0, i32 %20)
store i32 %21, i32* %7
%22 = load i32, i32* @O_RDONLY
%23 = call i32 @open(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %22)
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = load i32, i32* @SEEK_END
%26 = call i32 @lseek(i32 %24, i32 0, i32 %25)
store i32 %26, i32* %9
%27 = load i32, i32* @O_RDONLY
%28 = call i32 @open(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %27)
store i32 %28, i32* %10
%29 = load i32, i32* %10
%30 = load i32, i32* @SEEK_END
%31 = call i32 @lseek(i32 %29, i32 0, i32 %30)
store i32 %31, i32* %11
%32 = load i32, i32* @O_RDONLY
%33 = call i32 @open(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 %32)
store i32 %33, i32* %12
%34 = load i32, i32* %12
%35 = load i32, i32* @SEEK_END
%36 = call i32 @lseek(i32 %34, i32 0, i32 %35)
store i32 %36, i32* %13
%37 = load i32, i32* %6
%38 = icmp slt i32 %37, 0
br i1 %38, label %48, label %39
39: ; preds = %2
%40 = load i32, i32* %8
%41 = icmp slt i32 %40, 0
br i1 %41, label %48, label %42
42: ; preds = %39
%43 = load i32, i32* %10
%44 = icmp slt i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* %12
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %84
48: ; preds = %45, %42, %39, %2
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %14
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8** %15
%50 = load i32, i32* %6
%51 = icmp sgt i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = load i8*, i8** %14
br label %56
54: ; preds = %48
%55 = load i8*, i8** %15
br label %56
56: ; preds = %54, %52
%57 = phi i8* [ %53, %52 ], [ %55, %54 ]
%58 = load i32, i32* %8
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = load i8*, i8** %14
br label %64
62: ; preds = %56
%63 = load i8*, i8** %15
br label %64
64: ; preds = %62, %60
%65 = phi i8* [ %61, %60 ], [ %63, %62 ]
%66 = load i32, i32* %10
%67 = icmp sgt i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = load i8*, i8** %14
br label %72
70: ; preds = %64
%71 = load i8*, i8** %15
br label %72
72: ; preds = %70, %68
%73 = phi i8* [ %69, %68 ], [ %71, %70 ]
%74 = load i32, i32* %12
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = load i8*, i8** %14
br label %80
78: ; preds = %72
%79 = load i8*, i8** %15
br label %80
80: ; preds = %78, %76
%81 = phi i8* [ %77, %76 ], [ %79, %78 ]
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i8* %57, i8* %65, i8* %73, i8* %81)
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %45
%85 = load i32, i32* %7
%86 = icmp sgt i32 %85, 65536
br i1 %86, label %87, label %92
87: ; preds = %84
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%89 = load i32, i32* %7
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %89)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %84
%93 = load i32, i32* %9
%94 = icmp sgt i32 %93, 2048
br i1 %94, label %95, label %100
95: ; preds = %92
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%97 = load i32, i32* %9
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %97)
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %92
%101 = load i32, i32* %11
%102 = icmp sgt i32 %101, 2048
br i1 %102, label %103, label %108
103: ; preds = %100
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%105 = load i32, i32* %11
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0), i32 %105)
%107 = call i32 @exit(i32 1)
unreachable
108: ; preds = %100
%109 = load i32, i32* %13
%110 = icmp sgt i32 %109, 2048
br i1 %110, label %111, label %116
111: ; preds = %108
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%113 = load i32, i32* %13
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), i32 %113)
%115 = call i32 @exit(i32 1)
unreachable
116: ; preds = %108
%117 = load i32, i32* %6
%118 = call i32 @close(i32 %117)
%119 = load i32, i32* %8
%120 = call i32 @close(i32 %119)
%121 = load i32, i32* %10
%122 = call i32 @close(i32 %121)
%123 = load i32, i32* %12
%124 = call i32 @close(i32 %123)
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"kernel/boot/boot-stage2.text\00"
@O_RDONLY = global i32 0
@SEEK_END = global i32 0
@.str.2 = [29 x i8] c"kernel/boot/boot-stage2.data\00"
@.str.3 = [31 x i8] c"kernel/boot/boot-stage2.rodata\00"
@.str.4 = [28 x i8] c"kernel/boot/boot-stage2.bss\00"
@.str.6 = [3 x i8] c"ok\00"
@.str.7 = [4 x i8] c"bad\00"
@.str.8 = [38 x i8] c"text: %s data: %s rodata: %s bss: %s\0A\00"
@.str.10 = [28 x i8] c"text section too large: %d\0A\00"
@.str.11 = [28 x i8] c"data section too large: %d\0A\00"
@.str.12 = [30 x i8] c"rodata section too large: %d\0A\00"
@.str.13 = [27 x i8] c"bss section too large: %d\0A\00"
@str = [34 x i8] c"*** Boot stage 2 verification ***\00"
@str.15 = [32 x i8] c"Boot stage 2 has been verified.\00"
@str.19 = [26 x i8] c"FATAL ERROR: Boot stage 2\00"
@str.20 = [43 x i8] c"FATAL ERROR: problem with program segment.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @SEEK_END
%7 = tail call i32 @lseek(i32 %5, i32 0, i32 %6)
%8 = load i32, i32* @O_RDONLY
%9 = tail call i32 @open(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @SEEK_END
%11 = tail call i32 @lseek(i32 %9, i32 0, i32 %10)
%12 = load i32, i32* @O_RDONLY
%13 = tail call i32 @open(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @SEEK_END
%15 = tail call i32 @lseek(i32 %13, i32 0, i32 %14)
%16 = load i32, i32* @O_RDONLY
%17 = tail call i32 @open(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @SEEK_END
%19 = tail call i32 @lseek(i32 %17, i32 0, i32 %18)
%20 = or i32 %9, %5
%21 = or i32 %20, %13
%22 = or i32 %21, %17
%23 = icmp sgt i32 %22, -1
br i1 %23, label %36, label %24
24: ; preds = %2
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.20, i64 0, i64 0))
%26 = icmp sgt i32 %5, 0
%27 = select i1 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%28 = icmp sgt i32 %9, 0
%29 = select i1 %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%30 = icmp sgt i32 %13, 0
%31 = select i1 %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%32 = icmp sgt i32 %17, 0
%33 = select i1 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i8* %27, i8* %29, i8* %31, i8* %33)
%35 = tail call i32 @exit(i32 1)
unreachable
36: ; preds = %2
%37 = icmp sgt i32 %7, 65536
br i1 %37, label %38, label %42
38: ; preds = %36
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %7)
%41 = tail call i32 @exit(i32 1)
unreachable
42: ; preds = %36
%43 = icmp sgt i32 %11, 2048
br i1 %43, label %44, label %48
44: ; preds = %42
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %11)
%47 = tail call i32 @exit(i32 1)
unreachable
48: ; preds = %42
%49 = icmp sgt i32 %15, 2048
br i1 %49, label %50, label %54
50: ; preds = %48
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0), i32 %15)
%53 = tail call i32 @exit(i32 1)
unreachable
54: ; preds = %48
%55 = icmp sgt i32 %19, 2048
br i1 %55, label %56, label %60
56: ; preds = %54
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), i32 %19)
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %54
%61 = tail call i32 @close(i32 %5)
%62 = tail call i32 @close(i32 %9)
%63 = tail call i32 @close(i32 %13)
%64 = tail call i32 @close(i32 %17)
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.15, i64 0, i64 0))
ret i32 0
}