#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 */
scalar_t__ mount(char *, char *, char *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ omb_log(int, char *);
int /*<<< orphan*/ omb_utils_is_mounted(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ system(char *);
void omb_utils_init_system() {
  omb_log(2, "mount /proc");
  if (!omb_utils_is_mounted("/proc"))
    if (mount("proc", "/proc", "proc", 0, NULL) != 0)
      omb_log(0, "cannot mount /proc");
  omb_log(2, "mount /sys");
  if (!omb_utils_is_mounted("/sys"))
    if (mount("sysfs", "/sys", "sysfs", 0, NULL) != 0)
      omb_log(0, "cannot mount /sys");
  omb_log(2, "mount /media");
  if (!omb_utils_is_mounted("/media"))
    if (mount("tmpfs", "/media", "tmpfs", 0, "size=64k") != 0)
      omb_log(0, "cannot mount /media");
  omb_log(2, "run volatile media");
  system("/etc/init.d/volatile-media.sh");
  omb_log(2, "run mdev");
  system("/etc/init.d/mdev");
  sleep(2);
}


x86 assembly (clang, -O0):
<omb_utils_init_system>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
lea    0xea7(%rip),%rsi
call   1050 <omb_log@plt>
lea    0xea1(%rip),%rdi
call   1060 <omb_utils_is_mounted@plt>
cmp    $0x0,%eax
jne    11b4 <omb_utils_init_system+0x64>
lea    0xe8d(%rip),%rdx
lea    0xe85(%rip),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rdx,%rdi
call   1030 <mount@plt>
cmp    $0x0,%rax
je     11af <omb_utils_init_system+0x5f>
xor    %edi,%edi
lea    0xe56(%rip),%rsi
call   1050 <omb_log@plt>
jmp    11b4 <omb_utils_init_system+0x64>
mov    $0x2,%edi
lea    0xe60(%rip),%rsi
call   1050 <omb_log@plt>
lea    0xe5a(%rip),%rdi
call   1060 <omb_utils_is_mounted@plt>
cmp    $0x0,%eax
jne    1214 <omb_utils_init_system+0xc4>
lea    0xe32(%rip),%rdx
lea    0xe3e(%rip),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rdx,%rdi
call   1030 <mount@plt>
cmp    $0x0,%rax
je     120f <omb_utils_init_system+0xbf>
xor    %edi,%edi
lea    0xe0f(%rip),%rsi
call   1050 <omb_log@plt>
jmp    1214 <omb_utils_init_system+0xc4>
mov    $0x2,%edi
lea    0xe21(%rip),%rsi
call   1050 <omb_log@plt>
lea    0xe1b(%rip),%rdi
call   1060 <omb_utils_is_mounted@plt>
cmp    $0x0,%eax
jne    1276 <omb_utils_init_system+0x126>
lea    0xdea(%rip),%rdx
lea    0xdff(%rip),%rsi
xor    %ecx,%ecx
lea    0xde0(%rip),%r8
mov    %rdx,%rdi
call   1030 <mount@plt>
cmp    $0x0,%rax
je     1271 <omb_utils_init_system+0x121>
xor    %edi,%edi
lea    0xdce(%rip),%rsi
call   1050 <omb_log@plt>
jmp    1276 <omb_utils_init_system+0x126>
mov    $0x2,%edi
lea    0xdcc(%rip),%rsi
call   1050 <omb_log@plt>
lea    0xdd3(%rip),%rdi
call   1040 <system@plt>
mov    $0x2,%edi
lea    0xde0(%rip),%rsi
call   1050 <omb_log@plt>
lea    0xddd(%rip),%rdi
call   1040 <system@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<omb_utils_init_system>:
push   %rax
lea    0xeaf(%rip),%rsi
mov    $0x2,%edi
call   1050 <omb_log@plt>
lea    0xea4(%rip),%rdi
call   1060 <omb_utils_is_mounted@plt>
test   %eax,%eax
jne    11a0 <omb_utils_init_system+0x50>
lea    0xe94(%rip),%rsi
lea    0xe8e(%rip),%rdi
mov    %rdi,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <mount@plt>
test   %rax,%rax
je     11a0 <omb_utils_init_system+0x50>
lea    0xe67(%rip),%rsi
xor    %edi,%edi
call   1050 <omb_log@plt>
lea    0xe79(%rip),%rsi
mov    $0x2,%edi
call   1050 <omb_log@plt>
lea    0xe6e(%rip),%rdi
call   1060 <omb_utils_is_mounted@plt>
test   %eax,%eax
jne    11ef <omb_utils_init_system+0x9f>
lea    0xe5e(%rip),%rsi
lea    0xe44(%rip),%rdi
mov    %rdi,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <mount@plt>
test   %rax,%rax
je     11ef <omb_utils_init_system+0x9f>
lea    0xe31(%rip),%rsi
xor    %edi,%edi
call   1050 <omb_log@plt>
lea    0xe4b(%rip),%rsi
mov    $0x2,%edi
call   1050 <omb_log@plt>
lea    0xe40(%rip),%rdi
call   1060 <omb_utils_is_mounted@plt>
test   %eax,%eax
jne    1242 <omb_utils_init_system+0xf2>
lea    0xe30(%rip),%rsi
lea    0xe0d(%rip),%rdi
lea    0xe0c(%rip),%r8
mov    %rdi,%rdx
xor    %ecx,%ecx
call   1030 <mount@plt>
test   %rax,%rax
je     1242 <omb_utils_init_system+0xf2>
lea    0xdff(%rip),%rsi
xor    %edi,%edi
call   1050 <omb_log@plt>
lea    0xe05(%rip),%rsi
mov    $0x2,%edi
call   1050 <omb_log@plt>
lea    0xe07(%rip),%rdi
call   1040 <system@plt>
lea    0xe19(%rip),%rsi
mov    $0x2,%edi
call   1050 <omb_log@plt>
lea    0xe11(%rip),%rdi
call   1040 <system@plt>
mov    $0x2,%edi
pop    %rax
jmp    1070 <sleep@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"mount /proc\00"
@.str.1 = [6 x i8] c"/proc\00"
@.str.2 = [5 x i8] c"proc\00"
@.str.3 = [19 x i8] c"cannot mount /proc\00"
@.str.4 = [11 x i8] c"mount /sys\00"
@.str.5 = [5 x i8] c"/sys\00"
@.str.6 = [6 x i8] c"sysfs\00"
@.str.7 = [18 x i8] c"cannot mount /sys\00"
@.str.8 = [13 x i8] c"mount /media\00"
@.str.9 = [7 x i8] c"/media\00"
@.str.10 = [6 x i8] c"tmpfs\00"
@.str.11 = [9 x i8] c"size=64k\00"
@.str.12 = [20 x i8] c"cannot mount /media\00"
@.str.13 = [19 x i8] c"run volatile media\00"
@.str.14 = [30 x i8] c"/etc/init.d/volatile-media.sh\00"
@.str.15 = [9 x i8] c"run mdev\00"
@.str.16 = [17 x i8] c"/etc/init.d/mdev\00"
define void @omb_utils_init_system() {
%1 = call i32 @omb_log(i32 2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @omb_utils_is_mounted(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp ne i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 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, i8* null)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = call i32 @omb_log(i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
br label %10
10: ; preds = %9, %0
%11 = call i32 @omb_log(i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @omb_utils_is_mounted(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %10
%15 = call i64 @mount(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.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* null)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @omb_log(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19, %10
%21 = call i32 @omb_log(i32 2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%22 = call i32 @omb_utils_is_mounted(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %30, label %24
24: ; preds = %20
%25 = call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @omb_log(i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
br label %30
30: ; preds = %29, %20
%31 = call i32 @omb_log(i32 2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%32 = call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0))
%33 = call i32 @omb_log(i32 2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
%34 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0))
%35 = call i32 @sleep(i32 2)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"mount /proc\00"
@.str.1 = [6 x i8] c"/proc\00"
@.str.2 = [5 x i8] c"proc\00"
@.str.3 = [19 x i8] c"cannot mount /proc\00"
@.str.4 = [11 x i8] c"mount /sys\00"
@.str.5 = [5 x i8] c"/sys\00"
@.str.6 = [6 x i8] c"sysfs\00"
@.str.7 = [18 x i8] c"cannot mount /sys\00"
@.str.8 = [13 x i8] c"mount /media\00"
@.str.9 = [7 x i8] c"/media\00"
@.str.10 = [6 x i8] c"tmpfs\00"
@.str.11 = [9 x i8] c"size=64k\00"
@.str.12 = [20 x i8] c"cannot mount /media\00"
@.str.13 = [19 x i8] c"run volatile media\00"
@.str.14 = [30 x i8] c"/etc/init.d/volatile-media.sh\00"
@.str.15 = [9 x i8] c"run mdev\00"
@.str.16 = [17 x i8] c"/etc/init.d/mdev\00"
define void @omb_utils_init_system() {
%1 = tail call i32 @omb_log(i32 2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @omb_utils_is_mounted(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 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, i8* null)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @omb_log(i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %4, %7, %0
%10 = tail call i32 @omb_log(i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @omb_utils_is_mounted(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = tail call i64 @mount(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.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* null)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 @omb_log(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %18
18: ; preds = %13, %16, %9
%19 = tail call i32 @omb_log(i32 2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%20 = tail call i32 @omb_utils_is_mounted(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = tail call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @omb_log(i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %27
27: ; preds = %22, %25, %18
%28 = tail call i32 @omb_log(i32 2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%29 = tail call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0))
%30 = tail call i32 @omb_log(i32 2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
%31 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0))
%32 = tail call i32 @sleep(i32 2)
ret void
}