#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*/ alloc_alterhuge(int);
int /*<<< orphan*/ alloc_alterhuge_above_hint(int);
int /*<<< orphan*/ alloc_alterhuge_below_hint(int);
int /*<<< orphan*/ alloc_huge(int);
int /*<<< orphan*/ alloc_huge_above_hint(int);
int /*<<< orphan*/ alloc_huge_below_hint(int);
int /*<<< orphan*/ alloc_huge_reverse(int);
int /*<<< orphan*/ alloc_page_full();
int /*<<< orphan*/ alloc_page_full_reverse();
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fixed_position(int, int, int);
int getopt(int, char **, char *);
int /*<<< orphan*/ mixed_position_alterhuge(int, int, int);
int /*<<< orphan*/ mixed_position_hugepage(int, int, int);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int option = 0;
  int scenario = 0, def_chunks = 0, chunks = 0, chunks_2 = 0;
  int ret = 0;
  if (argc < 3) {
    printf("Usage <execname> -s <scenario_no> -n <nr_chunks> -h <nr_chunks> -d "
           "<def_chunks>\n");
    exit(-1);
  }
  while (1) {
    option = getopt(argc, argv, "s:n:h:d:");
    if (option != -1) {
      switch (option) {
      case 's':
        scenario = atoi(optarg);
        break;
      case 'n':
        chunks = atoi(optarg);
        break;
      case 'h':
        chunks_2 = atoi(optarg);
        break;
      case 'd':
        def_chunks = atoi(optarg);
        break;
      default:
        printf("Usage <execname> -s <scenario_no> -n <nr_chunks> -h "
               "<nr_chunks> -d <def_chunks>\n");
        exit(-1);
      }
    } else
      break;
  }
  switch (scenario) {
  case 1:
    printf("\nScenario 1 : Alloc default pagesize from 0-512 tb VA with above "
           "128 first\n\n");
    alloc_page_full_reverse();
    break;
  case 2:
    printf("\nScenario 2 : Alloc default page from 0-512 tb VA\n\n");
    alloc_page_full();
    break;
  case 3:
    printf("\nScenario 3 : Get hugepage VA Below 128Tb mark \n\n");
    alloc_huge_below_hint(chunks);
    break;
  case 4:
    printf("\nScenario 4 : Get hugepage VA Above 128Tb mark \n\n");
    alloc_huge_above_hint(chunks);
    break;
  case 5:
    printf("\nScenario 5 : Get hugepage VA Above and Below 128Tb mark \n\n");
    alloc_huge_reverse(chunks);
    break;
  case 6:
    printf("\nScenario 6 : Get hugepage VA Below and Above 128Tb mark \n\n");
    alloc_huge(chunks);
    break;
  case 7:
    printf("\nScenario 7 : Get alternate hugepage VA Below 128T mark\n\n");
    alloc_alterhuge_below_hint(chunks);
    break;
  case 8:
    printf("\nScenario 8 : Get alternate hugepage VA Above 128T mark\n\n");
    alloc_alterhuge_above_hint(chunks);
    break;
  case 9:
    printf("\nScenario 9 : Get alternate hugepage VA below and Above 128T "
           "mark\n\n");
    alloc_alterhuge(chunks);
    break;
  case 10:
    printf("\nScenario 10 : Mix of all default page, small and large hugepage "
           "in VA\n\n");
    fixed_position(def_chunks, chunks, chunks_2);
    break;
  case 11:
    printf("\nScenario 11 : Mix default hugepage in between default page and "
           "alternate hugepage in VA\n\n");
    mixed_position_hugepage(def_chunks, chunks, chunks_2);
    break;
  case 12:
    printf("\nScenario 12 : Mix alternate hugepage in between default page and "
           "default hugepage in VA\n\n");
    mixed_position_alterhuge(def_chunks, chunks, chunks_2);
    break;
  default:
    printf("Please Provide valid scenario\n");
    break;
  }
  printf("Test Passed!!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1260 <main+0x60>
lea    0xe1f(%rip),%rdi
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
jmp    1265 <main+0x65>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe4e(%rip),%rdx
call   10d0 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1321 <main+0x121>
mov    -0x14(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0xf,%eax
ja     1306 <main+0x106>
mov    -0x30(%rbp),%rax
lea    0xd8b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    131c <main+0x11c>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    131c <main+0x11c>
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    131c <main+0x11c>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    131c <main+0x11c>
lea    0xd63(%rip),%rdi
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
jmp    1326 <main+0x126>
jmp    132b <main+0x12b>
jmp    1265 <main+0x65>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0xb,%eax
ja     1490 <main+0x290>
mov    -0x38(%rbp),%rax
lea    0xcb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xd6f(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1030 <alloc_page_full_reverse@plt>
jmp    149c <main+0x29c>
lea    0xda4(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <alloc_page_full@plt>
jmp    149c <main+0x29c>
lea    0xdc0(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%edi
call   1050 <alloc_huge_below_hint@plt>
jmp    149c <main+0x29c>
lea    0xdd9(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%edi
call   1120 <alloc_huge_above_hint@plt>
jmp    149c <main+0x29c>
lea    0xdf2(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%edi
call   1080 <alloc_huge_reverse@plt>
jmp    149c <main+0x29c>
lea    0xe15(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%edi
call   10e0 <alloc_huge@plt>
jmp    149c <main+0x29c>
lea    0xe38(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%edi
call   10a0 <alloc_alterhuge_below_hint@plt>
jmp    149c <main+0x29c>
lea    0xe59(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%edi
call   1060 <alloc_alterhuge_above_hint@plt>
jmp    149c <main+0x29c>
lea    0xe7a(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%edi
call   1100 <alloc_alterhuge@plt>
jmp    149c <main+0x29c>
lea    0xea5(%rip),%rdi
call   1070 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   10b0 <fixed_position@plt>
jmp    149c <main+0x29c>
lea    0xecf(%rip),%rdi
call   1070 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   10c0 <mixed_position_hugepage@plt>
jmp    149c <main+0x29c>
lea    0xf0b(%rip),%rdi
call   1070 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <mixed_position_alterhuge@plt>
jmp    149c <main+0x29c>
lea    0xf47(%rip),%rdi
call   1070 <printf@plt>
lea    0xf5a(%rip),%rdi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x3,%edi
jl     141c <main+0x21c>
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
lea    0xe0d(%rip),%r13
mov    0x2dce(%rip),%r15
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
xor    %r12d,%r12d
jmp    124b <main+0x4b>
xchg   %ax,%ax
mov    (%r15),%edi
call   10f0 <atoi@plt>
mov    %eax,%r12d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10d0 <getopt@plt>
cmp    $0x68,%eax
je     1240 <main+0x40>
cmp    $0x6d,%eax
jg     127e <main+0x7e>
cmp    $0xffffffff,%eax
je     12a6 <main+0xa6>
cmp    $0x64,%eax
jne    141c <main+0x21c>
mov    (%r15),%edi
call   10f0 <atoi@plt>
mov    %eax,0x4(%rsp)
jmp    124b <main+0x4b>
cmp    $0x6e,%eax
je     1299 <main+0x99>
cmp    $0x73,%eax
jne    141c <main+0x21c>
mov    (%r15),%edi
call   10f0 <atoi@plt>
mov    %eax,%r14d
jmp    124b <main+0x4b>
mov    (%r15),%edi
call   10f0 <atoi@plt>
mov    %eax,(%rsp)
jmp    124b <main+0x4b>
add    $0xffffffff,%r14d
cmp    $0xb,%r14d
ja     12d8 <main+0xd8>
lea    0xd49(%rip),%rax
movslq (%rax,%r14,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x103c(%rip),%rdi
call   1060 <puts@plt>
xor    %eax,%eax
call   1030 <alloc_page_full_reverse@plt>
jmp    13ff <main+0x1ff>
lea    0x1070(%rip),%rdi
call   1060 <puts@plt>
jmp    13ff <main+0x1ff>
lea    0xfe0(%rip),%rdi
call   1060 <puts@plt>
xor    %eax,%eax
call   1090 <alloc_page_full@plt>
jmp    13ff <main+0x1ff>
lea    0xf97(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%edi
call   1050 <alloc_huge_below_hint@plt>
jmp    13ff <main+0x1ff>
lea    0xf4d(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%edi
call   1120 <alloc_huge_above_hint@plt>
jmp    13ff <main+0x1ff>
lea    0xef9(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%edi
call   1080 <alloc_huge_reverse@plt>
jmp    13ff <main+0x1ff>
lea    0xea5(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%edi
call   10e0 <alloc_huge@plt>
jmp    13ff <main+0x1ff>
lea    0xe53(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%edi
call   10a0 <alloc_alterhuge_below_hint@plt>
jmp    13ff <main+0x1ff>
lea    0xe01(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%edi
call   1070 <alloc_alterhuge_above_hint@plt>
jmp    13ff <main+0x1ff>
lea    0xda8(%rip),%rdi
call   1060 <puts@plt>
mov    (%rsp),%edi
call   1100 <alloc_alterhuge@plt>
jmp    13ff <main+0x1ff>
lea    0xd4a(%rip),%rdi
call   1060 <puts@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %r12d,%edx
call   10b0 <fixed_position@plt>
jmp    13ff <main+0x1ff>
lea    0xcd3(%rip),%rdi
call   1060 <puts@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %r12d,%edx
call   10c0 <mixed_position_hugepage@plt>
jmp    13ff <main+0x1ff>
lea    0xc4e(%rip),%rdi
call   1060 <puts@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %r12d,%edx
call   1040 <mixed_position_alterhuge@plt>
lea    0xc8d(%rip),%rdi
call   1060 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xf4a(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@.str = [81 x i8] c"Usage <execname> -s <scenario_no> -n <nr_chunks> -h <nr_chunks> -d <def_chunks>\0A\00"
@.str.1 = [9 x i8] c"s:n:h:d:\00"
@optarg = global i32 0
@.str.2 = [77 x i8] c"\0AScenario 1 : Alloc default pagesize from 0-512 tb VA with above 128 first\0A\0A\00"
@.str.3 = [52 x i8] c"\0AScenario 2 : Alloc default page from 0-512 tb VA\0A\0A\00"
@.str.4 = [50 x i8] c"\0AScenario 3 : Get hugepage VA Below 128Tb mark \0A\0A\00"
@.str.5 = [50 x i8] c"\0AScenario 4 : Get hugepage VA Above 128Tb mark \0A\0A\00"
@.str.6 = [60 x i8] c"\0AScenario 5 : Get hugepage VA Above and Below 128Tb mark \0A\0A\00"
@.str.7 = [60 x i8] c"\0AScenario 6 : Get hugepage VA Below and Above 128Tb mark \0A\0A\00"
@.str.8 = [58 x i8] c"\0AScenario 7 : Get alternate hugepage VA Below 128T mark\0A\0A\00"
@.str.9 = [58 x i8] c"\0AScenario 8 : Get alternate hugepage VA Above 128T mark\0A\0A\00"
@.str.10 = [68 x i8] c"\0AScenario 9 : Get alternate hugepage VA below and Above 128T mark\0A\0A\00"
@.str.11 = [73 x i8] c"\0AScenario 10 : Mix of all default page, small and large hugepage in VA\0A\0A\00"
@.str.12 = [91 x i8] c"\0AScenario 11 : Mix default hugepage in between default page and alternate hugepage in VA\0A\0A\00"
@.str.13 = [91 x i8] c"\0AScenario 12 : Mix alternate hugepage in between default page and default hugepage in VA\0A\0A\00"
@.str.14 = [31 x i8] c"Please Provide valid scenario\0A\00"
@.str.15 = [15 x i8] c"Test Passed!!\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %2
br label %18
18: ; preds = %17, %43
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call i32 @getopt(i32 %19, i8** %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %42
24: ; preds = %18
%25 = load i32, i32* %6
switch i32 %25, label %38 [
i32 115, label %26
i32 110, label %29
i32 104, label %32
i32 100, label %35
]
26: ; preds = %24
%27 = load i32, i32* @optarg
%28 = call i32 @atoi(i32 %27)
store i32 %28, i32* %7
br label %41
29: ; preds = %24
%30 = load i32, i32* @optarg
%31 = call i32 @atoi(i32 %30)
store i32 %31, i32* %9
br label %41
32: ; preds = %24
%33 = load i32, i32* @optarg
%34 = call i32 @atoi(i32 %33)
store i32 %34, i32* %10
br label %41
35: ; preds = %24
%36 = load i32, i32* @optarg
%37 = call i32 @atoi(i32 %36)
store i32 %37, i32* %8
br label %41
38: ; preds = %24
%39 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%40 = call i32 @exit(i32 -1)
unreachable
41: ; preds = %35, %32, %29, %26
br label %43
42: ; preds = %18
br label %44
43: ; preds = %41
br label %18
44: ; preds = %42
%45 = load i32, i32* %7
switch i32 %45, label %98 [
i32 1, label %46
i32 2, label %49
i32 3, label %52
i32 4, label %56
i32 5, label %60
i32 6, label %64
i32 7, label %68
i32 8, label %72
i32 9, label %76
i32 10, label %80
i32 11, label %86
i32 12, label %92
]
46: ; preds = %44
%47 = call i32 @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 (...) @alloc_page_full_reverse()
br label %100
49: ; preds = %44
%50 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%51 = call i32 (...) @alloc_page_full()
br label %100
52: ; preds = %44
%53 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%54 = load i32, i32* %9
%55 = call i32 @alloc_huge_below_hint(i32 %54)
br label %100
56: ; preds = %44
%57 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%58 = load i32, i32* %9
%59 = call i32 @alloc_huge_above_hint(i32 %58)
br label %100
60: ; preds = %44
%61 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%62 = load i32, i32* %9
%63 = call i32 @alloc_huge_reverse(i32 %62)
br label %100
64: ; preds = %44
%65 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0))
%66 = load i32, i32* %9
%67 = call i32 @alloc_huge(i32 %66)
br label %100
68: ; preds = %44
%69 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
%70 = load i32, i32* %9
%71 = call i32 @alloc_alterhuge_below_hint(i32 %70)
br label %100
72: ; preds = %44
%73 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0))
%74 = load i32, i32* %9
%75 = call i32 @alloc_alterhuge_above_hint(i32 %74)
br label %100
76: ; preds = %44
%77 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.10, i64 0, i64 0))
%78 = load i32, i32* %9
%79 = call i32 @alloc_alterhuge(i32 %78)
br label %100
80: ; preds = %44
%81 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.11, i64 0, i64 0))
%82 = load i32, i32* %8
%83 = load i32, i32* %9
%84 = load i32, i32* %10
%85 = call i32 @fixed_position(i32 %82, i32 %83, i32 %84)
br label %100
86: ; preds = %44
%87 = call i32 @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.12, i64 0, i64 0))
%88 = load i32, i32* %8
%89 = load i32, i32* %9
%90 = load i32, i32* %10
%91 = call i32 @mixed_position_hugepage(i32 %88, i32 %89, i32 %90)
br label %100
92: ; preds = %44
%93 = call i32 @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.13, i64 0, i64 0))
%94 = load i32, i32* %8
%95 = load i32, i32* %9
%96 = load i32, i32* %10
%97 = call i32 @mixed_position_alterhuge(i32 %94, i32 %95, i32 %96)
br label %100
98: ; preds = %44
%99 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
br label %100
100: ; preds = %98, %92, %86, %80, %76, %72, %68, %64, %60, %56, %52, %49, %46
%101 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"s:n:h:d:\00"
@optarg = global i32 0
@str = [90 x i8] c"\0AScenario 12 : Mix alternate hugepage in between default page and default hugepage in VA\0A\00"
@str.16 = [14 x i8] c"Test Passed!!\00"
@str.17 = [90 x i8] c"\0AScenario 11 : Mix default hugepage in between default page and alternate hugepage in VA\0A\00"
@str.18 = [72 x i8] c"\0AScenario 10 : Mix of all default page, small and large hugepage in VA\0A\00"
@str.19 = [67 x i8] c"\0AScenario 9 : Get alternate hugepage VA below and Above 128T mark\0A\00"
@str.20 = [57 x i8] c"\0AScenario 8 : Get alternate hugepage VA Above 128T mark\0A\00"
@str.21 = [57 x i8] c"\0AScenario 7 : Get alternate hugepage VA Below 128T mark\0A\00"
@str.22 = [59 x i8] c"\0AScenario 6 : Get hugepage VA Below and Above 128Tb mark \0A\00"
@str.23 = [59 x i8] c"\0AScenario 5 : Get hugepage VA Above and Below 128Tb mark \0A\00"
@str.24 = [49 x i8] c"\0AScenario 4 : Get hugepage VA Above 128Tb mark \0A\00"
@str.25 = [49 x i8] c"\0AScenario 3 : Get hugepage VA Below 128Tb mark \0A\00"
@str.26 = [51 x i8] c"\0AScenario 2 : Alloc default page from 0-512 tb VA\0A\00"
@str.27 = [76 x i8] c"\0AScenario 1 : Alloc default pagesize from 0-512 tb VA with above 128 first\0A\00"
@str.28 = [30 x i8] c"Please Provide valid scenario\00"
@str.30 = [80 x i8] c"Usage <execname> -s <scenario_no> -n <nr_chunks> -h <nr_chunks> -d <def_chunks>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str.30, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %25, %28
%8 = phi i32 [ %30, %28 ], [ %27, %25 ]
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
switch i32 %9, label %34 [
i32 -1, label %37
i32 115, label %10
i32 110, label %22
i32 104, label %28
i32 100, label %31
]
10: ; preds = %7
%11 = load i32, i32* @optarg
%12 = tail call i32 @atoi(i32 %11)
br label %13
13: ; preds = %2, %10
%14 = phi i32 [ %12, %10 ], [ 0, %2 ]
%15 = phi i32 [ %19, %10 ], [ 0, %2 ]
%16 = phi i32 [ %26, %10 ], [ 0, %2 ]
%17 = phi i32 [ %8, %10 ], [ 0, %2 ]
br label %18
18: ; preds = %13, %31
%19 = phi i32 [ %15, %13 ], [ %33, %31 ]
%20 = phi i32 [ %16, %13 ], [ %26, %31 ]
%21 = phi i32 [ %17, %13 ], [ %8, %31 ]
br label %25
22: ; preds = %7
%23 = load i32, i32* @optarg
%24 = tail call i32 @atoi(i32 %23)
br label %25
25: ; preds = %18, %22
%26 = phi i32 [ %20, %18 ], [ %24, %22 ]
%27 = phi i32 [ %21, %18 ], [ %8, %22 ]
br label %7
28: ; preds = %7
%29 = load i32, i32* @optarg
%30 = tail call i32 @atoi(i32 %29)
br label %7
31: ; preds = %7
%32 = load i32, i32* @optarg
%33 = tail call i32 @atoi(i32 %32)
br label %18
34: ; preds = %7
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str.30, i64 0, i64 0))
%36 = tail call i32 @exit(i32 -1)
unreachable
37: ; preds = %7
switch i32 %14, label %74 [
i32 1, label %38
i32 2, label %41
i32 3, label %44
i32 4, label %47
i32 5, label %50
i32 6, label %53
i32 7, label %56
i32 8, label %59
i32 9, label %62
i32 10, label %65
i32 11, label %68
i32 12, label %71
]
38: ; preds = %37
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.27, i64 0, i64 0))
%40 = tail call i32 (...) @alloc_page_full_reverse()
br label %76
41: ; preds = %37
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.26, i64 0, i64 0))
%43 = tail call i32 (...) @alloc_page_full()
br label %76
44: ; preds = %37
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.25, i64 0, i64 0))
%46 = tail call i32 @alloc_huge_below_hint(i32 %26)
br label %76
47: ; preds = %37
%48 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.24, i64 0, i64 0))
%49 = tail call i32 @alloc_huge_above_hint(i32 %26)
br label %76
50: ; preds = %37
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.23, i64 0, i64 0))
%52 = tail call i32 @alloc_huge_reverse(i32 %26)
br label %76
53: ; preds = %37
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.22, i64 0, i64 0))
%55 = tail call i32 @alloc_huge(i32 %26)
br label %76
56: ; preds = %37
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.21, i64 0, i64 0))
%58 = tail call i32 @alloc_alterhuge_below_hint(i32 %26)
br label %76
59: ; preds = %37
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.20, i64 0, i64 0))
%61 = tail call i32 @alloc_alterhuge_above_hint(i32 %26)
br label %76
62: ; preds = %37
%63 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.19, i64 0, i64 0))
%64 = tail call i32 @alloc_alterhuge(i32 %26)
br label %76
65: ; preds = %37
%66 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.18, i64 0, i64 0))
%67 = tail call i32 @fixed_position(i32 %19, i32 %26, i32 %8)
br label %76
68: ; preds = %37
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([90 x i8], [90 x i8]* @str.17, i64 0, i64 0))
%70 = tail call i32 @mixed_position_hugepage(i32 %19, i32 %26, i32 %8)
br label %76
71: ; preds = %37
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([90 x i8], [90 x i8]* @str, i64 0, i64 0))
%73 = tail call i32 @mixed_position_alterhuge(i32 %19, i32 %26, i32 %8)
br label %76
74: ; preds = %37
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.28, i64 0, i64 0))
br label %76
76: ; preds = %74, %71, %68, %65, %62, %59, %56, %53, %50, %47, %44, %41, %38
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.16, i64 0, i64 0))
ret i32 0
}