#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 */
void failed_ensure(char *, int);
scalar_t__ mkdir(char *, int);
scalar_t__ mount(char *, char *, char *, int /*<<< orphan*/, char *);
void setup_fs() {
  ((mkdir("/tmp", 0700) == 0) ? (void)(0) : failed_ensure("mkdir /tmp", 58));
  ;
  ((mkdir("/tmp/mnt", 0700) == 0) ? (void)(0)
                                  : failed_ensure("mkdir /tmp/mnt", 59));
  ;
  ((mkdir("/sys", 0700) == 0) ? (void)(0) : failed_ensure("mkdir /sys", 60));
  ;
  ((mkdir("/proc", 0700) == 0) ? (void)(0) : failed_ensure("mkdir /proc", 61));
  ;
  ((mount("sysfs", "/sys", "sysfs", 0, "") == 0)
       ? (void)(0)
       : failed_ensure("mount /sys", 64));
  ;
  ((mount("proc", "/proc", "proc", 0, "") == 0)
       ? (void)(0)
       : failed_ensure("mount /proc", 65));
  ;
  ((mount("d", "/dev", "devtmpfs", 0, "") == 0)
       ? (void)(0)
       : failed_ensure("mount /devtmpfs", 66));
  ;
}


x86 assembly (clang, -O0):
<setup_fs>:
push   %rbp
mov    %rsp,%rbp
lea    0xecb(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jne    1154 <setup_fs+0x24>
jmp    1165 <setup_fs+0x35>
lea    0xea5(%rip),%rdi
mov    $0x3a,%esi
call   1050 <failed_ensure@plt>
lea    0xea5(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jne    1185 <setup_fs+0x55>
jmp    1196 <setup_fs+0x66>
lea    0xe7f(%rip),%rdi
mov    $0x3b,%esi
call   1050 <failed_ensure@plt>
lea    0xe83(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jne    11b6 <setup_fs+0x86>
jmp    11c7 <setup_fs+0x97>
lea    0xe5d(%rip),%rdi
mov    $0x3c,%esi
call   1050 <failed_ensure@plt>
lea    0xe5d(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jne    11e7 <setup_fs+0xb7>
jmp    11f8 <setup_fs+0xc8>
lea    0xe37(%rip),%rdi
mov    $0x3d,%esi
call   1050 <failed_ensure@plt>
lea    0xe32(%rip),%rdx
lea    0xe1a(%rip),%rsi
xor    %ecx,%ecx
lea    0xe21(%rip),%r8
mov    %rdx,%rdi
call   1040 <mount@plt>
cmp    $0x0,%rax
jne    1226 <setup_fs+0xf6>
jmp    1237 <setup_fs+0x107>
lea    0xe0a(%rip),%rdi
mov    $0x40,%esi
call   1050 <failed_ensure@plt>
lea    0xdee(%rip),%rdx
lea    0xde6(%rip),%rsi
xor    %ecx,%ecx
lea    0xde2(%rip),%r8
mov    %rdx,%rdi
call   1040 <mount@plt>
cmp    $0x0,%rax
jne    1265 <setup_fs+0x135>
jmp    1276 <setup_fs+0x146>
lea    0xdd6(%rip),%rdi
mov    $0x41,%esi
call   1050 <failed_ensure@plt>
lea    0xdd1(%rip),%rdi
lea    0xdcc(%rip),%rsi
lea    0xdd1(%rip),%rdx
xor    %ecx,%ecx
lea    0xd9c(%rip),%r8
call   1040 <mount@plt>
cmp    $0x0,%rax
jne    12a8 <setup_fs+0x178>
jmp    12b9 <setup_fs+0x189>
lea    0xda6(%rip),%rdi
mov    $0x42,%esi
call   1050 <failed_ensure@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_fs>:
push   %rax
lea    0xece(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     1158 <setup_fs+0x28>
lea    0xeb2(%rip),%rdi
mov    $0x3a,%esi
call   1050 <failed_ensure@plt>
lea    0xeb2(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     117f <setup_fs+0x4f>
lea    0xe96(%rip),%rdi
mov    $0x3b,%esi
call   1050 <failed_ensure@plt>
lea    0xe9a(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     11a6 <setup_fs+0x76>
lea    0xe7e(%rip),%rdi
mov    $0x3c,%esi
call   1050 <failed_ensure@plt>
lea    0xe7e(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     11cd <setup_fs+0x9d>
lea    0xe62(%rip),%rdi
mov    $0x3d,%esi
call   1050 <failed_ensure@plt>
lea    0xe4c(%rip),%rsi
lea    0xe56(%rip),%rdi
lea    0xe4e(%rip),%r8
mov    %rdi,%rdx
xor    %ecx,%ecx
call   1040 <mount@plt>
test   %rax,%rax
je     1202 <setup_fs+0xd2>
lea    0xe3f(%rip),%rdi
mov    $0x40,%esi
call   1050 <failed_ensure@plt>
lea    0xe22(%rip),%rsi
lea    0xe1c(%rip),%rdi
lea    0xe19(%rip),%r8
mov    %rdi,%rdx
xor    %ecx,%ecx
call   1040 <mount@plt>
test   %rax,%rax
je     1237 <setup_fs+0x107>
lea    0xe15(%rip),%rdi
mov    $0x41,%esi
call   1050 <failed_ensure@plt>
lea    0xe10(%rip),%rdi
lea    0xe0b(%rip),%rsi
lea    0xe10(%rip),%rdx
lea    0xddd(%rip),%r8
xor    %ecx,%ecx
call   1040 <mount@plt>
test   %rax,%rax
je     1271 <setup_fs+0x141>
lea    0xdef(%rip),%rdi
mov    $0x42,%esi
pop    %rax
jmp    1050 <failed_ensure@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [11 x i8] c"mkdir /tmp\00"
@.str.2 = [9 x i8] c"/tmp/mnt\00"
@.str.3 = [15 x i8] c"mkdir /tmp/mnt\00"
@.str.4 = [5 x i8] c"/sys\00"
@.str.5 = [11 x i8] c"mkdir /sys\00"
@.str.6 = [6 x i8] c"/proc\00"
@.str.7 = [12 x i8] c"mkdir /proc\00"
@.str.8 = [6 x i8] c"sysfs\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [11 x i8] c"mount /sys\00"
@.str.11 = [5 x i8] c"proc\00"
@.str.12 = [12 x i8] c"mount /proc\00"
@.str.13 = [2 x i8] c"d\00"
@.str.14 = [5 x i8] c"/dev\00"
@.str.15 = [9 x i8] c"devtmpfs\00"
@.str.16 = [16 x i8] c"mount /devtmpfs\00"
define void @setup_fs() {
%1 = call i64 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 448)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %4
3: ; preds = %0
br label %5
4: ; preds = %0
br label %5
5: ; preds = %4, %3
%6 = call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 448)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
br label %10
9: ; preds = %5
br label %10
10: ; preds = %9, %8
%11 = call i64 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 448)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %15
14: ; preds = %10
br label %15
15: ; preds = %14, %13
%16 = call i64 @mkdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 448)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %20
19: ; preds = %15
br label %20
20: ; preds = %19, %18
%21 = call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, 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.8, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
br label %25
24: ; preds = %20
br label %25
25: ; preds = %24, %23
%26 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, 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.11, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %25
br label %30
29: ; preds = %25
br label %30
30: ; preds = %29, %28
%31 = call i64 @mount(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %30
br label %35
34: ; preds = %30
br label %35
35: ; preds = %34, %33
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [11 x i8] c"mkdir /tmp\00"
@.str.2 = [9 x i8] c"/tmp/mnt\00"
@.str.3 = [15 x i8] c"mkdir /tmp/mnt\00"
@.str.4 = [5 x i8] c"/sys\00"
@.str.5 = [11 x i8] c"mkdir /sys\00"
@.str.6 = [6 x i8] c"/proc\00"
@.str.7 = [12 x i8] c"mkdir /proc\00"
@.str.8 = [6 x i8] c"sysfs\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [11 x i8] c"mount /sys\00"
@.str.11 = [5 x i8] c"proc\00"
@.str.12 = [12 x i8] c"mount /proc\00"
@.str.13 = [2 x i8] c"d\00"
@.str.14 = [5 x i8] c"/dev\00"
@.str.15 = [9 x i8] c"devtmpfs\00"
@.str.16 = [16 x i8] c"mount /devtmpfs\00"
define void @setup_fs() {
%1 = tail call i64 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 448)
%2 = icmp eq i64 %1, 0
br i1 %2, label %4, label %3
3: ; preds = %0
tail call void @failed_ensure(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 58)
br label %4
4: ; preds = %0, %3
%5 = tail call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 448)
%6 = icmp eq i64 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %4
tail call void @failed_ensure(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 59)
br label %8
8: ; preds = %4, %7
%9 = tail call i64 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 448)
%10 = icmp eq i64 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %8
tail call void @failed_ensure(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 60)
br label %12
12: ; preds = %8, %11
%13 = tail call i64 @mkdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 448)
%14 = icmp eq i64 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %12
tail call void @failed_ensure(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 61)
br label %16
16: ; preds = %12, %15
%17 = tail call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, 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.8, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %16
tail call void @failed_ensure(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 64)
br label %20
20: ; preds = %16, %19
%21 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, 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.11, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %20
tail call void @failed_ensure(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i32 65)
br label %24
24: ; preds = %20, %23
%25 = tail call i64 @mount(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %24
tail call void @failed_ensure(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0), i32 66)
br label %28
28: ; preds = %24, %27
ret void
}