#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*/ abms_chmod(char *, char *);
int /*<<< orphan*/ abms_mkdir(char *, int);
int /*<<< orphan*/ abms_mknod(char *, int, int, int);
int /*<<< orphan*/ abms_mount(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *);
void ramfs_init(void) {
  char lcmd[255];
  sprintf(lcmd, "/proc /dev /root /sys /dev/pts /dev/shm");
  abms_mkdir(lcmd, 1);
  abms_mount("tmpfs", "shm", "/dev/shm");
  abms_mount("proc", "proc", "/proc");
  abms_mount("sysfs", "sysfs", "/sys");
  abms_mknod("/dev/tty", 0xc, 5, 0);
  abms_mknod("/dev/random", 0xc, 1, 8);
  abms_mknod("/dev/urandom", 0xc, 1, 9);
  abms_mknod("/dev/frandom", 0xc, 235, 11);
  abms_mknod("/dev/erandom", 0xc, 235, 12);
  abms_mknod("/dev/ptmx", 0xc, 5, 2);
  abms_mknod("/dev/loop0", 0xb, 7, 0);
  abms_mknod("/dev/grsec", 0xc, 1, 13);
  abms_chmod("666", "/dev/ptmx");
  abms_chmod("666", "/dev/tty");
  abms_mount("devpts", "devpts", "/dev/pts");
  sprintf(lcmd, "/app/os/var/dhcpcd");
  abms_mkdir(lcmd, 1);
  sprintf(lcmd, "/app/os/var/run");
  abms_mkdir(lcmd, 1);
  return;
}


