#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);
int hugetlbfs_unlinked_fd();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_init(int, char **);
int main(int argc, char *argv[]) {
  int fd;
  test_init(argc, argv);
  fd = hugetlbfs_unlinked_fd();
  if (fd < 0)
    do {
      cleanup();
      printf("PASS\n");
      exit(0);
    } while (0);
  do {
    cleanup();
    printf("FAIL\t"
           "Mysteriously found a mount"
           "\n");
    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 <hugetlbfs_unlinked_fd@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11a5 <main+0x55>
jmp    118b <main+0x3b>
mov    $0x0,%al
call   1060 <cleanup@plt>
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
jmp    11aa <main+0x5a>
mov    $0x0,%al
call   1060 <cleanup@plt>
lea    0xe4e(%rip),%rdi
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   1050 <hugetlbfs_unlinked_fd@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <cleanup@plt>
test   %ebx,%ebx
jns    117d <main+0x2d>
lea    0xeaf(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"PASS\0A\00"
@.str.1 = [33 x i8] c"FAIL\09Mysteriously found a mount\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
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 i32 (...) @hugetlbfs_unlinked_fd()
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %2
br label %14
14: ; preds = %13
%15 = call i32 (...) @cleanup()
%16 = call i32 @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 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 2)
unreachable
24: ; No predecessors!
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@str = [32 x i8] c"FAIL\09Mysteriously found a mount\00"
@str.2 = [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 i32 (...) @hugetlbfs_unlinked_fd()
%5 = icmp slt i32 %4, 0
%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.2, i64 0, i64 0))
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 2)
unreachable
}