#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*/ MS_RELATIME;
int S_IRGRP;
int S_IROTH;
int S_IRWXU;
int S_IXGRP;
int S_IXOTH;
int /*<<< orphan*/ kattach_thedawn_devlist_add();
int /*<<< orphan*/ kattach_thedawn_init_devlist();
int mkdir(char *, int);
int mount(char *, char *, char *, int /*<<< orphan*/, char *);
int symlink(char *, char *);
void kattach_thedawn_generate_dev() {
  int ret = 0;
  ret = mkdir("/dev", (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
  ret = mkdir("/dev/shm", (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
  ret = mkdir("/dev/pts", (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
  ret = mkdir("/dev/net", (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
  ret = mkdir("/dev/misc", (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
  kattach_thedawn_init_devlist();
  kattach_thedawn_devlist_add();
  ret = mount("devpts", "/dev/pts", "devpts", MS_RELATIME, "mode=600");
  ret = mount("tmpfs", "/dev/shm", "tmpfs", MS_RELATIME, "");
  ret = symlink("/proc/self/fd", "/dev/fd");
  ret = symlink("/proc/self/fd/0", "/dev/stdin");
  ret = symlink("/proc/self/fd/1", "/dev/stdout");
  ret = symlink("/proc/self/fd/2", "/dev/stderr");
  return;
}


x86 assembly (clang, -O0):
<kattach_thedawn_generate_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
mov    0x2e51(%rip),%rax
or     (%rax),%esi
mov    0x2e60(%rip),%rax
or     (%rax),%esi
mov    0x2e37(%rip),%rax
or     (%rax),%esi
mov    0x2e56(%rip),%rax
or     (%rax),%esi
lea    0xe6d(%rip),%rdi
call   1030 <mkdir@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%esi
mov    0x2e15(%rip),%rax
or     (%rax),%esi
mov    0x2e24(%rip),%rax
or     (%rax),%esi
mov    0x2dfb(%rip),%rax
or     (%rax),%esi
mov    0x2e1a(%rip),%rax
or     (%rax),%esi
lea    0xe36(%rip),%rdi
call   1030 <mkdir@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
mov    0x2dd9(%rip),%rax
or     (%rax),%esi
mov    0x2de8(%rip),%rax
or     (%rax),%esi
mov    0x2dbf(%rip),%rax
or     (%rax),%esi
mov    0x2dde(%rip),%rax
or     (%rax),%esi
lea    0xe03(%rip),%rdi
call   1030 <mkdir@plt>
mov    %eax,-0x4(%rbp)
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
mov    0x2d9d(%rip),%rax
or     (%rax),%esi
mov    0x2dac(%rip),%rax
or     (%rax),%esi
mov    0x2d83(%rip),%rax
or     (%rax),%esi
mov    0x2da2(%rip),%rax
or     (%rax),%esi
lea    0xdd0(%rip),%rdi
call   1030 <mkdir@plt>
mov    %eax,-0x4(%rbp)
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
mov    0x2d61(%rip),%rax
or     (%rax),%esi
mov    0x2d70(%rip),%rax
or     (%rax),%esi
mov    0x2d47(%rip),%rax
or     (%rax),%esi
mov    0x2d66(%rip),%rax
or     (%rax),%esi
lea    0xd9d(%rip),%rdi
call   1030 <mkdir@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1070 <kattach_thedawn_init_devlist@plt>
mov    $0x0,%al
call   1060 <kattach_thedawn_devlist_add@plt>
mov    0x2d28(%rip),%rax
mov    (%rax),%ecx
lea    0xd81(%rip),%rdx
lea    0xd5e(%rip),%rsi
lea    0xd7a(%rip),%r8
mov    %rdx,%rdi
call   1040 <mount@plt>
mov    %eax,-0x4(%rbp)
mov    0x2cff(%rip),%rax
mov    (%rax),%ecx
lea    0xd68(%rip),%rdx
lea    0xd2c(%rip),%rsi
lea    0xd85(%rip),%r8
mov    %rdx,%rdi
call   1040 <mount@plt>
mov    %eax,-0x4(%rbp)
lea    0xd4e(%rip),%rdi
lea    0xd55(%rip),%rsi
call   1050 <symlink@plt>
mov    %eax,-0x4(%rbp)
lea    0xd4e(%rip),%rdi
lea    0xd57(%rip),%rsi
call   1050 <symlink@plt>
mov    %eax,-0x4(%rbp)
lea    0xd53(%rip),%rdi
lea    0xd5c(%rip),%rsi
call   1050 <symlink@plt>
mov    %eax,-0x4(%rbp)
lea    0xd59(%rip),%rdi
lea    0xd62(%rip),%rsi
call   1050 <symlink@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kattach_thedawn_generate_dev>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e86(%rip),%r12
mov    0x2e57(%rip),%rbx
mov    (%rbx),%esi
or     (%r12),%esi
mov    0x2e62(%rip),%r13
or     0x0(%r13),%esi
mov    0x2e37(%rip),%rbp
or     0x0(%rbp),%esi
mov    0x2e55(%rip),%r14
or     (%r14),%esi
lea    0xe6b(%rip),%rdi
call   1030 <mkdir@plt>
mov    (%rbx),%esi
or     (%r12),%esi
or     0x0(%r13),%esi
or     0x0(%rbp),%esi
or     (%r14),%esi
lea    0xe54(%rip),%rdi
call   1030 <mkdir@plt>
mov    (%rbx),%esi
or     (%r12),%esi
or     0x0(%r13),%esi
or     0x0(%rbp),%esi
or     (%r14),%esi
lea    0xe41(%rip),%r15
mov    %r15,%rdi
call   1030 <mkdir@plt>
mov    (%rbx),%esi
or     (%r12),%esi
or     0x0(%r13),%esi
or     0x0(%rbp),%esi
or     (%r14),%esi
lea    0xe2b(%rip),%rdi
call   1030 <mkdir@plt>
mov    (%rbx),%esi
or     (%r12),%esi
or     0x0(%r13),%esi
or     0x0(%rbp),%esi
or     (%r14),%esi
lea    0xe18(%rip),%rdi
call   1030 <mkdir@plt>
xor    %eax,%eax
call   1070 <kattach_thedawn_init_devlist@plt>
xor    %eax,%eax
call   1060 <kattach_thedawn_devlist_add@plt>
mov    0x2da6(%rip),%rbx
mov    (%rbx),%ecx
lea    0xdff(%rip),%rdi
lea    0xdff(%rip),%r8
mov    %r15,%rsi
mov    %rdi,%rdx
call   1040 <mount@plt>
mov    (%rbx),%ecx
lea    0xdf4(%rip),%rdi
lea    0xe18(%rip),%r8
lea    0xdb1(%rip),%rsi
mov    %rdi,%rdx
call   1040 <mount@plt>
lea    0xddd(%rip),%rdi
lea    0xde4(%rip),%rsi
call   1050 <symlink@plt>
lea    0xde0(%rip),%rdi
lea    0xde9(%rip),%rsi
call   1050 <symlink@plt>
lea    0xde8(%rip),%rdi
lea    0xdf1(%rip),%rsi
call   1050 <symlink@plt>
lea    0xdf1(%rip),%rdi
lea    0xdfa(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <symlink@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"/dev\00"
@S_IRWXU = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@.str.1 = [9 x i8] c"/dev/shm\00"
@.str.2 = [9 x i8] c"/dev/pts\00"
@.str.3 = [9 x i8] c"/dev/net\00"
@.str.4 = [10 x i8] c"/dev/misc\00"
@.str.5 = [7 x i8] c"devpts\00"
@MS_RELATIME = global i32 0
@.str.6 = [9 x i8] c"mode=600\00"
@.str.7 = [6 x i8] c"tmpfs\00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [14 x i8] c"/proc/self/fd\00"
@.str.10 = [8 x i8] c"/dev/fd\00"
@.str.11 = [16 x i8] c"/proc/self/fd/0\00"
@.str.12 = [11 x i8] c"/dev/stdin\00"
@.str.13 = [16 x i8] c"/proc/self/fd/1\00"
@.str.14 = [12 x i8] c"/dev/stdout\00"
@.str.15 = [16 x i8] c"/proc/self/fd/2\00"
@.str.16 = [12 x i8] c"/dev/stderr\00"
define void @kattach_thedawn_generate_dev() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @S_IRWXU
%3 = load i32, i32* @S_IRGRP
%4 = or i32 %2, %3
%5 = load i32, i32* @S_IXGRP
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IROTH
%8 = or i32 %6, %7
%9 = load i32, i32* @S_IXOTH
%10 = or i32 %8, %9
%11 = call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %1
%12 = load i32, i32* @S_IRWXU
%13 = load i32, i32* @S_IRGRP
%14 = or i32 %12, %13
%15 = load i32, i32* @S_IXGRP
%16 = or i32 %14, %15
%17 = load i32, i32* @S_IROTH
%18 = or i32 %16, %17
%19 = load i32, i32* @S_IXOTH
%20 = or i32 %18, %19
%21 = call i32 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %20)
store i32 %21, i32* %1
%22 = load i32, i32* @S_IRWXU
%23 = load i32, i32* @S_IRGRP
%24 = or i32 %22, %23
%25 = load i32, i32* @S_IXGRP
%26 = or i32 %24, %25
%27 = load i32, i32* @S_IROTH
%28 = or i32 %26, %27
%29 = load i32, i32* @S_IXOTH
%30 = or i32 %28, %29
%31 = call i32 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %30)
store i32 %31, i32* %1
%32 = load i32, i32* @S_IRWXU
%33 = load i32, i32* @S_IRGRP
%34 = or i32 %32, %33
%35 = load i32, i32* @S_IXGRP
%36 = or i32 %34, %35
%37 = load i32, i32* @S_IROTH
%38 = or i32 %36, %37
%39 = load i32, i32* @S_IXOTH
%40 = or i32 %38, %39
%41 = call i32 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %40)
store i32 %41, i32* %1
%42 = load i32, i32* @S_IRWXU
%43 = load i32, i32* @S_IRGRP
%44 = or i32 %42, %43
%45 = load i32, i32* @S_IXGRP
%46 = or i32 %44, %45
%47 = load i32, i32* @S_IROTH
%48 = or i32 %46, %47
%49 = load i32, i32* @S_IXOTH
%50 = or i32 %48, %49
%51 = call i32 @mkdir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %50)
store i32 %51, i32* %1
%52 = call i32 (...) @kattach_thedawn_init_devlist()
%53 = call i32 (...) @kattach_thedawn_devlist_add()
%54 = load i32, i32* @MS_RELATIME
%55 = call i32 @mount(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %54, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 %55, i32* %1
%56 = load i32, i32* @MS_RELATIME
%57 = call i32 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %56, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0))
store i32 %57, i32* %1
%58 = call i32 @symlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
store i32 %58, i32* %1
%59 = call i32 @symlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
store i32 %59, i32* %1
%60 = call i32 @symlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
store i32 %60, i32* %1
%61 = call i32 @symlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
store i32 %61, i32* %1
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"/dev\00"
@S_IRWXU = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@.str.1 = [9 x i8] c"/dev/shm\00"
@.str.2 = [9 x i8] c"/dev/pts\00"
@.str.3 = [9 x i8] c"/dev/net\00"
@.str.4 = [10 x i8] c"/dev/misc\00"
@.str.5 = [7 x i8] c"devpts\00"
@MS_RELATIME = global i32 0
@.str.6 = [9 x i8] c"mode=600\00"
@.str.7 = [6 x i8] c"tmpfs\00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [14 x i8] c"/proc/self/fd\00"
@.str.10 = [8 x i8] c"/dev/fd\00"
@.str.11 = [16 x i8] c"/proc/self/fd/0\00"
@.str.12 = [11 x i8] c"/dev/stdin\00"
@.str.13 = [16 x i8] c"/proc/self/fd/1\00"
@.str.14 = [12 x i8] c"/dev/stdout\00"
@.str.15 = [16 x i8] c"/proc/self/fd/2\00"
@.str.16 = [12 x i8] c"/dev/stderr\00"
define void @kattach_thedawn_generate_dev() {
%1 = load i32, i32* @S_IRWXU
%2 = load i32, i32* @S_IRGRP
%3 = or i32 %2, %1
%4 = load i32, i32* @S_IXGRP
%5 = or i32 %3, %4
%6 = load i32, i32* @S_IROTH
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IXOTH
%9 = or i32 %7, %8
%10 = tail call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @S_IRWXU
%12 = load i32, i32* @S_IRGRP
%13 = or i32 %12, %11
%14 = load i32, i32* @S_IXGRP
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IROTH
%17 = or i32 %15, %16
%18 = load i32, i32* @S_IXOTH
%19 = or i32 %17, %18
%20 = tail call i32 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = load i32, i32* @S_IRWXU
%22 = load i32, i32* @S_IRGRP
%23 = or i32 %22, %21
%24 = load i32, i32* @S_IXGRP
%25 = or i32 %23, %24
%26 = load i32, i32* @S_IROTH
%27 = or i32 %25, %26
%28 = load i32, i32* @S_IXOTH
%29 = or i32 %27, %28
%30 = tail call i32 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @S_IRWXU
%32 = load i32, i32* @S_IRGRP
%33 = or i32 %32, %31
%34 = load i32, i32* @S_IXGRP
%35 = or i32 %33, %34
%36 = load i32, i32* @S_IROTH
%37 = or i32 %35, %36
%38 = load i32, i32* @S_IXOTH
%39 = or i32 %37, %38
%40 = tail call i32 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = load i32, i32* @S_IRWXU
%42 = load i32, i32* @S_IRGRP
%43 = or i32 %42, %41
%44 = load i32, i32* @S_IXGRP
%45 = or i32 %43, %44
%46 = load i32, i32* @S_IROTH
%47 = or i32 %45, %46
%48 = load i32, i32* @S_IXOTH
%49 = or i32 %47, %48
%50 = tail call i32 @mkdir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %49)
%51 = tail call i32 (...) @kattach_thedawn_init_devlist()
%52 = tail call i32 (...) @kattach_thedawn_devlist_add()
%53 = load i32, i32* @MS_RELATIME
%54 = tail call i32 @mount(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %53, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%55 = load i32, i32* @MS_RELATIME
%56 = tail call i32 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %55, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0))
%57 = tail call i32 @symlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%58 = tail call i32 @symlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%59 = tail call i32 @symlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%60 = tail call i32 @symlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
ret void
}