#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 0 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 100000 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 re-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, strlen(initial_nr_hugepages)) !=
      strlen(initial_nr_hugepages)) {
    perror("Failed to write value 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    $0x60,%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    1450 <check_compaction+0x2b0>
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    1433 <check_compaction+0x293>
mov    -0x18(%rbp),%edi
lea    0xe14(%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    1433 <check_compaction+0x293>
mov    -0x18(%rbp),%edi
mov    0x2cef(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    -0x18(%rbp),%edi
lea    0xdcb(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
cltq
cmp    $0x6,%rax
je     1313 <check_compaction+0x173>
lea    0xdb5(%rip),%rdi
call   10b0 <perror@plt>
jmp    1433 <check_compaction+0x293>
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    0xdab(%rip),%rdi
call   10b0 <perror@plt>
jmp    1433 <check_compaction+0x293>
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    0xd92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xd99(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1433 <check_compaction+0x293>
lea    -0x38(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%esi
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x54(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rsi
mov    %eax,%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     141f <check_compaction+0x27f>
lea    0xd6d(%rip),%rdi
call   10b0 <perror@plt>
jmp    1433 <check_compaction+0x293>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    1450 <check_compaction+0x2b0>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%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     1359 <check_compaction+0x1b9>
mov    %eax,%ebp
lea    0x18(%rsp),%rsi
mov    %eax,%edi
mov    $0xa,%edx
call   1080 <read@plt>
test   %rax,%rax
jle    1367 <check_compaction+0x1c7>
lea    0xea3(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
jne    1370 <check_compaction+0x1d0>
mov    0x2d93(%rip),%rbx
mov    (%rbx),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
lea    0xe70(%rip),%rsi
mov    %ebp,%edi
mov    $0x6,%edx
call   1030 <write@plt>
cmp    $0x6,%eax
jne    1379 <check_compaction+0x1d9>
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    1382 <check_compaction+0x1e2>
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    0xe25(%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    0xe29(%rip),%rsi
mov    %r14d,%edx
call   1090 <fprintf@plt>
jmp    1397 <check_compaction+0x1f7>
lea    0x18(%rsp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebx
jne    138b <check_compaction+0x1eb>
mov    %ebp,%edi
call   1070 <close@plt>
xor    %eax,%eax
jmp    13b1 <check_compaction+0x211>
lea    0xcd0(%rip),%rdi
call   10b0 <perror@plt>
jmp    13ac <check_compaction+0x20c>
lea    0xceb(%rip),%rdi
jmp    1392 <check_compaction+0x1f2>
lea    0xd10(%rip),%rdi
jmp    1392 <check_compaction+0x1f2>
lea    0xd3e(%rip),%rdi
jmp    1392 <check_compaction+0x1f2>
lea    0xd6a(%rip),%rdi
jmp    1392 <check_compaction+0x1f2>
lea    0xdf0(%rip),%rdi
call   10b0 <perror@plt>
mov    %ebp,%edi
call   1070 <close@plt>
lea    0xe11(%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 = [48 x i8] c"Failed to write 0 to /proc/sys/vm/nr_hugepages\0A\00"
@SEEK_SET = global i32 0
@.str.5 = [7 x i8] c"100000\00"
@.str.6 = [53 x i8] c"Failed to write 100000 to /proc/sys/vm/nr_hugepages\0A\00"
@.str.7 = [50 x i8] c"Failed to re-read from /proc/sys/vm/nr_hugepages\0A\00"
@.str.8 = [33 x i8] c"No of huge pages allocated = %d\0A\00"
@stderr = global i32 0
@.str.9 = [60 x i8] c"ERROR: Less that 1/%d of memory is available\0Aas huge pages\0A\00"
@.str.10 = [52 x i8] c"Failed to write value to /proc/sys/vm/nr_hugepages\0A\00"
@.str.11 = [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 %97
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 %93
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 ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
br label %93
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 ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0))
br label %93
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 ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
br label %93
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.8, 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.9, i64 0, i64 0), i32 %74)
br label %93
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.8, 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 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%83 = call i32 @strlen(i8* %82)
%84 = call i32 @write(i32 %80, i8* %81, i32 %83)
%85 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%86 = call i32 @strlen(i8* %85)
%87 = icmp ne i32 %84, %86
br i1 %87, label %88, label %90
88: ; preds = %76
%89 = call i32 @perror(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0))
br label %93
90: ; preds = %76
%91 = load i32, i32* %6
%92 = call i32 @close(i32 %91)
store i32 0, i32* %3
br label %97
93: ; preds = %88, %69, %56, %46, %36, %29
%94 = load i32, i32* %6
%95 = call i32 @close(i32 %94)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
store i32 -1, i32* %3
br label %97
97: ; preds = %93, %90, %22
%98 = load i32, i32* %3
ret i32 %98
}

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 = [48 x i8] c"Failed to write 0 to /proc/sys/vm/nr_hugepages\0A\00"
@SEEK_SET = global i32 0
@.str.5 = [7 x i8] c"100000\00"
@.str.6 = [53 x i8] c"Failed to write 100000 to /proc/sys/vm/nr_hugepages\0A\00"
@.str.7 = [50 x i8] c"Failed to re-read from /proc/sys/vm/nr_hugepages\0A\00"
@.str.8 = [33 x i8] c"No of huge pages allocated = %d\0A\00"
@stderr = global i32 0
@.str.9 = [60 x i8] c"ERROR: Less that 1/%d of memory is available\0Aas huge pages\0A\00"
@.str.10 = [52 x i8] c"Failed to write value to /proc/sys/vm/nr_hugepages\0A\00"
@.str.11 = [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 %64
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 %61
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 ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
br label %61
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 ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0))
br label %61
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 ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
br label %61
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.8, 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.9, i64 0, i64 0), i32 %46)
br label %61
52: ; preds = %41
%53 = call i32 @strlen(i8* %5)
%54 = call i32 @write(i32 %13, i8* %5, i32 %53)
%55 = call i32 @strlen(i8* %5)
%56 = icmp eq i32 %54, %55
br i1 %56, label %59, label %57
57: ; preds = %52
%58 = call i32 @perror(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0))
br label %61
59: ; preds = %52
%60 = call i32 @close(i32 %13)
br label %64
61: ; preds = %57, %49, %39, %32, %25, %20
%62 = call i32 @close(i32 %13)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
br label %64
64: ; preds = %61, %59, %15
%65 = phi i32 [ -1, %15 ], [ -1, %61 ], [ 0, %59 ]
ret i32 %65
}