x86 assembly (clang, -O0):
<ramfs_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x1,%esi
call   1050 <abms_mkdir@plt>
lea    0xea2(%rip),%rdi
lea    0xe97(%rip),%rsi
lea    0xe8b(%rip),%rdx
call   1030 <abms_mount@plt>
lea    0xe8f(%rip),%rsi
lea    0xe87(%rip),%rdx
mov    %rsi,%rdi
call   1030 <abms_mount@plt>
lea    0xe7e(%rip),%rsi
lea    0xe7d(%rip),%rdx
mov    %rsi,%rdi
call   1030 <abms_mount@plt>
lea    0xe73(%rip),%rdi
mov    $0xc,%esi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1060 <abms_mknod@plt>
lea    0xe64(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    $0x8,%ecx
call   1060 <abms_mknod@plt>
lea    0xe55(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    $0x9,%ecx
call   1060 <abms_mknod@plt>
lea    0xe47(%rip),%rdi
mov    $0xc,%esi
mov    $0xeb,%edx
mov    $0xb,%ecx
call   1060 <abms_mknod@plt>
lea    0xe39(%rip),%rdi
mov    $0xc,%ecx
mov    $0xeb,%edx
mov    %ecx,%esi
call   1060 <abms_mknod@plt>
lea    0xe2e(%rip),%rdi
mov    $0xc,%esi
mov    $0x5,%edx
mov    $0x2,%ecx
call   1060 <abms_mknod@plt>
lea    0xe1d(%rip),%rdi
mov    $0xb,%esi
mov    $0x7,%edx
xor    %ecx,%ecx
call   1060 <abms_mknod@plt>
lea    0xe10(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    $0xd,%ecx
call   1060 <abms_mknod@plt>
lea    0xe00(%rip),%rdi
lea    0xdd9(%rip),%rsi
call   1040 <abms_chmod@plt>
lea    0xded(%rip),%rdi
lea    0xd8a(%rip),%rsi
call   1040 <abms_chmod@plt>
lea    0xdde(%rip),%rsi
lea    0xdde(%rip),%rdx
mov    %rsi,%rdi
call   1030 <abms_mount@plt>
lea    -0x100(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x1,%esi
call   1050 <abms_mkdir@plt>
lea    -0x100(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x1,%esi
call   1050 <abms_mkdir@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ramfs_init>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
movups 0xebb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xe9f(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x6d68732f766564,%rax
mov    %rax,0x20(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1050 <abms_mkdir@plt>
lea    0xe9d(%rip),%rdi
lea    0xe92(%rip),%rsi
lea    0xe86(%rip),%rdx
call   1030 <abms_mount@plt>
lea    0xe8a(%rip),%rdi
lea    0xe82(%rip),%rdx
mov    %rdi,%rsi
call   1030 <abms_mount@plt>
lea    0xe79(%rip),%rdi
lea    0xe78(%rip),%rdx
mov    %rdi,%rsi
call   1030 <abms_mount@plt>
lea    0xe6e(%rip),%r15
mov    %r15,%rdi
mov    $0xc,%esi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1060 <abms_mknod@plt>
lea    0xe5c(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    $0x8,%ecx
call   1060 <abms_mknod@plt>
lea    0xe4d(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    $0x9,%ecx
call   1060 <abms_mknod@plt>
lea    0xe3f(%rip),%rdi
mov    $0xc,%esi
mov    $0xeb,%edx
mov    $0xb,%ecx
call   1060 <abms_mknod@plt>
lea    0xe31(%rip),%rdi
mov    $0xc,%esi
mov    $0xeb,%edx
mov    $0xc,%ecx
call   1060 <abms_mknod@plt>
lea    0xe23(%rip),%r12
mov    %r12,%rdi
mov    $0xc,%esi
mov    $0x5,%edx
mov    $0x2,%ecx
call   1060 <abms_mknod@plt>
lea    0xe0f(%rip),%rdi
mov    $0xb,%esi
mov    $0x7,%edx
xor    %ecx,%ecx
call   1060 <abms_mknod@plt>
lea    0xe02(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    $0xd,%ecx
call   1060 <abms_mknod@plt>
lea    0xdf2(%rip),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <abms_chmod@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <abms_chmod@plt>
lea    0xdd9(%rip),%rdi
lea    0xdd9(%rip),%rdx
mov    %rdi,%rsi
call   1030 <abms_mount@plt>
movups 0xdd3(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x646370,0xf(%rsp)
mov    %r14,%rdi
mov    $0x1,%esi
call   1050 <abms_mkdir@plt>
movups 0xdc6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
mov    $0x1,%esi
call   1050 <abms_mkdir@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"/proc /dev /root /sys /dev/pts /dev/shm\00"
@.str.1 = [6 x i8] c"tmpfs\00"
@.str.2 = [4 x i8] c"shm\00"
@.str.3 = [9 x i8] c"/dev/shm\00"
@.str.4 = [5 x i8] c"proc\00"
@.str.5 = [6 x i8] c"/proc\00"
@.str.6 = [6 x i8] c"sysfs\00"
@.str.7 = [5 x i8] c"/sys\00"
@.str.8 = [9 x i8] c"/dev/tty\00"
@.str.9 = [12 x i8] c"/dev/random\00"
@.str.10 = [13 x i8] c"/dev/urandom\00"
@.str.11 = [13 x i8] c"/dev/frandom\00"
@.str.12 = [13 x i8] c"/dev/erandom\00"
@.str.13 = [10 x i8] c"/dev/ptmx\00"
@.str.14 = [11 x i8] c"/dev/loop0\00"
@.str.15 = [11 x i8] c"/dev/grsec\00"
@.str.16 = [4 x i8] c"666\00"
@.str.17 = [7 x i8] c"devpts\00"
@.str.18 = [9 x i8] c"/dev/pts\00"
@.str.19 = [19 x i8] c"/app/os/var/dhcpcd\00"
@.str.20 = [16 x i8] c"/app/os/var/run\00"
define void @ramfs_init() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%5 = call i32 @abms_mkdir(i8* %4, i32 1)
%6 = call i32 @abms_mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @abms_mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, 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.5, i64 0, i64 0))
%8 = call i32 @abms_mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%9 = call i32 @abms_mknod(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 12, i32 5, i32 0)
%10 = call i32 @abms_mknod(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 12, i32 1, i32 8)
%11 = call i32 @abms_mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 12, i32 1, i32 9)
%12 = call i32 @abms_mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 12, i32 235, i32 11)
%13 = call i32 @abms_mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 12, i32 235, i32 12)
%14 = call i32 @abms_mknod(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 12, i32 5, i32 2)
%15 = call i32 @abms_mknod(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 11, i32 7, i32 0)
%16 = call i32 @abms_mknod(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 12, i32 1, i32 13)
%17 = call i32 @abms_chmod(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%18 = call i32 @abms_chmod(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 @abms_mount(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%20 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%21 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.19, i64 0, i64 0))
%22 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%23 = call i32 @abms_mkdir(i8* %22, i32 1)
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%25 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0))
%26 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%27 = call i32 @abms_mkdir(i8* %26, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"/proc /dev /root /sys /dev/pts /dev/shm\00"
@.str.1 = [6 x i8] c"tmpfs\00"
@.str.2 = [4 x i8] c"shm\00"
@.str.3 = [9 x i8] c"/dev/shm\00"
@.str.4 = [5 x i8] c"proc\00"
@.str.5 = [6 x i8] c"/proc\00"
@.str.6 = [6 x i8] c"sysfs\00"
@.str.7 = [5 x i8] c"/sys\00"
@.str.8 = [9 x i8] c"/dev/tty\00"
@.str.9 = [12 x i8] c"/dev/random\00"
@.str.10 = [13 x i8] c"/dev/urandom\00"
@.str.11 = [13 x i8] c"/dev/frandom\00"
@.str.12 = [13 x i8] c"/dev/erandom\00"
@.str.13 = [10 x i8] c"/dev/ptmx\00"
@.str.14 = [11 x i8] c"/dev/loop0\00"
@.str.15 = [11 x i8] c"/dev/grsec\00"
@.str.16 = [4 x i8] c"666\00"
@.str.17 = [7 x i8] c"devpts\00"
@.str.18 = [9 x i8] c"/dev/pts\00"
@.str.19 = [19 x i8] c"/app/os/var/dhcpcd\00"
@.str.20 = [16 x i8] c"/app/os/var/run\00"
define void @ramfs_init() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 @abms_mkdir(i8* %2, i32 1)
%4 = call i32 @abms_mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @abms_mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, 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.5, i64 0, i64 0))
%6 = call i32 @abms_mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%7 = call i32 @abms_mknod(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 12, i32 5, i32 0)
%8 = call i32 @abms_mknod(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 12, i32 1, i32 8)
%9 = call i32 @abms_mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 12, i32 1, i32 9)
%10 = call i32 @abms_mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 12, i32 235, i32 11)
%11 = call i32 @abms_mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 12, i32 235, i32 12)
%12 = call i32 @abms_mknod(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 12, i32 5, i32 2)
%13 = call i32 @abms_mknod(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 11, i32 7, i32 0)
%14 = call i32 @abms_mknod(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 12, i32 1, i32 13)
%15 = call i32 @abms_chmod(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%16 = call i32 @abms_chmod(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 @abms_mount(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%18 = call i32 @abms_mkdir(i8* %2, i32 1)
%19 = call i32 @abms_mkdir(i8* %2, i32 1)
ret void
}