#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 EXIT_SUCCESS;
int MS_REMOUNT;
int /*<<< orphan*/ create_and_enter_ns();
int /*<<< orphan*/ die(char *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
scalar_t__ mount(char *, char *, char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ run_tests(int);
int /*<<< orphan*/ setup_symlink();
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  create_and_enter_ns();
  if (mount("testing", "/tmp", "ramfs", 0, NULL) != 0)
    die("mount failed: %s\n", strerror(errno));
  setup_symlink();
  run_tests(false);
  if (mount("testing", "/tmp", "ramfs", MS_REMOUNT | 256, NULL) != 0)
    die("remount failed: %s\n", strerror(errno));
  run_tests(true);
  return EXIT_SUCCESS;
}


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 <create_and_enter_ns@plt>
lea    0xe7c(%rip),%rdi
lea    0xe7d(%rip),%rsi
lea    0xe7b(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <mount@plt>
cmp    $0x0,%rax
je     11c4 <main+0x64>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    %eax,%esi
lea    0xe56(%rip),%rdi
call   1060 <die@plt>
mov    $0x0,%al
call   1050 <setup_symlink@plt>
xor    %edi,%edi
call   1070 <run_tests@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%ecx
or     $0x100,%ecx
lea    0xe18(%rip),%rdi
lea    0xe19(%rip),%rsi
lea    0xe17(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <mount@plt>
cmp    $0x0,%rax
je     1226 <main+0xc6>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    %eax,%esi
lea    0xdf2(%rip),%rdi
call   1060 <die@plt>
mov    $0x1,%edi
call   1070 <run_tests@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <create_and_enter_ns@plt>
lea    0xe91(%rip),%rdi
lea    0xe92(%rip),%rsi
lea    0xe90(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <mount@plt>
test   %rax,%rax
je     11a8 <main+0x48>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xe74(%rip),%rdi
mov    %eax,%esi
call   1060 <die@plt>
xor    %eax,%eax
call   1050 <setup_symlink@plt>
xor    %edi,%edi
call   1070 <run_tests@plt>
mov    0x2e13(%rip),%rax
mov    $0x100,%ecx
or     (%rax),%ecx
lea    0xe35(%rip),%rdi
lea    0xe36(%rip),%rsi
lea    0xe34(%rip),%rdx
xor    %r8d,%r8d
call   1030 <mount@plt>
test   %rax,%rax
je     1202 <main+0xa2>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xe18(%rip),%rdi
mov    %eax,%esi
call   1060 <die@plt>
mov    $0x1,%edi
call   1070 <run_tests@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"testing\00"
@.str.1 = [5 x i8] c"/tmp\00"
@.str.2 = [6 x i8] c"ramfs\00"
@.str.3 = [18 x i8] c"mount failed: %s\0A\00"
@errno = global i32 0
@MS_REMOUNT = global i32 0
@.str.4 = [20 x i8] c"remount failed: %s\0A\00"
@EXIT_SUCCESS = global i32 0
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 i32 (...) @create_and_enter_ns()
%7 = call i64 @mount(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 0, i32* null)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @errno
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %2
%14 = call i32 (...) @setup_symlink()
%15 = call i32 @run_tests(i32 0)
%16 = load i32, i32* @MS_REMOUNT
%17 = or i32 %16, 256
%18 = call i64 @mount(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32* null)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %13
%21 = load i32, i32* @errno
%22 = call i32 @strerror(i32 %21)
%23 = call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %20, %13
%25 = call i32 @run_tests(i32 1)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}

LLVM IR (-O2):
@.str = [8 x i8] c"testing\00"
@.str.1 = [5 x i8] c"/tmp\00"
@.str.2 = [6 x i8] c"ramfs\00"
@.str.3 = [18 x i8] c"mount failed: %s\0A\00"
@errno = global i32 0
@MS_REMOUNT = global i32 0
@.str.4 = [20 x i8] c"remount failed: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @create_and_enter_ns()
%4 = tail call i64 @mount(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 0, i32* null)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @errno
%8 = tail call i32 @strerror(i32 %7)
%9 = tail call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %6, %2
%11 = tail call i32 (...) @setup_symlink()
%12 = tail call i32 @run_tests(i32 0)
%13 = load i32, i32* @MS_REMOUNT
%14 = or i32 %13, 256
%15 = tail call i64 @mount(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32* null)
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %10
%18 = load i32, i32* @errno
%19 = tail call i32 @strerror(i32 %18)
%20 = tail call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %10
%22 = tail call i32 @run_tests(i32 1)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}