#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*/ nr_hugepages;
typedef int /*<<< orphan*/ initial_nr_hugepages;

/* Variables and functions */
int O_NONBLOCK;
int O_RDWR;
int /*<<< orphan*/ SEEK_SET;
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ read(int, char *, int);
int /*<<< orphan*/ stderr;
int strlen(char *);
int write(int, char *, int);
int check_compaction(unsigned long mem_free, unsigned int hugepage_size) {
  int fd;
  int compaction_index = 0;
  char initial_nr_hugepages[10] = {0};
  char nr_hugepages[10] = {0};
  mem_free = mem_free * 0.8;
  fd = open("/proc/sys/vm/nr_hugepages", O_RDWR | O_NONBLOCK);
  if (fd < 0) {
    perror("Failed to open /proc/sys/vm/nr_hugepages");
    return -1;
  }
  if (read(fd, initial_nr_hugepages, sizeof(initial_nr_hugepages)) <= 0) {
    perror("Failed to read from /proc/sys/vm/nr_hugepages");
    goto close_fd;
  }
  if (write(fd, "0", sizeof(char)) != sizeof(char)) {
    perror("Failed to write to /proc/sys/vm/nr_hugepages\n");
    goto close_fd;
  }
  lseek(fd, 0, SEEK_SET);
  if (write(fd, "100000", (6 * sizeof(char))) != (6 * sizeof(char))) {
    perror("Failed to write to /proc/sys/vm/nr_hugepages\n");
    goto close_fd;
  }
  lseek(fd, 0, SEEK_SET);
  if (read(fd, nr_hugepages, sizeof(nr_hugepages)) <= 0) {
    perror("Failed to read from /proc/sys/vm/nr_hugepages\n");
    goto close_fd;
  }
  compaction_index = mem_free / (atoi(nr_hugepages) * hugepage_size);
  if (compaction_index > 3) {
    printf("No of huge pages allocated = %d\n", (atoi(nr_hugepages)));
    fprintf(stderr,
            "ERROR: Less that 1/%d of memory is available\n"
            "as huge pages\n",
            compaction_index);
    goto close_fd;
  }
  printf("No of huge pages allocated = %d\n", (atoi(nr_hugepages)));
  if (write(fd, initial_nr_hugepages, sizeof(initial_nr_hugepages)) !=
      strlen(initial_nr_hugepages)) {
    perror("Failed to write to /proc/sys/vm/nr_hugepages\n");
    goto close_fd;
  }
  close(fd);
  return 0;
close_fd:
  close(fd);
  printf("Not OK. Compaction test failed.");
  return -1;
}


