#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*/ cleanup();
int /*<<< orphan*/ exit(int);
long gethugepagesize();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ test_init(int, char **);
int main(int argc, char *argv[]) {
  long hpage_size;
  test_init(argc, argv);
  hpage_size = gethugepagesize();
  if (hpage_size == -1)
    do {
      cleanup();
      printf("PASS\n");
      exit(0);
    } while (0);
  do {
    cleanup();
    printf("FAIL\t"
           "Mysteriously found a hugepage size of %ld\n"
           "\n",
           hpage_size);
    exit(2);
  } while (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_init@plt>
mov    $0x0,%al
call   1050 <gethugepagesize@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    11a9 <main+0x59>
jmp    118d <main+0x3d>
mov    $0x0,%al
call   1060 <cleanup@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
jmp    11ae <main+0x5e>
mov    $0x0,%al
call   1060 <cleanup@plt>
mov    -0x18(%rbp),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1030 <test_init@plt>
xor    %eax,%eax
call   1060 <gethugepagesize@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <cleanup@plt>
cmp    $0xffffffffffffffff,%rbx
jne    1190 <main+0x30>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>
lea    0xe69(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"PASS\0A\00"
@.str.1 = [49 x i8] c"FAIL\09Mysteriously found a hugepage size of %ld\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @test_init(i32 %7, i8** %8)
%10 = call i64 (...) @gethugepagesize()
store i64 %10, i64* %6
%11 = load i64, i64* %6
%12 = icmp eq i64 %11, -1
br i1 %12, label %13, label %19
13: ; preds = %2
br label %14
14: ; preds = %13
%15 = call i32 (...) @cleanup()
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 0)
unreachable
18: ; No predecessors!
br label %19
19: ; preds = %18, %2
br label %20
20: ; preds = %19
%21 = call i32 (...) @cleanup()
%22 = load i64, i64* %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i64 %22)
%24 = call i32 @exit(i32 2)
unreachable
25: ; No predecessors!
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str.1 = [49 x i8] c"FAIL\09Mysteriously found a hugepage size of %ld\0A\0A\00"
@str = [5 x i8] c"PASS\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @test_init(i32 %0, i8** %1)
%4 = tail call i64 (...) @gethugepagesize()
%5 = icmp eq i64 %4, -1
%6 = tail call i32 (...) @cleanup()
br i1 %5, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i64 %4)
%12 = tail call i32 @exit(i32 2)
unreachable
}