#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*/ exit(int /*<<< orphan*/);
scalar_t__ getuid();
int /*<<< orphan*/ print_fail(char *);
int /*<<< orphan*/ print_pass(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ tw_lcore_conf_init();
scalar_t__ tw_smoke_create_rx_tx_mempools();
scalar_t__ tw_smoke_eth_port_init();
scalar_t__ tw_smoke_init_eal_env(int, char **);
int main(int argc, char **argv) {
  if (getuid()) {
    printf("%s", "Permission denied: Please run the test using sudo to use "
                 "Hugepages!\n");
    exit(0);
  } else if (tw_smoke_init_eal_env(argc, argv) != 0) {
    print_fail("Twister:    Initialize EAL - ");
    return -1;
  } else {
    print_pass("Twister:    Initialze EAL - ");
  }
  if (tw_smoke_create_rx_tx_mempools() != 0) {
    print_fail("Twister:    Create rx tx mempools - ");
    return -1;
  } else {
    print_pass("Twister:    Create rx tx mempools - ");
  }
  if (tw_lcore_conf_init() != 0) {
    print_fail("Twister:    Init lcore conf - ");
    return -1;
  } else {
    print_pass("Twister:    Init lcore conf - ");
  }
  if (tw_smoke_eth_port_init() != 0) {
    print_fail("Twister:    Init Ethernet ports - ");
    return -1;
  } else {
    print_pass("Twister:    Init Ethernet ports - ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
cmp    $0x0,%rax
je     11d1 <main+0x41>
lea    0xe42(%rip),%rdi
lea    0xe3e(%rip),%rsi
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <tw_smoke_init_eal_env@plt>
cmp    $0x0,%rax
je     11ff <main+0x6f>
lea    0xe5a(%rip),%rdi
call   1030 <print_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12b6 <main+0x126>
lea    0xe60(%rip),%rdi
call   1080 <print_pass@plt>
jmp    1210 <main+0x80>
mov    $0x0,%al
call   10b0 <tw_smoke_create_rx_tx_mempools@plt>
cmp    $0x0,%rax
je     1239 <main+0xa9>
lea    0xe5b(%rip),%rdi
call   1030 <print_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12b6 <main+0x126>
lea    0xe43(%rip),%rdi
call   1080 <print_pass@plt>
mov    $0x0,%al
call   1060 <tw_lcore_conf_init@plt>
cmp    $0x0,%rax
je     126e <main+0xde>
lea    0xe4b(%rip),%rdi
call   1030 <print_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12b6 <main+0x126>
lea    0xe33(%rip),%rdi
call   1080 <print_pass@plt>
mov    $0x0,%al
call   1090 <tw_smoke_eth_port_init@plt>
cmp    $0x0,%rax
je     12a3 <main+0x113>
lea    0xe35(%rip),%rdi
call   1030 <print_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12b6 <main+0x126>
lea    0xe1d(%rip),%rdi
call   1080 <print_pass@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <getuid@plt>
test   %rax,%rax
jne    122b <main+0x9b>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <tw_smoke_init_eal_env@plt>
test   %rax,%rax
je     11c0 <main+0x30>
lea    0xe8a(%rip),%rdi
jmp    1211 <main+0x81>
lea    0xe9f(%rip),%rdi
call   1080 <print_pass@plt>
xor    %eax,%eax
call   10b0 <tw_smoke_create_rx_tx_mempools@plt>
lea    0xea9(%rip),%rdi
test   %rax,%rax
jne    1211 <main+0x81>
call   1080 <print_pass@plt>
xor    %eax,%eax
call   1060 <tw_lcore_conf_init@plt>
lea    0xeb6(%rip),%rdi
test   %rax,%rax
jne    1211 <main+0x81>
call   1080 <print_pass@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <tw_smoke_eth_port_init@plt>
lea    0xebb(%rip),%rdi
test   %rax,%rax
je     1224 <main+0x94>
call   1030 <print_fail@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
call   1080 <print_pass@plt>
jmp    121b <main+0x8b>
lea    0xdce(%rip),%rdi
lea    0xdca(%rip),%rsi
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [69 x i8] c"Permission denied: Please run the test using sudo to use Hugepages!\0A\00"
@.str.2 = [30 x i8] c"Twister: Initialize EAL - \00"
@.str.3 = [29 x i8] c"Twister: Initialze EAL - \00"
@.str.4 = [37 x i8] c"Twister: Create rx tx mempools - \00"
@.str.5 = [31 x i8] c"Twister: Init lcore conf - \00"
@.str.6 = [35 x i8] c"Twister: Init Ethernet ports - \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i64 (...) @getuid()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i64 @tw_smoke_init_eal_env(i32 %12, i8** %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @print_fail(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %43
18: ; preds = %11
%19 = call i32 @print_pass(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18
br label %21
21: ; preds = %20
%22 = call i64 (...) @tw_smoke_create_rx_tx_mempools()
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @print_fail(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %43
26: ; preds = %21
%27 = call i32 @print_pass(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26
%29 = call i64 (...) @tw_lcore_conf_init()
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @print_fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %43
33: ; preds = %28
%34 = call i32 @print_pass(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = call i64 (...) @tw_smoke_eth_port_init()
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @print_fail(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %43
40: ; preds = %35
%41 = call i32 @print_pass(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
br label %42
42: ; preds = %40
store i32 0, i32* %3
br label %43
43: ; preds = %42, %38, %31, %24, %16
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [69 x i8] c"Permission denied: Please run the test using sudo to use Hugepages!\0A\00"
@.str.2 = [30 x i8] c"Twister: Initialize EAL - \00"
@.str.3 = [29 x i8] c"Twister: Initialze EAL - \00"
@.str.4 = [37 x i8] c"Twister: Create rx tx mempools - \00"
@.str.5 = [31 x i8] c"Twister: Init lcore conf - \00"
@.str.6 = [35 x i8] c"Twister: Init Ethernet ports - \00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 (...) @getuid()
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
%9 = tail call i64 @tw_smoke_init_eal_env(i32 %0, i8** %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @print_fail(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %33
13: ; preds = %8
%14 = tail call i32 @print_pass(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%15 = tail call i64 (...) @tw_smoke_create_rx_tx_mempools()
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = tail call i32 @print_fail(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
br label %33
19: ; preds = %13
%20 = tail call i32 @print_pass(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%21 = tail call i64 (...) @tw_lcore_conf_init()
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = tail call i32 @print_fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %33
25: ; preds = %19
%26 = tail call i32 @print_pass(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%27 = tail call i64 (...) @tw_smoke_eth_port_init()
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = tail call i32 @print_fail(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
br label %33
31: ; preds = %25
%32 = tail call i32 @print_pass(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
br label %33
33: ; preds = %31, %29, %23, %17, %11
%34 = phi i32 [ -1, %11 ], [ -1, %17 ], [ -1, %23 ], [ -1, %29 ], [ 0, %31 ]
ret i32 %34
}