x86 assembly (clang, -O0):
<check_compaction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movw   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movw   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movaps 0xe27(%rip),%xmm1
movq   -0x10(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe26(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movsd  0xe0c(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    0x2db2(%rip),%rax
mov    (%rax),%esi
mov    0x2da1(%rip),%rax
or     (%rax),%esi
lea    0xe25(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1272 <check_compaction+0xd2>
lea    0xdcf(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    143c <check_compaction+0x29c>
mov    -0x18(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1080 <read@plt>
cmp    $0x0,%rax
jg     129e <check_compaction+0xfe>
lea    0xdc5(%rip),%rdi
call   10b0 <perror@plt>
jmp    141f <check_compaction+0x27f>
mov    -0x18(%rbp),%edi
lea    0xe12(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cltq
cmp    $0x1,%rax
je     12cf <check_compaction+0x12f>
lea    0xdc2(%rip),%rdi
call   10b0 <perror@plt>
jmp    141f <check_compaction+0x27f>
mov    -0x18(%rbp),%edi
mov    0x2cef(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    -0x18(%rbp),%edi
lea    0xdc9(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
cltq
cmp    $0x6,%rax
je     1313 <check_compaction+0x173>
lea    0xd7e(%rip),%rdi
call   10b0 <perror@plt>
jmp    141f <check_compaction+0x27f>
mov    -0x18(%rbp),%edi
mov    0x2cab(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    -0x18(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0xa,%edx
call   1080 <read@plt>
cmp    $0x0,%rax
jg     1352 <check_compaction+0x1b2>
lea    0xd74(%rip),%rdi
call   10b0 <perror@plt>
jmp    141f <check_compaction+0x27f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x38(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
imul   -0x14(%rbp),%ecx
mov    %ecx,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jle    13b7 <check_compaction+0x217>
lea    -0x38(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%esi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xd5f(%rip),%rsi
call   1090 <fprintf@plt>
jmp    141f <check_compaction+0x27f>
lea    -0x38(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%esi
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1030 <write@plt>
mov    %eax,-0x44(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
je     140b <check_compaction+0x26b>
lea    0xc86(%rip),%rdi
call   10b0 <perror@plt>
jmp    141f <check_compaction+0x27f>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    143c <check_compaction+0x29c>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_compaction>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %esi,%r14d
mov    %rdi,%r15
movw   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movw   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e11(%rip),%rax
mov    0x2e02(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe84(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     135d <check_compaction+0x1bd>
mov    %eax,%ebp
lea    0x18(%rsp),%rsi
mov    %eax,%edi
mov    $0xa,%edx
call   1080 <read@plt>
test   %rax,%rax
jle    136b <check_compaction+0x1cb>
lea    0xea1(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
jne    1354 <check_compaction+0x1b4>
mov    0x2d93(%rip),%rbx
mov    (%rbx),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
lea    0xe6e(%rip),%rsi
mov    %ebp,%edi
mov    $0x6,%edx
call   1030 <write@plt>
cmp    $0x6,%eax
jne    1354 <check_compaction+0x1b4>
mov    (%rbx),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0xa,%edx
call   1080 <read@plt>
test   %rax,%rax
jle    1374 <check_compaction+0x1d4>
movq   %r15,%xmm0
punpckldq 0xd72(%rip),%xmm0
subpd  0xd7a(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xd76(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xd6a(%rip),%xmm1
cvttsd2si %xmm1,%rbx
and    %rcx,%rbx
or     %rax,%rbx
lea    0x8(%rsp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%esi
imul   %eax,%r14d
mov    %rbx,%rax
shr    $0x20,%rax
je     12ef <check_compaction+0x14f>
mov    %rbx,%rax
xor    %edx,%edx
div    %r14
mov    %rax,%r14
jmp    12f9 <check_compaction+0x159>
mov    %ebx,%eax
xor    %edx,%edx
div    %r14d
mov    %eax,%r14d
lea    0xdeb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x4,%r14d
jl     1327 <check_compaction+0x187>
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
lea    0xdef(%rip),%rsi
mov    %r14d,%edx
call   1090 <fprintf@plt>
jmp    1380 <check_compaction+0x1e0>
lea    0x18(%rsp),%r14
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0xa,%edx
call   1030 <write@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebx
jne    1354 <check_compaction+0x1b4>
mov    %ebp,%edi
call   1070 <close@plt>
xor    %eax,%eax
jmp    139a <check_compaction+0x1fa>
lea    0xd2c(%rip),%rdi
jmp    137b <check_compaction+0x1db>
lea    0xccc(%rip),%rdi
call   10b0 <perror@plt>
jmp    1395 <check_compaction+0x1f5>
lea    0xce7(%rip),%rdi
jmp    137b <check_compaction+0x1db>
lea    0xd41(%rip),%rdi
call   10b0 <perror@plt>
mov    %ebp,%edi
call   1070 <close@plt>
lea    0xdba(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"/proc/sys/vm/nr_hugepages\00"
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
@.str.1 = [41 x i8] c"Failed to open /proc/sys/vm/nr_hugepages\00"
@.str.2 = [46 x i8] c"Failed to read from /proc/sys/vm/nr_hugepages\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [46 x i8] c"Failed to write to /proc/sys/vm/nr_hugepages\0A\00"
@SEEK_SET = global i32 0
@.str.5 = [7 x i8] c"100000\00"
@.str.6 = [47 x i8] c"Failed to read from /proc/sys/vm/nr_hugepages\0A\00"
@.str.7 = [33 x i8] c"No of huge pages allocated = %d\0A\00"
@stderr = global i32 0
@.str.8 = [60 x i8] c"ERROR: Less that 1/%d of memory is available\0Aas huge pages\0A\00"
@.str.9 = [32 x i8] c"Not OK. Compaction test failed.\00"
define i32 @check_compaction(i64 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10 x i8]
%9 = alloca [10 x i8]
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 0, i32* %7
%10 = bitcast [10 x i8]* %8 to i8*
%11 = bitcast [10 x i8]* %9 to i8*
%12 = load i64, i64* %4
%13 = uitofp i64 %12 to double
%14 = fmul double %13, 8.000000e-01
%15 = fptoui double %14 to i64
store i64 %15, i64* %4
%16 = load i32, i32* @O_RDWR
%17 = load i32, i32* @O_NONBLOCK
%18 = or i32 %16, %17
%19 = call i32 @open(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %95
24: ; preds = %2
%25 = load i32, i32* %6
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%27 = call i64 @read(i32 %25, i8* %26, i32 10)
%28 = icmp sle i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %91
31: ; preds = %24
%32 = load i32, i32* %6
%33 = call i32 @write(i32 %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%34 = sext i32 %33 to i64
%35 = icmp ne i64 %34, 1
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
br label %91
38: ; preds = %31
%39 = load i32, i32* %6
%40 = load i32, i32* @SEEK_SET
%41 = call i32 @lseek(i32 %39, i32 0, i32 %40)
%42 = load i32, i32* %6
%43 = call i32 @write(i32 %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%44 = sext i32 %43 to i64
%45 = icmp ne i64 %44, 6
br i1 %45, label %46, label %48
46: ; preds = %38
%47 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
br label %91
48: ; preds = %38
%49 = load i32, i32* %6
%50 = load i32, i32* @SEEK_SET
%51 = call i32 @lseek(i32 %49, i32 0, i32 %50)
%52 = load i32, i32* %6
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%54 = call i64 @read(i32 %52, i8* %53, i32 10)
%55 = icmp sle i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
br label %91
58: ; preds = %48
%59 = load i64, i64* %4
%60 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%61 = call i32 @atoi(i8* %60)
%62 = load i32, i32* %5
%63 = mul i32 %61, %62
%64 = zext i32 %63 to i64
%65 = udiv i64 %59, %64
%66 = trunc i64 %65 to i32
store i32 %66, i32* %7
%67 = load i32, i32* %7
%68 = icmp sgt i32 %67, 3
br i1 %68, label %69, label %76
69: ; preds = %58
%70 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%71 = call i32 @atoi(i8* %70)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %71)
%73 = load i32, i32* @stderr
%74 = load i32, i32* %7
%75 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 %74)
br label %91
76: ; preds = %58
%77 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%78 = call i32 @atoi(i8* %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %6
%81 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%82 = call i32 @write(i32 %80, i8* %81, i32 10)
%83 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%84 = call i32 @strlen(i8* %83)
%85 = icmp ne i32 %82, %84
br i1 %85, label %86, label %88
86: ; preds = %76
%87 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
br label %91
88: ; preds = %76
%89 = load i32, i32* %6
%90 = call i32 @close(i32 %89)
store i32 0, i32* %3
br label %95
91: ; preds = %86, %69, %56, %46, %36, %29
%92 = load i32, i32* %6
%93 = call i32 @close(i32 %92)
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %3
br label %95
95: ; preds = %91, %88, %22
%96 = load i32, i32* %3
ret i32 %96
}

LLVM IR (-O2):
@.str = [26 x i8] c"/proc/sys/vm/nr_hugepages\00"
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
@.str.1 = [41 x i8] c"Failed to open /proc/sys/vm/nr_hugepages\00"
@.str.2 = [46 x i8] c"Failed to read from /proc/sys/vm/nr_hugepages\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [46 x i8] c"Failed to write to /proc/sys/vm/nr_hugepages\0A\00"
@SEEK_SET = global i32 0
@.str.5 = [7 x i8] c"100000\00"
@.str.6 = [47 x i8] c"Failed to read from /proc/sys/vm/nr_hugepages\0A\00"
@.str.7 = [33 x i8] c"No of huge pages allocated = %d\0A\00"
@stderr = global i32 0
@.str.8 = [60 x i8] c"ERROR: Less that 1/%d of memory is available\0Aas huge pages\0A\00"
@.str.9 = [32 x i8] c"Not OK. Compaction test failed.\00"
define i32 @check_compaction(i64 %0, i32 %1) {
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%7 = uitofp i64 %0 to double
%8 = fmul double %7, 8.000000e-01
%9 = fptoui double %8 to i64
%10 = load i32, i32* @O_RDWR
%11 = load i32, i32* @O_NONBLOCK
%12 = or i32 %11, %10
%13 = tail call i32 @open(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %63
17: ; preds = %2
%18 = call i64 @read(i32 %13, i8* %5, i32 10)
%19 = icmp slt i64 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %60
22: ; preds = %17
%23 = tail call i32 @write(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%24 = icmp eq i32 %23, 1
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
br label %60
27: ; preds = %22
%28 = load i32, i32* @SEEK_SET
%29 = tail call i32 @lseek(i32 %13, i32 0, i32 %28)
%30 = tail call i32 @write(i32 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%31 = icmp eq i32 %30, 6
br i1 %31, label %34, label %32
32: ; preds = %27
%33 = tail call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
br label %60
34: ; preds = %27
%35 = load i32, i32* @SEEK_SET
%36 = tail call i32 @lseek(i32 %13, i32 0, i32 %35)
%37 = call i64 @read(i32 %13, i8* %6, i32 10)
%38 = icmp slt i64 %37, 1
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = tail call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
br label %60
41: ; preds = %34
%42 = call i32 @atoi(i8* %6)
%43 = mul i32 %42, %1
%44 = zext i32 %43 to i64
%45 = udiv i64 %9, %44
%46 = trunc i64 %45 to i32
%47 = icmp sgt i32 %46, 3
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %42)
br i1 %47, label %49, label %52
49: ; preds = %41
%50 = load i32, i32* @stderr
%51 = tail call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 %46)
br label %60
52: ; preds = %41
%53 = call i32 @write(i32 %13, i8* %5, i32 10)
%54 = call i32 @strlen(i8* %5)
%55 = icmp eq i32 %53, %54
br i1 %55, label %58, label %56
56: ; preds = %52
%57 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
br label %60
58: ; preds = %52
%59 = call i32 @close(i32 %13)
br label %63
60: ; preds = %56, %49, %39, %32, %25, %20
%61 = call i32 @close(i32 %13)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
br label %63
63: ; preds = %60, %58, %15
%64 = phi i32 [ -1, %15 ], [ -1, %60 ], [ 0, %58 ]
ret i32 %64
}