#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_BIND;
scalar_t__ chdir(char *);
scalar_t__ chroot(char *);
scalar_t__ execv(char *, char **);
int getpid();
scalar_t__ mount(char *, char *, char *, int /*<<< orphan*/,
                 int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sethostname(char *, int);
int container_main(void *arg) {
  char **args = (char **)arg;
  printf("Container [%5d] - inside the container!\n", getpid());
  if (sethostname("container", 10)) {
    perror("sethostname");
  }
  if (mount("proc", "rootfs/proc", "proc", 0, NULL))
    perror("proc");
  if (mount("sysfs", "rootfs/sys", "sysfs", 0, NULL))
    perror("sys");
  if (mount("none", "rootfs/tmp", "tmpfs", 0, NULL))
    perror("tmp");
  if (mount("udev", "rootfs/dev", "devtmpfs", 0, NULL))
    perror("dev");
  if (mount("tmpfs", "rootfs/run", "tmpfs", 0, NULL))
    perror("run");
  if (mount("shm", "rootfs/dev/shm", "tmpfs", 0, NULL))
    perror("dev/shm");
  if (mount("devpts", "rootfs/dev/pts", "devpts", 0, NULL))
    perror("dev/pts");
  if (mount("conf/hosts", "rootfs/etc/hosts", "none", MS_BIND, NULL) ||
      mount("conf/hostname", "rootfs/etc/hostname", "none", MS_BIND, NULL) ||
      mount("conf/resolv.conf", "rootfs/etc/resolv.conf", "none", MS_BIND,
            NULL)) {
    perror("conf");
  }
  if (mount("/tmp/t1", "rootfs/mnt", "none", MS_BIND, NULL))
    perror("mnt");
  if (chdir("./rootfs") || chroot("./")) {
    perror("chdir/chroot");
  }
  if (execv(args[0], args))
    perror("exec");
  printf("Something's wrong!\n");
  return 1;
}


x86 assembly (clang, -O0):
<container_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe77(%rip),%rdi
mov    $0xa,%esi
call   1080 <sethostname@plt>
cmp    $0x0,%rax
je     11d2 <container_main+0x52>
lea    0xe66(%rip),%rdi
call   1090 <perror@plt>
lea    0xe6d(%rip),%rdx
lea    0xe5f(%rip),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rdx,%rdi
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1205 <container_main+0x85>
lea    0xe46(%rip),%rdi
call   1090 <perror@plt>
lea    0xe3f(%rip),%rdx
lea    0xe3e(%rip),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rdx,%rdi
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1238 <container_main+0xb8>
lea    0xe25(%rip),%rdi
call   1090 <perror@plt>
lea    0xe1d(%rip),%rdi
lea    0xe1b(%rip),%rsi
lea    0xe32(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     126f <container_main+0xef>
lea    0xdfe(%rip),%rdi
call   1090 <perror@plt>
lea    0xdf6(%rip),%rdi
lea    0xdf4(%rip),%rsi
lea    0xdf8(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     12a6 <container_main+0x126>
lea    0xdd7(%rip),%rdi
call   1090 <perror@plt>
lea    0xdd2(%rip),%rdx
lea    0xdd1(%rip),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rdx,%rdi
call   1050 <mount@plt>
cmp    $0x0,%rax
je     12d9 <container_main+0x159>
lea    0xdb8(%rip),%rdi
call   1090 <perror@plt>
lea    0xdbb(%rip),%rdi
lea    0xda9(%rip),%rsi
lea    0xd91(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1310 <container_main+0x190>
lea    0xd8c(%rip),%rdi
call   1090 <perror@plt>
lea    0xd88(%rip),%rdx
lea    0xd88(%rip),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rdx,%rdi
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1343 <container_main+0x1c3>
lea    0xd6f(%rip),%rdi
call   1090 <perror@plt>
mov    0x2c9e(%rip),%rax
mov    (%rax),%ecx
lea    0xd62(%rip),%rdi
lea    0xd66(%rip),%rsi
lea    0xcfb(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
jne    13d9 <container_main+0x259>
mov    0x2c6c(%rip),%rax
mov    (%rax),%ecx
lea    0xd4c(%rip),%rdi
lea    0xd53(%rip),%rsi
lea    0xcc9(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
jne    13d9 <container_main+0x259>
mov    0x2c3a(%rip),%rax
mov    (%rax),%ecx
lea    0xd3c(%rip),%rdi
lea    0xd46(%rip),%rsi
lea    0xc97(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     13e5 <container_main+0x265>
lea    0xd36(%rip),%rdi
call   1090 <perror@plt>
mov    0x2bfc(%rip),%rax
mov    (%rax),%ecx
lea    0xd26(%rip),%rdi
lea    0xd27(%rip),%rsi
lea    0xc59(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <mount@plt>
cmp    $0x0,%rax
je     1423 <container_main+0x2a3>
lea    0xd0c(%rip),%rdi
call   1090 <perror@plt>
lea    0xd04(%rip),%rdi
call   1060 <chdir@plt>
cmp    $0x0,%rax
jne    144f <container_main+0x2cf>
lea    0xcf7(%rip),%rdi
call   1030 <chroot@plt>
cmp    $0x0,%rax
je     145b <container_main+0x2db>
lea    0xce4(%rip),%rdi
call   1090 <perror@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   10a0 <execv@plt>
cmp    $0x0,%rax
je     1481 <container_main+0x301>
lea    0xccb(%rip),%rdi
call   1090 <perror@plt>
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<container_main>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0xa,%esi
call   1090 <sethostname@plt>
test   %rax,%rax
jne    13e1 <container_main+0x251>
lea    0xe70(%rip),%rsi
lea    0xe70(%rip),%rdi
mov    %rdi,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    13f2 <container_main+0x262>
lea    0xe5e(%rip),%rsi
lea    0xe51(%rip),%rdi
mov    %rdi,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    1403 <container_main+0x273>
lea    0xe45(%rip),%rdi
lea    0xe43(%rip),%rsi
lea    0xe5a(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    1414 <container_main+0x284>
lea    0xe2d(%rip),%rdi
lea    0xe2b(%rip),%rsi
lea    0xe2f(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    1425 <container_main+0x295>
lea    0xe1e(%rip),%rsi
lea    0xe11(%rip),%rdi
mov    %rdi,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    1436 <container_main+0x2a6>
lea    0xe10(%rip),%rdi
lea    0xdfe(%rip),%rsi
lea    0xde6(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    1447 <container_main+0x2b7>
lea    0xdf3(%rip),%rsi
lea    0xde5(%rip),%rdi
mov    %rdi,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    1458 <container_main+0x2c8>
mov    0x2d11(%rip),%rbx
mov    (%rbx),%ecx
lea    0xdd5(%rip),%rdi
lea    0xdd9(%rip),%rsi
lea    0xd6e(%rip),%rdx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    13c2 <container_main+0x232>
mov    (%rbx),%ecx
lea    0xdc9(%rip),%rdi
lea    0xdd0(%rip),%rsi
lea    0xd46(%rip),%rdx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    13c2 <container_main+0x232>
mov    (%rbx),%ecx
lea    0xdc3(%rip),%rdi
lea    0xdcd(%rip),%rsi
lea    0xd1e(%rip),%rdx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    13c2 <container_main+0x232>
mov    (%rbx),%ecx
lea    0xdc7(%rip),%rdi
lea    0xdc8(%rip),%rsi
lea    0xcfa(%rip),%rdx
xor    %r8d,%r8d
call   1060 <mount@plt>
test   %rax,%rax
jne    1469 <container_main+0x2d9>
lea    0xdb4(%rip),%rdi
call   1070 <chdir@plt>
test   %rax,%rax
jne    13d3 <container_main+0x243>
lea    0xdac(%rip),%rdi
call   1030 <chroot@plt>
test   %rax,%rax
jne    13d3 <container_main+0x243>
mov    (%r14),%rdi
mov    %r14,%rsi
call   10b0 <execv@plt>
test   %rax,%rax
jne    147a <container_main+0x2ea>
lea    0xd9c(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd4d(%rip),%rdi
call   10a0 <perror@plt>
jmp    134b <container_main+0x1bb>
lea    0xd60(%rip),%rdi
call   10a0 <perror@plt>
jmp    1395 <container_main+0x205>
lea    0xc4b(%rip),%rdi
call   10a0 <perror@plt>
jmp    11c8 <container_main+0x38>
lea    0xc4d(%rip),%rdi
call   10a0 <perror@plt>
jmp    11ec <container_main+0x5c>
lea    0xc4e(%rip),%rdi
call   10a0 <perror@plt>
jmp    1210 <container_main+0x80>
lea    0xc4d(%rip),%rdi
call   10a0 <perror@plt>
jmp    1238 <container_main+0xa8>
lea    0xc4c(%rip),%rdi
call   10a0 <perror@plt>
jmp    1260 <container_main+0xd0>
lea    0xc4f(%rip),%rdi
call   10a0 <perror@plt>
jmp    1284 <container_main+0xf4>
lea    0xc49(%rip),%rdi
call   10a0 <perror@plt>
jmp    12ac <container_main+0x11c>
lea    0xc4e(%rip),%rdi
call   10a0 <perror@plt>
jmp    12d0 <container_main+0x140>
lea    0xcba(%rip),%rdi
call   10a0 <perror@plt>
jmp    1373 <container_main+0x1e3>
lea    0xcc6(%rip),%rdi
call   10a0 <perror@plt>
jmp    13a9 <container_main+0x219>

LLVM IR (-O0):
@.str = [41 x i8] c"Container [%5d] - inside the container!\0A\00"
@.str.1 = [10 x i8] c"container\00"
@.str.2 = [12 x i8] c"sethostname\00"
@.str.3 = [5 x i8] c"proc\00"
@.str.4 = [12 x i8] c"rootfs/proc\00"
@.str.5 = [6 x i8] c"sysfs\00"
@.str.6 = [11 x i8] c"rootfs/sys\00"
@.str.7 = [4 x i8] c"sys\00"
@.str.8 = [5 x i8] c"none\00"
@.str.9 = [11 x i8] c"rootfs/tmp\00"
@.str.10 = [6 x i8] c"tmpfs\00"
@.str.11 = [4 x i8] c"tmp\00"
@.str.12 = [5 x i8] c"udev\00"
@.str.13 = [11 x i8] c"rootfs/dev\00"
@.str.14 = [9 x i8] c"devtmpfs\00"
@.str.15 = [4 x i8] c"dev\00"
@.str.16 = [11 x i8] c"rootfs/run\00"
@.str.17 = [4 x i8] c"run\00"
@.str.18 = [4 x i8] c"shm\00"
@.str.19 = [15 x i8] c"rootfs/dev/shm\00"
@.str.20 = [8 x i8] c"dev/shm\00"
@.str.21 = [7 x i8] c"devpts\00"
@.str.22 = [15 x i8] c"rootfs/dev/pts\00"
@.str.23 = [8 x i8] c"dev/pts\00"
@.str.24 = [11 x i8] c"conf/hosts\00"
@.str.25 = [17 x i8] c"rootfs/etc/hosts\00"
@MS_BIND = global i32 0
@.str.26 = [14 x i8] c"conf/hostname\00"
@.str.27 = [20 x i8] c"rootfs/etc/hostname\00"
@.str.28 = [17 x i8] c"conf/resolv.conf\00"
@.str.29 = [23 x i8] c"rootfs/etc/resolv.conf\00"
@.str.30 = [5 x i8] c"conf\00"
@.str.31 = [8 x i8] c"/tmp/t1\00"
@.str.32 = [11 x i8] c"rootfs/mnt\00"
@.str.33 = [4 x i8] c"mnt\00"
@.str.34 = [9 x i8] c"./rootfs\00"
@.str.35 = [3 x i8] c"./\00"
@.str.36 = [13 x i8] c"chdir/chroot\00"
@.str.37 = [5 x i8] c"exec\00"
@.str.38 = [20 x i8] c"Something's wrong!\0A\00"
define i32 @container_main(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i8**
store i8** %5, i8*** %3
%6 = call i32 (...) @getpid()
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i64 @sethostname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 10)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 0, i32* null)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 0, i32* null)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 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, i32* null)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i32 0, i32* null)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0, i32* null)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %37
37: ; preds = %35, %32
%38 = call i64 @mount(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0, i32* null)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0))
br label %42
42: ; preds = %40, %37
%43 = call i64 @mount(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0), i32 0, i32* null)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0))
br label %47
47: ; preds = %45, %42
%48 = load i32, i32* @MS_BIND
%49 = call i64 @mount(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.25, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %48, i32* null)
%50 = icmp ne i64 %49, 0
br i1 %50, label %59, label %51
51: ; preds = %47
%52 = load i32, i32* @MS_BIND
%53 = call i64 @mount(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.26, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %52, i32* null)
%54 = icmp ne i64 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %51
%56 = load i32, i32* @MS_BIND
%57 = call i64 @mount(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.29, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %56, i32* null)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %55, %51, %47
%60 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.30, i64 0, i64 0))
br label %61
61: ; preds = %59, %55
%62 = load i32, i32* @MS_BIND
%63 = call i64 @mount(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.31, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %62, i32* null)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.33, i64 0, i64 0))
br label %67
67: ; preds = %65, %61
%68 = call i64 @chdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.34, i64 0, i64 0))
%69 = icmp ne i64 %68, 0
br i1 %69, label %73, label %70
70: ; preds = %67
%71 = call i64 @chroot(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i64 0, i64 0))
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %70, %67
%74 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.36, i64 0, i64 0))
br label %75
75: ; preds = %73, %70
%76 = load i8**, i8*** %3
%77 = getelementptr inbounds i8*, i8** %76, i64 0
%78 = load i8*, i8** %77
%79 = load i8**, i8*** %3
%80 = call i64 @execv(i8* %78, i8** %79)
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %75
%83 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.37, i64 0, i64 0))
br label %84
84: ; preds = %82, %75
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.38, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [41 x i8] c"Container [%5d] - inside the container!\0A\00"
@.str.1 = [10 x i8] c"container\00"
@.str.2 = [12 x i8] c"sethostname\00"
@.str.3 = [5 x i8] c"proc\00"
@.str.4 = [12 x i8] c"rootfs/proc\00"
@.str.5 = [6 x i8] c"sysfs\00"
@.str.6 = [11 x i8] c"rootfs/sys\00"
@.str.7 = [4 x i8] c"sys\00"
@.str.8 = [5 x i8] c"none\00"
@.str.9 = [11 x i8] c"rootfs/tmp\00"
@.str.10 = [6 x i8] c"tmpfs\00"
@.str.11 = [4 x i8] c"tmp\00"
@.str.12 = [5 x i8] c"udev\00"
@.str.13 = [11 x i8] c"rootfs/dev\00"
@.str.14 = [9 x i8] c"devtmpfs\00"
@.str.15 = [4 x i8] c"dev\00"
@.str.16 = [11 x i8] c"rootfs/run\00"
@.str.17 = [4 x i8] c"run\00"
@.str.18 = [4 x i8] c"shm\00"
@.str.19 = [15 x i8] c"rootfs/dev/shm\00"
@.str.20 = [8 x i8] c"dev/shm\00"
@.str.21 = [7 x i8] c"devpts\00"
@.str.22 = [15 x i8] c"rootfs/dev/pts\00"
@.str.23 = [8 x i8] c"dev/pts\00"
@.str.24 = [11 x i8] c"conf/hosts\00"
@.str.25 = [17 x i8] c"rootfs/etc/hosts\00"
@MS_BIND = global i32 0
@.str.26 = [14 x i8] c"conf/hostname\00"
@.str.27 = [20 x i8] c"rootfs/etc/hostname\00"
@.str.28 = [17 x i8] c"conf/resolv.conf\00"
@.str.29 = [23 x i8] c"rootfs/etc/resolv.conf\00"
@.str.30 = [5 x i8] c"conf\00"
@.str.31 = [8 x i8] c"/tmp/t1\00"
@.str.32 = [11 x i8] c"rootfs/mnt\00"
@.str.33 = [4 x i8] c"mnt\00"
@.str.34 = [9 x i8] c"./rootfs\00"
@.str.35 = [3 x i8] c"./\00"
@.str.36 = [13 x i8] c"chdir/chroot\00"
@.str.37 = [5 x i8] c"exec\00"
@str = [19 x i8] c"Something's wrong!\00"
define i32 @container_main(i8* %0) {
%2 = bitcast i8* %0 to i8**
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i64 @sethostname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 10)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 0, i32* null)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = tail call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 0, i32* null)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 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, i32* null)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = tail call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = tail call i64 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i32 0, i32* null)
%26 = icmp eq i64 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = tail call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = tail call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0, i32* null)
%31 = icmp eq i64 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = tail call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = tail call i64 @mount(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0, i32* null)
%36 = icmp eq i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = tail call i64 @mount(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0), i32 0, i32* null)
%41 = icmp eq i64 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
%45 = load i32, i32* @MS_BIND
%46 = tail call i64 @mount(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.25, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %45, i32* null)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %56
48: ; preds = %44
%49 = load i32, i32* @MS_BIND
%50 = tail call i64 @mount(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.26, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %49, i32* null)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %56
52: ; preds = %48
%53 = load i32, i32* @MS_BIND
%54 = tail call i64 @mount(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.29, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %53, i32* null)
%55 = icmp eq i64 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %52, %48, %44
%57 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.30, i64 0, i64 0))
br label %58
58: ; preds = %56, %52
%59 = load i32, i32* @MS_BIND
%60 = tail call i64 @mount(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.31, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %59, i32* null)
%61 = icmp eq i64 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %58
%63 = tail call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.33, i64 0, i64 0))
br label %64
64: ; preds = %62, %58
%65 = tail call i64 @chdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.34, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %64
%68 = tail call i64 @chroot(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %67, %64
%71 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.36, i64 0, i64 0))
br label %72
72: ; preds = %70, %67
%73 = load i8*, i8** %2
%74 = tail call i64 @execv(i8* %73, i8** %2)
%75 = icmp eq i64 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %72
%77 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.37, i64 0, i64 0))
br label %78
78: ; preds = %76, %72
%79 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 1
}