#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*/ mkdir(char *, int);
scalar_t__ mount(char *, char *, char *, int /*<<< orphan*/,
                 int /*<<< orphan*/ *);
int /*<<< orphan*/ panic(char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ symlink(char *, char *);
void mount_filesystems(void) {
  puts("\x1b[32m\x1b[1m"
       "[+] Mounting filesystems..."
       "\x1b[0m");
  mkdir("/dev", 0755);
  mkdir("/proc", 0755);
  mkdir("/sys", 0755);
  mkdir("/tmp", 0755);
  mkdir("/run", 0755);
  mkdir("/var", 0755);
  if (mount("none", "/dev", "devtmpfs", 0, NULL))
    panic("devtmpfs mount");
  if (mount("none", "/proc", "proc", 0, NULL))
    panic("procfs mount");
  if (mount("none", "/sys", "sysfs", 0, NULL))
    panic("sysfs mount");
  if (mount("none", "/tmp", "tmpfs", 0, NULL))
    panic("tmpfs mount");
  if (mount("none", "/run", "tmpfs", 0, NULL))
    panic("tmpfs mount");
  if (mount("none", "/sys/kernel/debug", "debugfs", 0, NULL))
    ;
  if (symlink("/run", "/var/run"))
    panic("run symlink");
  if (symlink("/proc/self/fd", "/dev/fd"))
    panic("fd symlink");
}


x86 assembly (clang, -O0):
<mount_filesystems>:
push   %rbp
mov    %rsp,%rbp
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
lea    0xec2(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xeb6(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xeab(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xe9f(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xef2(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xe82(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xe76(%rip),%rdi
lea    0xe55(%rip),%rsi
lea    0xe6d(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     11fd <mount_filesystems+0xad>
lea    0xe59(%rip),%rdi
call   1070 <panic@plt>
lea    0xe3f(%rip),%rdi
lea    0xe23(%rip),%rsi
lea    0xe1d(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1234 <mount_filesystems+0xe4>
lea    0xe31(%rip),%rdi
call   1070 <panic@plt>
lea    0xe08(%rip),%rdi
lea    0xdf2(%rip),%rsi
lea    0xe24(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     126b <mount_filesystems+0x11b>
lea    0xe0d(%rip),%rdi
call   1070 <panic@plt>
lea    0xdd1(%rip),%rdi
lea    0xdc0(%rip),%rsi
lea    0xdcb(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     12a2 <mount_filesystems+0x152>
lea    0xdb7(%rip),%rdi
call   1070 <panic@plt>
lea    0xd9a(%rip),%rdi
lea    0xded(%rip),%rsi
lea    0xd94(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     12d9 <mount_filesystems+0x189>
lea    0xd80(%rip),%rdi
call   1070 <panic@plt>
lea    0xd63(%rip),%rdi
lea    0xd98(%rip),%rsi
lea    0xda3(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1309 <mount_filesystems+0x1b9>
jmp    1309 <mount_filesystems+0x1b9>
lea    0xd8d(%rip),%rdi
lea    0xd82(%rip),%rsi
call   1060 <symlink@plt>
cmp    $0x0,%rax
je     1332 <mount_filesystems+0x1e2>
lea    0xd75(%rip),%rdi
call   1070 <panic@plt>
lea    0xd75(%rip),%rdi
lea    0xd7c(%rip),%rsi
call   1060 <symlink@plt>
cmp    $0x0,%rax
je     135b <mount_filesystems+0x20b>
lea    0xd6e(%rip),%rdi
call   1070 <panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mount_filesystems>:
push   %rbx
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xeb6(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xeab(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xe9f(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xef2(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xe82(%rip),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
lea    0xe76(%rip),%rdi
lea    0xe74(%rip),%rdx
mov    %rbx,%rsi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
test   %rax,%rax
je     11f2 <mount_filesystems+0xa2>
lea    0xe64(%rip),%rdi
call   1070 <panic@plt>
lea    0xe4a(%rip),%rdi
lea    0xe2e(%rip),%rsi
lea    0xe28(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
test   %rax,%rax
je     1222 <mount_filesystems+0xd2>
lea    0xe43(%rip),%rdi
call   1070 <panic@plt>
lea    0xe1a(%rip),%rdi
lea    0xe04(%rip),%rsi
lea    0xe36(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
test   %rax,%rax
je     1252 <mount_filesystems+0x102>
lea    0xe26(%rip),%rdi
call   1070 <panic@plt>
lea    0xdea(%rip),%rdi
lea    0xdd9(%rip),%rsi
lea    0xde4(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
test   %rax,%rax
je     1282 <mount_filesystems+0x132>
lea    0xdd7(%rip),%rdi
call   1070 <panic@plt>
lea    0xdba(%rip),%rdi
lea    0xe0d(%rip),%rsi
lea    0xdb4(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
test   %rax,%rax
je     12b2 <mount_filesystems+0x162>
lea    0xda7(%rip),%rdi
call   1070 <panic@plt>
lea    0xd8a(%rip),%rdi
lea    0xdbf(%rip),%rsi
lea    0xdca(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
lea    0xdc5(%rip),%rdi
lea    0xdba(%rip),%rsi
call   1060 <symlink@plt>
test   %rax,%rax
je     12f5 <mount_filesystems+0x1a5>
lea    0xdb2(%rip),%rdi
call   1070 <panic@plt>
lea    0xdb2(%rip),%rdi
lea    0xdb9(%rip),%rsi
call   1060 <symlink@plt>
test   %rax,%rax
je     131a <mount_filesystems+0x1ca>
lea    0xdb0(%rip),%rdi
pop    %rbx
jmp    1070 <panic@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\1B[32m\1B[1m[+] Mounting filesystems...\1B[0m\00"
@.str.1 = [5 x i8] c"/dev\00"
@.str.2 = [6 x i8] c"/proc\00"
@.str.3 = [5 x i8] c"/sys\00"
@.str.4 = [5 x i8] c"/tmp\00"
@.str.5 = [5 x i8] c"/run\00"
@.str.6 = [5 x i8] c"/var\00"
@.str.7 = [5 x i8] c"none\00"
@.str.8 = [9 x i8] c"devtmpfs\00"
@.str.9 = [15 x i8] c"devtmpfs mount\00"
@.str.10 = [5 x i8] c"proc\00"
@.str.11 = [13 x i8] c"procfs mount\00"
@.str.12 = [6 x i8] c"sysfs\00"
@.str.13 = [12 x i8] c"sysfs mount\00"
@.str.14 = [6 x i8] c"tmpfs\00"
@.str.15 = [12 x i8] c"tmpfs mount\00"
@.str.16 = [18 x i8] c"/sys/kernel/debug\00"
@.str.17 = [8 x i8] c"debugfs\00"
@.str.18 = [9 x i8] c"/var/run\00"
@.str.19 = [12 x i8] c"run symlink\00"
@.str.20 = [14 x i8] c"/proc/self/fd\00"
@.str.21 = [8 x i8] c"/dev/fd\00"
@.str.22 = [11 x i8] c"fd symlink\00"
define void @mount_filesystems() {
%1 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 493)
%3 = call i32 @mkdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 493)
%4 = call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 493)
%5 = call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 493)
%6 = call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 493)
%7 = call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 493)
%8 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 0, i32* null)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @panic(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 0, i32* null)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @panic(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 0, i32* null)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 0, i32* null)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 0, i32* null)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i32 0, i32* null)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %32
br label %36
36: ; preds = %35, %32
%37 = call i64 @symlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = call i64 @symlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0))
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @panic(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0))
br label %46
46: ; preds = %44, %41
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"\1B[32m\1B[1m[+] Mounting filesystems...\1B[0m\00"
@.str.1 = [5 x i8] c"/dev\00"
@.str.2 = [6 x i8] c"/proc\00"
@.str.3 = [5 x i8] c"/sys\00"
@.str.4 = [5 x i8] c"/tmp\00"
@.str.5 = [5 x i8] c"/run\00"
@.str.6 = [5 x i8] c"/var\00"
@.str.7 = [5 x i8] c"none\00"
@.str.8 = [9 x i8] c"devtmpfs\00"
@.str.9 = [15 x i8] c"devtmpfs mount\00"
@.str.10 = [5 x i8] c"proc\00"
@.str.11 = [13 x i8] c"procfs mount\00"
@.str.12 = [6 x i8] c"sysfs\00"
@.str.13 = [12 x i8] c"sysfs mount\00"
@.str.14 = [6 x i8] c"tmpfs\00"
@.str.15 = [12 x i8] c"tmpfs mount\00"
@.str.16 = [18 x i8] c"/sys/kernel/debug\00"
@.str.17 = [8 x i8] c"debugfs\00"
@.str.18 = [9 x i8] c"/var/run\00"
@.str.19 = [12 x i8] c"run symlink\00"
@.str.20 = [14 x i8] c"/proc/self/fd\00"
@.str.21 = [8 x i8] c"/dev/fd\00"
@.str.22 = [11 x i8] c"fd symlink\00"
define void @mount_filesystems() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 493)
%3 = tail call i32 @mkdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 493)
%4 = tail call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 493)
%5 = tail call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 493)
%6 = tail call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 493)
%7 = tail call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 493)
%8 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 0, i32* null)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = tail call i32 @panic(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 0, i32* null)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 @panic(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 0, i32* null)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 0, i32* null)
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 0, i32* null)
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i32 0, i32* null)
%34 = tail call i64 @symlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %32
%37 = tail call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
%39 = tail call i64 @symlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = tail call i32 @panic(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
ret void
}