#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 */
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ newmount;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ MNT_FORCE;
int /*<<< orphan*/ O_RDONLY;
int PATH_MAX;
scalar_t__ chdir(char const *);
scalar_t__ chroot(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
scalar_t__ mount(char const *, char *, int /*<<< orphan*/ *, int,
                 int /*<<< orphan*/ *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ recursiveRemove(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *);
int /*<<< orphan*/ umount2(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ warn(char *, ...);
int /*<<< orphan*/ warnx(char *, char const *);
int switchroot(const char *newroot) {
  const char *umounts[] = {"/dev", "/proc", "/sys", NULL};
  int i;
  int cfd;
  pid_t pid;
  for (i = 0; umounts[i] != NULL; i++) {
    char newmount[PATH_MAX];
    snprintf(newmount, sizeof(newmount), "%s%s", newroot, umounts[i]);
    if (mount(umounts[i], newmount, NULL, 8192, NULL) < 0) {
      warn("failed to mount moving %s to %s", umounts[i], newmount);
      warnx("forcing unmount of %s", umounts[i]);
      umount2(umounts[i], MNT_FORCE);
    }
  }
  if (chdir(newroot)) {
    warn("failed to change directory to %s", newroot);
    return -1;
  }
  cfd = open("/", O_RDONLY);
  if (mount(newroot, "/", NULL, 8192, NULL) < 0) {
    warn("failed to mount moving %s to /", newroot);
    return -1;
  }
  if (chroot(".")) {
    warn("failed to change root");
    return -1;
  }
  if (cfd >= 0) {
    pid = fork();
    if (pid <= 0) {
      recursiveRemove(cfd);
      if (pid == 0)
        exit(EXIT_SUCCESS);
    }
    close(cfd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<switchroot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2c0d(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c0a(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c07(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c04(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmpq   $0x0,-0x30(%rbp,%rax,8)
je     12db <switchroot+0x11b>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x58(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x50(%rbp)
mov    %eax,%esi
mov    -0x10(%rbp),%rcx
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%r8
lea    0xdbf(%rip),%rdx
call   1090 <snprintf@plt>
mov    -0x58(%rbp),%rsi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x2000,%ecx
mov    %r8,%rdx
call   1060 <mount@plt>
cmp    $0x0,%rax
jge    12c6 <switchroot+0x106>
mov    -0x58(%rbp),%rdx
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1040 <warn@plt>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xd8b(%rip),%rdi
call   1080 <warnx@plt>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
mov    0x2d19(%rip),%rax
mov    (%rax),%esi
call   1050 <umount2@plt>
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ff <switchroot+0x3f>
mov    -0x10(%rbp),%rdi
call   1070 <chdir@plt>
cmp    $0x0,%rax
je     130c <switchroot+0x14c>
mov    -0x10(%rbp),%rsi
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1040 <warn@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ee <switchroot+0x22e>
mov    0x2ccd(%rip),%rax
mov    (%rax),%esi
lea    0xd6d(%rip),%rdi
call   10c0 <open@plt>
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd5a(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x2000,%ecx
mov    %r8,%rdx
call   1060 <mount@plt>
cmp    $0x0,%rax
jge    1369 <switchroot+0x1a9>
mov    -0x10(%rbp),%rsi
lea    0xd16(%rip),%rdi
mov    $0x0,%al
call   1040 <warn@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ee <switchroot+0x22e>
lea    0xd1b(%rip),%rdi
call   1030 <chroot@plt>
cmp    $0x0,%rax
je     1399 <switchroot+0x1d9>
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1040 <warn@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ee <switchroot+0x22e>
cmpl   $0x0,-0x38(%rbp)
jl     13e7 <switchroot+0x227>
mov    $0x0,%al
call   10e0 <fork@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jg     13df <switchroot+0x21f>
mov    -0x38(%rbp),%edi
call   10b0 <recursiveRemove@plt>
cmpq   $0x0,-0x40(%rbp)
jne    13da <switchroot+0x21a>
mov    0x2bf5(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
jmp    13df <switchroot+0x21f>
mov    -0x38(%rbp),%edi
call   10a0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<switchroot>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
mov    %rsp,%r13
mov    0x2e15(%rip),%r12
mov    (%r12),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe16(%rip),%rdx
lea    0xdff(%rip),%r14
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
call   1090 <snprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x2000,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jns    1264 <switchroot+0xa4>
lea    0xde5(%rip),%rdi
lea    0xdc9(%rip),%r14
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <warn@plt>
lea    0xdea(%rip),%rdi
mov    %r14,%rsi
call   1080 <warnx@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1050 <umount2@plt>
mov    %r13,%rsp
mov    %rsp,%r13
mov    (%r12),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xd87(%rip),%rdx
lea    0xd75(%rip),%r14
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
call   1090 <snprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x2000,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jns    12f3 <switchroot+0x133>
lea    0xd56(%rip),%rdi
lea    0xd3f(%rip),%r14
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <warn@plt>
lea    0xd5b(%rip),%rdi
mov    %r14,%rsi
call   1080 <warnx@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1050 <umount2@plt>
mov    %r13,%rsp
mov    %rsp,%r13
mov    (%r12),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xcf8(%rip),%rdx
lea    0xcec(%rip),%r14
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
call   1090 <snprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x2000,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jns    1382 <switchroot+0x1c2>
lea    0xcc7(%rip),%rdi
lea    0xcb6(%rip),%r14
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <warn@plt>
lea    0xccc(%rip),%rdi
mov    %r14,%rsi
call   1080 <warnx@plt>
mov    0x2c60(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1050 <umount2@plt>
mov    %r13,%rsp
mov    %r15,%rdi
call   1070 <chdir@plt>
test   %rax,%rax
je     13b9 <switchroot+0x1f9>
lea    0xcb2(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <warn@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c20(%rip),%rax
mov    (%rax),%esi
lea    0xcc0(%rip),%rbx
mov    %rbx,%rdi
call   10c0 <open@plt>
mov    %eax,%r14d
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x2000,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
js     140f <switchroot+0x24f>
lea    0xc96(%rip),%rdi
call   1030 <chroot@plt>
test   %rax,%rax
je     1418 <switchroot+0x258>
lea    0xc87(%rip),%rdi
xor    %eax,%eax
call   1040 <warn@plt>
jmp    13a3 <switchroot+0x1e3>
lea    0xc56(%rip),%rdi
jmp    1399 <switchroot+0x1d9>
xor    %ebx,%ebx
test   %r14d,%r14d
js     13a8 <switchroot+0x1e8>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %rax,%rax
jg     143b <switchroot+0x27b>
mov    %rax,%r15
mov    %r14d,%edi
call   10b0 <recursiveRemove@plt>
test   %r15,%r15
je     1448 <switchroot+0x288>
mov    %r14d,%edi
call   10a0 <close@plt>
jmp    13a8 <switchroot+0x1e8>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"/dev\00"
@.str.1 = [6 x i8] c"/proc\00"
@.str.2 = [5 x i8] c"/sys\00"
@__const.switchroot.umounts = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* null]
@PATH_MAX = global i32 0
@.str.3 = [5 x i8] c"%s%s\00"
@.str.4 = [32 x i8] c"failed to mount moving %s to %s\00"
@.str.5 = [22 x i8] c"forcing unmount of %s\00"
@MNT_FORCE = global i32 0
@.str.6 = [33 x i8] c"failed to change directory to %s\00"
@.str.7 = [2 x i8] c"/\00"
@O_RDONLY = global i32 0
@.str.8 = [31 x i8] c"failed to mount moving %s to /\00"
@.str.9 = [2 x i8] c".\00"
@.str.10 = [22 x i8] c"failed to change root\00"
@EXIT_SUCCESS = global i32 0
define i32 @switchroot(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [4 x i8*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %3
%10 = bitcast [4 x i8*]* %4 to i8*
store i32 0, i32* %5
br label %11
11: ; preds = %54, %1
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %57
17: ; preds = %11
%18 = load i32, i32* @PATH_MAX
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %8
%21 = alloca i8, i64 %19
store i64 %19, i64* %9
%22 = trunc i64 %19 to i32
%23 = load i8*, i8** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @snprintf(i8* %21, i32 %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %23, i8* %27)
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %30
%32 = load i8*, i8** %31
%33 = call i64 @mount(i8* %32, i8* %21, i32* null, i32 8192, i32* null)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %52
35: ; preds = %17
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %39, i8* %21)
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @warnx(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %44)
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %47
%49 = load i8*, i8** %48
%50 = load i32, i32* @MNT_FORCE
%51 = call i32 @umount2(i8* %49, i32 %50)
br label %52
52: ; preds = %35, %17
%53 = load i8*, i8** %8
br label %54
54: ; preds = %52
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
br label %11
57: ; preds = %11
%58 = load i8*, i8** %3
%59 = call i64 @chdir(i8* %58)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = load i8*, i8** %3
%63 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %62)
store i32 -1, i32* %2
br label %98
64: ; preds = %57
%65 = load i32, i32* @O_RDONLY
%66 = call i32 @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %65)
store i32 %66, i32* %6
%67 = load i8*, i8** %3
%68 = call i64 @mount(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32* null, i32 8192, i32* null)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %64
%71 = load i8*, i8** %3
%72 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %71)
store i32 -1, i32* %2
br label %98
73: ; preds = %64
%74 = call i64 @chroot(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%75 = icmp ne i64 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %2
br label %98
78: ; preds = %73
%79 = load i32, i32* %6
%80 = icmp sge i32 %79, 0
br i1 %80, label %81, label %97
81: ; preds = %78
%82 = call i64 (...) @fork()
store i64 %82, i64* %7
%83 = load i64, i64* %7
%84 = icmp sle i64 %83, 0
br i1 %84, label %85, label %94
85: ; preds = %81
%86 = load i32, i32* %6
%87 = call i32 @recursiveRemove(i32 %86)
%88 = load i64, i64* %7
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %85
%91 = load i32, i32* @EXIT_SUCCESS
%92 = call i32 @exit(i32 %91)
unreachable
93: ; preds = %85
br label %94
94: ; preds = %93, %81
%95 = load i32, i32* %6
%96 = call i32 @close(i32 %95)
br label %97
97: ; preds = %94, %78
store i32 0, i32* %2
br label %98
98: ; preds = %97, %76, %70, %61
%99 = load i32, i32* %2
ret i32 %99
}

LLVM IR (-O2):
@.str = [5 x i8] c"/dev\00"
@.str.1 = [6 x i8] c"/proc\00"
@.str.2 = [5 x i8] c"/sys\00"
@PATH_MAX = global i32 0
@.str.3 = [5 x i8] c"%s%s\00"
@.str.4 = [32 x i8] c"failed to mount moving %s to %s\00"
@.str.5 = [22 x i8] c"forcing unmount of %s\00"
@MNT_FORCE = global i32 0
@.str.6 = [33 x i8] c"failed to change directory to %s\00"
@.str.7 = [2 x i8] c"/\00"
@O_RDONLY = global i32 0
@.str.8 = [31 x i8] c"failed to mount moving %s to /\00"
@.str.9 = [2 x i8] c".\00"
@.str.10 = [22 x i8] c"failed to change root\00"
@EXIT_SUCCESS = global i32 0
define i32 @switchroot(i8* %0) {
%2 = load i32, i32* @PATH_MAX
%3 = zext i32 %2 to i64
%4 = call i8* @llvm.stacksave()
%5 = alloca i8, i64 %3
%6 = call i32 @snprintf(i8* %5, i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i32* null, i32 8192, i32* null)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%11 = call i32 @warnx(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @MNT_FORCE
%13 = call i32 @umount2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %9, %1
%15 = load i32, i32* @PATH_MAX
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
%18 = alloca i8, i64 %16
%19 = call i32 @snprintf(i8* %18, i32 %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%20 = call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %18, i32* null, i32 8192, i32* null)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %14
%23 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%24 = call i32 @warnx(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @MNT_FORCE
%26 = call i32 @umount2(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %22, %14
%28 = load i32, i32* @PATH_MAX
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
%31 = alloca i8, i64 %29
%32 = call i32 @snprintf(i8* %31, i32 %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%33 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %31, i32* null, i32 8192, i32* null)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %27
%36 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%37 = call i32 @warnx(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @MNT_FORCE
%39 = call i32 @umount2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %35, %27
%41 = call i64 @chdir(i8* %0)
%42 = icmp eq i64 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %0)
br label %70
45: ; preds = %40
%46 = load i32, i32* @O_RDONLY
%47 = call i32 @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %46)
%48 = call i64 @mount(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32* null, i32 8192, i32* null)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %0)
br label %70
52: ; preds = %45
%53 = call i64 @chroot(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %57, label %55
55: ; preds = %52
%56 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %70
57: ; preds = %52
%58 = icmp sgt i32 %47, -1
br i1 %58, label %59, label %70
59: ; preds = %57
%60 = call i64 (...) @fork()
%61 = icmp slt i64 %60, 1
br i1 %61, label %62, label %68
62: ; preds = %59
%63 = call i32 @recursiveRemove(i32 %47)
%64 = icmp eq i64 %60, 0
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = load i32, i32* @EXIT_SUCCESS
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %62, %59
%69 = call i32 @close(i32 %47)
br label %70
70: ; preds = %57, %68, %55, %50, %43
%71 = phi i32 [ -1, %43 ], [ -1, %50 ], [ -1, %55 ], [ 0, %68 ], [ 0, %57 ]
ret i32 %71
}