#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*/ BUG(char *);
int /*<<< orphan*/ domain_policy_test(unsigned int);
int /*<<< orphan*/ exception_policy_test(unsigned int);
int /*<<< orphan*/ get_meminfo(unsigned int *);
int /*<<< orphan*/ mount(char *, char *, char *, int /*<<< orphan*/,
                         int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  unsigned int before;
  mount("/proc", "/proc/", "proc", 0, NULL);
  get_meminfo(&before);
  domain_policy_test(before);
  exception_policy_test(before);
  BUG("Policy read/write test: Success\n");
  return 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)
lea    0xe93(%rip),%rdi
lea    0xe92(%rip),%rsi
lea    0xe86(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
lea    -0x14(%rbp),%rdi
call   1070 <get_meminfo@plt>
mov    -0x14(%rbp),%edi
call   1060 <domain_policy_test@plt>
mov    -0x14(%rbp),%edi
call   1040 <exception_policy_test@plt>
lea    0xe66(%rip),%rdi
call   1030 <BUG@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
lea    0xea7(%rip),%rsi
lea    0xe9b(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
lea    0x4(%rsp),%rdi
call   1070 <get_meminfo@plt>
mov    0x4(%rsp),%edi
call   1060 <domain_policy_test@plt>
mov    0x4(%rsp),%edi
call   1040 <exception_policy_test@plt>
lea    0xe7a(%rip),%rdi
call   1030 <BUG@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"/proc\00"
@.str.1 = [7 x i8] c"/proc/\00"
@.str.2 = [5 x i8] c"proc\00"
@.str.3 = [33 x i8] c"Policy read/write test: Success\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 = call i32 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i32* null)
%8 = call i32 @get_meminfo(i32* %6)
%9 = load i32, i32* %6
%10 = call i32 @domain_policy_test(i32 %9)
%11 = load i32, i32* %6
%12 = call i32 @exception_policy_test(i32 %11)
%13 = call i32 @BUG(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"/proc\00"
@.str.1 = [7 x i8] c"/proc/\00"
@.str.2 = [5 x i8] c"proc\00"
@.str.3 = [33 x i8] c"Policy read/write test: Success\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i32* null)
%6 = call i32 @get_meminfo(i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @domain_policy_test(i32 %7)
%9 = load i32, i32* %3
%10 = call i32 @exception_policy_test(i32 %9)
%11 = call i32 @BUG(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}