#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 */
struct stat {
  int dummy;
};
typedef int pid_t;
typedef int /*<<< orphan*/ namespaces;
typedef int /*<<< orphan*/ jmp_buf;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AT_SYMLINK_NOFOLLOW;
scalar_t__ ENOENT;
int O_DIRECTORY;
int O_RDONLY;
int O_RDWR;
int PATH_MAX;
int /*<<< orphan*/ SIGKILL;
scalar_t__ STDERR_FILENO;
scalar_t__ STDIN_FILENO;
scalar_t__ STDOUT_FILENO;
int /*<<< orphan*/ TIOCSCTTY;
int atoi(char *);
int clone_parent(int /*<<< orphan*/ *);
int /*<<< orphan*/ close(int);
scalar_t__ dup2(int, scalar_t__);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fstatat(int, char *, struct stat *, int /*<<< orphan*/);
char *getenv(char *);
int ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int open(char *, int);
int openat(int, char *, int);
int setjmp(int /*<<< orphan*/);
int setns(int, int /*<<< orphan*/);
int setsid();
int snprintf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int write(int, char *, int);
void nsexec() {
  char *namespaces[] = {"ipc", "uts", "net", "pid", "mnt"};
  const int num = sizeof(namespaces) / sizeof(char *);
  jmp_buf env;
  char buf[PATH_MAX], *val;
  int i, tfd, child, len, consolefd = -1;
  pid_t pid;
  char *console;
  val = getenv("_LIBCONTAINER_INITPID");
  if (val == NULL)
    return;
  pid = atoi(val);
  snprintf(buf, sizeof(buf), "%d", pid);
  if (strcmp(val, buf)) {
    fprintf(stderr, "nsenter: "
                    "Unable to parse _LIBCONTAINER_INITPID"
                    ": %m\n");
    exit(1);
  }
  console = getenv("_LIBCONTAINER_CONSOLE_PATH");
  if (console != NULL) {
    consolefd = open(console, O_RDWR);
    if (consolefd < 0) {
      fprintf(stderr,
              "nsenter: "
              "Failed to open console %s"
              ": %m\n",
              console);
      exit(1);
    }
  }
  snprintf(buf, PATH_MAX - 1, "/proc/%d/ns", pid);
  tfd = open(buf, O_DIRECTORY | O_RDONLY);
  if (tfd == -1) {
    fprintf(stderr,
            "nsenter: "
            "Failed to open \"%s\""
            ": %m\n",
            buf);
    exit(1);
  }
  for (i = 0; i < num; i++) {
    struct stat st;
    int fd;
    if (fstatat(tfd, namespaces[i], &st, AT_SYMLINK_NOFOLLOW) == -1) {
      if (errno == ENOENT)
        continue;
    }
    fd = openat(tfd, namespaces[i], O_RDONLY);
    if (fd == -1) {
      fprintf(stderr,
              "nsenter: "
              "Failed to open ns file %s for ns %s"
              ": %m\n",
              buf, namespaces[i]);
      exit(1);
    }
    if (setns(fd, 0) == -1) {
      fprintf(stderr,
              "nsenter: "
              "Failed to setns for %s"
              ": %m\n",
              namespaces[i]);
      exit(1);
    }
    close(fd);
  }
  if (setjmp(env) == 1) {
    if (setsid() == -1) {
      fprintf(stderr, "nsenter: "
                      "setsid failed"
                      ": %m\n");
      exit(1);
    }
    if (consolefd != -1) {
      if (ioctl(consolefd, TIOCSCTTY, 0) == -1) {
        fprintf(stderr, "nsenter: "
                        "ioctl TIOCSCTTY failed"
                        ": %m\n");
        exit(1);
      }
      if (dup2(consolefd, STDIN_FILENO) != STDIN_FILENO) {
        fprintf(stderr, "nsenter: "
                        "Failed to dup 0"
                        ": %m\n");
        exit(1);
      }
      if (dup2(consolefd, STDOUT_FILENO) != STDOUT_FILENO) {
        fprintf(stderr, "nsenter: "
                        "Failed to dup 1"
                        ": %m\n");
        exit(1);
      }
      if (dup2(consolefd, STDERR_FILENO) != STDERR_FILENO) {
        fprintf(stderr, "nsenter: "
                        "Failed to dup 2"
                        ": %m\n");
        exit(1);
      }
    }
    return;
  }
  child = clone_parent(&env);
  if (child < 0) {
    fprintf(stderr, "nsenter: "
                    "Unable to fork"
                    ": %m\n");
    exit(1);
  }
  len = snprintf(buf, sizeof(buf), "{ \"pid\" : %d }\n", child);
  if (write(3, buf, len) != len) {
    fprintf(stderr, "nsenter: "
                    "Unable to send a child pid"
                    ": %m\n");
    kill(child, SIGKILL);
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<nsexec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,-0x20(%rbp)
movaps %xmm0,-0x30(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xdbb(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xdb4(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xdad(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xda6(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xd9f(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x5,-0x34(%rbp)
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x90(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movl   $0xffffffff,-0x64(%rbp)
lea    0xd54(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    12e0 <nsexec+0xc0>
movl   $0x1,-0x74(%rbp)
jmp    173a <nsexec+0x51a>
mov    -0x50(%rbp),%rdi
call   1120 <atoi@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%ecx
mov    -0x90(%rbp),%rax
mov    %ecx,-0x68(%rbp)
mov    %eax,%esi
mov    -0x68(%rbp),%ecx
lea    0xd22(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0x88(%rbp),%rsi
mov    -0x50(%rbp),%rdi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     1348 <nsexec+0x128>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
lea    0xcf6(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0xd12(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     13ac <nsexec+0x18c>
mov    -0x70(%rbp),%rdi
mov    0x2c6a(%rip),%rax
mov    (%rax),%esi
call   1110 <open@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
jge    13a7 <nsexec+0x187>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
mov    -0x70(%rbp),%rdx
lea    0xce6(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
jmp    13ac <nsexec+0x18c>
mov    -0x88(%rbp),%rdi
mov    0x2c36(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
mov    -0x68(%rbp),%ecx
lea    0xcdb(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0x88(%rbp),%rdi
mov    0x2be4(%rip),%rax
mov    (%rax),%esi
mov    0x2beb(%rip),%rax
or     (%rax),%esi
call   1110 <open@plt>
mov    %eax,-0x58(%rbp)
cmpl   $0xffffffff,-0x58(%rbp)
jne    1421 <nsexec+0x201>
mov    -0x88(%rbp),%rdx
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
lea    0xca0(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    1528 <nsexec+0x308>
mov    -0x58(%rbp),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
mov    0x2b4b(%rip),%rax
mov    (%rax),%ecx
lea    -0x78(%rbp),%rdx
call   1140 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    147d <nsexec+0x25d>
mov    0x2b50(%rip),%rax
mov    (%rax),%rax
mov    0x2b0e(%rip),%rcx
cmp    (%rcx),%rax
jne    1478 <nsexec+0x258>
jmp    151a <nsexec+0x2fa>
jmp    147d <nsexec+0x25d>
mov    -0x58(%rbp),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
mov    0x2b40(%rip),%rax
mov    (%rax),%edx
call   1060 <openat@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0xffffffff,-0x7c(%rbp)
jne    14d5 <nsexec+0x2b5>
mov    -0x88(%rbp),%rdx
mov    0x2b06(%rip),%rax
mov    (%rax),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rcx
lea    0xc0e(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    -0x7c(%rbp),%edi
xor    %esi,%esi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
jne    1512 <nsexec+0x2f2>
mov    0x2ac9(%rip),%rax
mov    (%rax),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdx
lea    0xc03(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    -0x7c(%rbp),%edi
call   10b0 <close@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1428 <nsexec+0x208>
mov    -0x38(%rbp),%edi
call   1100 <setjmp@plt>
cmp    $0x1,%eax
jne    168b <nsexec+0x46b>
mov    $0x0,%al
call   10c0 <setsid@plt>
cmp    $0xffffffff,%eax
jne    156a <nsexec+0x34a>
mov    0x2a68(%rip),%rax
mov    (%rax),%edi
lea    0xbd0(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
cmpl   $0xffffffff,-0x64(%rbp)
je     167f <nsexec+0x45f>
mov    -0x64(%rbp),%edi
mov    0x2a1a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    15b1 <nsexec+0x391>
mov    0x2a21(%rip),%rax
mov    (%rax),%edi
lea    0xba5(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    -0x64(%rbp),%edi
mov    0x29cd(%rip),%rax
mov    (%rax),%rsi
call   1070 <dup2@plt>
mov    0x29be(%rip),%rcx
cmp    (%rcx),%rax
je     15f4 <nsexec+0x3d4>
mov    0x29de(%rip),%rax
mov    (%rax),%edi
lea    0xb87(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    -0x64(%rbp),%edi
mov    0x29ea(%rip),%rax
mov    (%rax),%rsi
call   1070 <dup2@plt>
mov    0x29db(%rip),%rcx
cmp    (%rcx),%rax
je     1637 <nsexec+0x417>
mov    0x299b(%rip),%rax
mov    (%rax),%edi
lea    0xb62(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    -0x64(%rbp),%edi
mov    0x2967(%rip),%rax
mov    (%rax),%rsi
call   1070 <dup2@plt>
mov    0x2958(%rip),%rcx
cmp    (%rcx),%rax
je     167a <nsexec+0x45a>
mov    0x2958(%rip),%rax
mov    (%rax),%edi
lea    0xb3d(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
jmp    167f <nsexec+0x45f>
movl   $0x1,-0x74(%rbp)
jmp    173a <nsexec+0x51a>
lea    -0x38(%rbp),%rdi
call   1040 <clone_parent@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jge    16c2 <nsexec+0x4a2>
mov    0x2910(%rip),%rax
mov    (%rax),%edi
lea    0xb13(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    -0x88(%rbp),%rdi
mov    -0x90(%rbp),%rax
mov    %eax,%esi
mov    -0x5c(%rbp),%ecx
lea    0xb05(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0x88(%rbp),%rsi
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%edx
mov    $0x3,%edi
call   1050 <write@plt>
cmp    -0x60(%rbp),%eax
je     1733 <nsexec+0x513>
mov    0x28b0(%rip),%rax
mov    (%rax),%edi
lea    0xae0(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    -0x5c(%rbp),%edi
mov    0x287e(%rip),%rax
mov    (%rax),%esi
call   10f0 <kill@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
xor    %edi,%edi
call   1130 <exit@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsexec>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%r15
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ebx
mov    %rsp,%r12
lea    0xf(%rbx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xdbd(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     15ec <nsexec+0x3cc>
mov    %ebx,%r13d
mov    %rax,%rbx
mov    %rax,%rdi
call   1120 <atoi@plt>
mov    %eax,%r14d
lea    0xdad(%rip),%rdx
mov    %r12,%rdi
mov    %r13d,-0x38(%rbp)
mov    %r13d,%esi
mov    %eax,%ecx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    1625 <nsexec+0x405>
mov    %r15,-0x40(%rbp)
lea    0xdb4(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     12eb <nsexec+0xcb>
mov    %rax,%r15
mov    0x2d17(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1110 <open@plt>
mov    %eax,%ecx
test   %eax,%eax
jns    12f0 <nsexec+0xd0>
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
lea    0xd9b(%rip),%rsi
xor    %eax,%eax
mov    %r15,%rdx
jmp    16c9 <nsexec+0x4a9>
mov    $0xffffffff,%ecx
mov    %ecx,-0x34(%rbp)
mov    0x2cf6(%rip),%rax
mov    (%rax),%esi
add    $0xffffffff,%esi
lea    0xd9e(%rip),%rdx
mov    %r12,%rdi
mov    %r14d,%ecx
call   1080 <snprintf@plt>
mov    0x2ca8(%rip),%rax
mov    0x2cb1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %r12,%rdi
call   1110 <open@plt>
cmp    $0xffffffff,%eax
je     163a <nsexec+0x41a>
mov    %eax,%r14d
mov    0x2c52(%rip),%r15
mov    (%r15),%ecx
lea    0xcb8(%rip),%r13
lea    -0x30(%rbp),%rdx
mov    %eax,%edi
mov    %r13,%rsi
call   1140 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    1371 <nsexec+0x151>
mov    0x2c4e(%rip),%rax
mov    (%rax),%rax
mov    0x2c0c(%rip),%rcx
cmp    (%rcx),%rax
je     13a9 <nsexec+0x189>
mov    0x2c58(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    %r13,%rsi
call   1060 <openat@plt>
cmp    $0xffffffff,%eax
je     15fe <nsexec+0x3de>
mov    %eax,%ebx
xor    %esi,%esi
mov    %eax,%edi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
je     168c <nsexec+0x46c>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    (%r15),%ecx
lea    0xc51(%rip),%r13
lea    -0x30(%rbp),%rdx
mov    %r14d,%edi
mov    %r13,%rsi
call   1140 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    13dd <nsexec+0x1bd>
mov    0x2be2(%rip),%rax
mov    (%rax),%rax
mov    0x2ba0(%rip),%rcx
cmp    (%rcx),%rax
je     1415 <nsexec+0x1f5>
mov    0x2bec(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    %r13,%rsi
call   1060 <openat@plt>
cmp    $0xffffffff,%eax
je     15fe <nsexec+0x3de>
mov    %eax,%ebx
xor    %esi,%esi
mov    %eax,%edi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
je     1695 <nsexec+0x475>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    (%r15),%ecx
lea    0xbe9(%rip),%r13
lea    -0x30(%rbp),%rdx
mov    %r14d,%edi
mov    %r13,%rsi
call   1140 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    1449 <nsexec+0x229>
mov    0x2b76(%rip),%rax
mov    (%rax),%rax
mov    0x2b34(%rip),%rcx
cmp    (%rcx),%rax
je     1481 <nsexec+0x261>
mov    0x2b80(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    %r13,%rsi
call   1060 <openat@plt>
cmp    $0xffffffff,%eax
je     15fe <nsexec+0x3de>
mov    %eax,%ebx
xor    %esi,%esi
mov    %eax,%edi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
je     169e <nsexec+0x47e>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    (%r15),%ecx
lea    0xb81(%rip),%r13
lea    -0x30(%rbp),%rdx
mov    %r14d,%edi
mov    %r13,%rsi
call   1140 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    14b5 <nsexec+0x295>
mov    0x2b0a(%rip),%rax
mov    (%rax),%rax
mov    0x2ac8(%rip),%rcx
cmp    (%rcx),%rax
je     14ed <nsexec+0x2cd>
mov    0x2b14(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    %r13,%rsi
call   1060 <openat@plt>
cmp    $0xffffffff,%eax
je     15fe <nsexec+0x3de>
mov    %eax,%ebx
xor    %esi,%esi
mov    %eax,%edi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
je     16a7 <nsexec+0x487>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    (%r15),%ecx
lea    0xb19(%rip),%r13
lea    -0x30(%rbp),%rdx
mov    %r14d,%edi
mov    %r13,%rsi
call   1140 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    1521 <nsexec+0x301>
mov    0x2a9e(%rip),%rax
mov    (%rax),%rax
mov    0x2a5c(%rip),%rcx
cmp    (%rcx),%rax
je     1559 <nsexec+0x339>
mov    0x2aa8(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    %r13,%rsi
call   1060 <openat@plt>
cmp    $0xffffffff,%eax
je     15fe <nsexec+0x3de>
mov    %eax,%ebx
xor    %esi,%esi
mov    %eax,%edi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
je     16b0 <nsexec+0x490>
mov    %ebx,%edi
call   10b0 <close@plt>
call   1100 <setjmp@plt>
cmp    $0x1,%eax
jne    1651 <nsexec+0x431>
xor    %eax,%eax
call   10c0 <setsid@plt>
cmp    $0xffffffff,%eax
mov    -0x40(%rbp),%r15
je     1677 <nsexec+0x457>
mov    -0x34(%rbp),%ebx
cmp    $0xffffffff,%ebx
je     15ec <nsexec+0x3cc>
mov    0x2a0e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
mov    %ebx,%edi
call   10a0 <ioctl@plt>
cmp    $0xffffffff,%eax
je     16d8 <nsexec+0x4b8>
mov    0x29e3(%rip),%r14
mov    (%r14),%rsi
mov    %ebx,%edi
call   1070 <dup2@plt>
cmp    (%r14),%rax
jne    16ea <nsexec+0x4ca>
mov    0x2a29(%rip),%r14
mov    (%r14),%rsi
mov    %ebx,%edi
call   1070 <dup2@plt>
cmp    (%r14),%rax
jne    16fc <nsexec+0x4dc>
mov    0x29cf(%rip),%r14
mov    (%r14),%rsi
mov    %ebx,%edi
call   1070 <dup2@plt>
cmp    (%r14),%rax
jne    170e <nsexec+0x4ee>
mov    %r15,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29b3(%rip),%rax
mov    (%rax),%edi
lea    0xac4(%rip),%rsi
xor    %eax,%eax
mov    %r12,%rdx
mov    %r13,%rcx
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x298c(%rip),%rax
mov    (%rax),%edi
lea    0x9f8(%rip),%rsi
jmp    171e <nsexec+0x4fe>
mov    0x2977(%rip),%rax
mov    (%rax),%edi
lea    0xa66(%rip),%rsi
xor    %eax,%eax
mov    %r12,%rdx
jmp    16c9 <nsexec+0x4a9>
lea    -0x44(%rbp),%rdi
call   1040 <clone_parent@plt>
test   %eax,%eax
jns    172f <nsexec+0x50f>
mov    0x294f(%rip),%rax
mov    (%rax),%edi
lea    0xb52(%rip),%rsi
jmp    171e <nsexec+0x4fe>
mov    0x293a(%rip),%rax
mov    (%rax),%edi
lea    0xaa2(%rip),%rsi
jmp    171e <nsexec+0x4fe>
lea    0x96d(%rip),%rdx
jmp    16b7 <nsexec+0x497>
lea    0x968(%rip),%rdx
jmp    16b7 <nsexec+0x497>
lea    0x963(%rip),%rdx
jmp    16b7 <nsexec+0x497>
lea    0x95e(%rip),%rdx
jmp    16b7 <nsexec+0x497>
lea    0x959(%rip),%rdx
mov    0x28fa(%rip),%rax
mov    (%rax),%edi
lea    0xa3d(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x28d9(%rip),%rax
mov    (%rax),%edi
lea    0xa5d(%rip),%rsi
jmp    171e <nsexec+0x4fe>
mov    0x28c7(%rip),%rax
mov    (%rax),%edi
lea    0xa70(%rip),%rsi
jmp    171e <nsexec+0x4fe>
mov    0x28b5(%rip),%rax
mov    (%rax),%edi
lea    0xa7c(%rip),%rsi
jmp    171e <nsexec+0x4fe>
mov    0x28a3(%rip),%rax
mov    (%rax),%edi
lea    0xa88(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    %eax,%r14d
lea    0xaa8(%rip),%rdx
mov    %r12,%rdi
mov    -0x38(%rbp),%esi
mov    %eax,%ecx
call   1080 <snprintf@plt>
mov    %eax,%ebx
mov    $0x3,%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1050 <write@plt>
cmp    %ebx,%eax
jne    1762 <nsexec+0x542>
xor    %edi,%edi
call   1130 <exit@plt>
mov    0x284f(%rip),%rax
mov    (%rax),%edi
lea    0xa7f(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    0x2820(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
call   10f0 <kill@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [4 x i8] c"ipc\00"
@.str.1 = [4 x i8] c"uts\00"
@.str.2 = [4 x i8] c"net\00"
@.str.3 = [4 x i8] c"pid\00"
@.str.4 = [4 x i8] c"mnt\00"
@PATH_MAX = global i32 0
@.str.5 = [22 x i8] c"_LIBCONTAINER_INITPID\00"
@.str.6 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.7 = [52 x i8] c"nsenter: Unable to parse _LIBCONTAINER_INITPID: %m\0A\00"
@.str.8 = [27 x i8] c"_LIBCONTAINER_CONSOLE_PATH\00"
@O_RDWR = global i32 0
@.str.9 = [40 x i8] c"nsenter: Failed to open console %s: %m\0A\00"
@.str.10 = [12 x i8] c"/proc/%d/ns\00"
@O_DIRECTORY = global i32 0
@O_RDONLY = global i32 0
@.str.11 = [34 x i8] c"nsenter: Failed to open \22%s\22: %m\0A\00"
@AT_SYMLINK_NOFOLLOW = global i32 0
@errno = global i64 0
@ENOENT = global i64 0
@.str.12 = [50 x i8] c"nsenter: Failed to open ns file %s for ns %s: %m\0A\00"
@.str.13 = [37 x i8] c"nsenter: Failed to setns for %s: %m\0A\00"
@.str.14 = [28 x i8] c"nsenter: setsid failed: %m\0A\00"
@TIOCSCTTY = global i32 0
@.str.15 = [37 x i8] c"nsenter: ioctl TIOCSCTTY failed: %m\0A\00"
@STDIN_FILENO = global i64 0
@.str.16 = [30 x i8] c"nsenter: Failed to dup 0: %m\0A\00"
@STDOUT_FILENO = global i64 0
@.str.17 = [30 x i8] c"nsenter: Failed to dup 1: %m\0A\00"
@STDERR_FILENO = global i64 0
@.str.18 = [30 x i8] c"nsenter: Failed to dup 2: %m\0A\00"
@.str.19 = [29 x i8] c"nsenter: Unable to fork: %m\0A\00"
@.str.20 = [16 x i8] c"{ \22pid\22 : %d }\0A\00"
@.str.21 = [41 x i8] c"nsenter: Unable to send a child pid: %m\0A\00"
@SIGKILL = global i32 0
define void @nsexec() {
%1 = alloca [5 x i8*]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca %struct.stat
%16 = alloca i32
%17 = bitcast [5 x i8*]* %1 to i8*
%18 = bitcast i8* %17 to [5 x i8*]*
%19 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8** %19
%20 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8** %20
%21 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8** %21
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8** %22
%23 = getelementptr inbounds [5 x i8*], [5 x i8*]* %18, i32 0, i32 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8** %23
store i32 5, i32* %2
%24 = load i32, i32* @PATH_MAX
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %4
%27 = alloca i8, i64 %25
store i64 %25, i64* %5
store i32 -1, i32* %11
%28 = call i8* @getenv(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
store i8* %28, i8** %6
%29 = load i8*, i8** %6
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %32
31: ; preds = %0
store i32 1, i32* %14
br label %211
32: ; preds = %0
%33 = load i8*, i8** %6
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %12
%35 = trunc i64 %25 to i32
%36 = load i32, i32* %12
%37 = call i32 @snprintf(i8* %27, i32 %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %36)
%38 = load i8*, i8** %6
%39 = call i64 @strcmp(i8* %38, i8* %27)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %32
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %32
%46 = call i8* @getenv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
store i8* %46, i8** %13
%47 = load i8*, i8** %13
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %61
49: ; preds = %45
%50 = load i8*, i8** %13
%51 = load i32, i32* @O_RDWR
%52 = call i32 @open(i8* %50, i32 %51)
store i32 %52, i32* %11
%53 = load i32, i32* %11
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %49
%56 = load i32, i32* @stderr
%57 = load i8*, i8** %13
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %57)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %49
br label %61
61: ; preds = %60, %45
%62 = load i32, i32* @PATH_MAX
%63 = sub nsw i32 %62, 1
%64 = load i32, i32* %12
%65 = call i32 @snprintf(i8* %27, i32 %63, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %64)
%66 = load i32, i32* @O_DIRECTORY
%67 = load i32, i32* @O_RDONLY
%68 = or i32 %66, %67
%69 = call i32 @open(i8* %27, i32 %68)
store i32 %69, i32* %8
%70 = load i32, i32* %8
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %76
72: ; preds = %61
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8* %27)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %61
store i32 0, i32* %7
br label %77
77: ; preds = %128, %76
%78 = load i32, i32* %7
%79 = icmp slt i32 %78, 5
br i1 %79, label %80, label %131
80: ; preds = %77
%81 = load i32, i32* %8
%82 = load i32, i32* %7
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %83
%85 = load i8*, i8** %84
%86 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%87 = call i32 @fstatat(i32 %81, i8* %85, %struct.stat* %15, i32 %86)
%88 = icmp eq i32 %87, -1
br i1 %88, label %89, label %95
89: ; preds = %80
%90 = load i64, i64* @errno
%91 = load i64, i64* @ENOENT
%92 = icmp eq i64 %90, %91
br i1 %92, label %93, label %94
93: ; preds = %89
br label %128
94: ; preds = %89
br label %95
95: ; preds = %94, %80
%96 = load i32, i32* %8
%97 = load i32, i32* %7
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %98
%100 = load i8*, i8** %99
%101 = load i32, i32* @O_RDONLY
%102 = call i32 @openat(i32 %96, i8* %100, i32 %101)
store i32 %102, i32* %16
%103 = load i32, i32* %16
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %113
105: ; preds = %95
%106 = load i32, i32* @stderr
%107 = load i32, i32* %7
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %108
%110 = load i8*, i8** %109
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), i8* %27, i8* %110)
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %95
%114 = load i32, i32* %16
%115 = call i32 @setns(i32 %114, i32 0)
%116 = icmp eq i32 %115, -1
br i1 %116, label %117, label %125
117: ; preds = %113
%118 = load i32, i32* @stderr
%119 = load i32, i32* %7
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %120
%122 = load i8*, i8** %121
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* %122)
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %113
%126 = load i32, i32* %16
%127 = call i32 @close(i32 %126)
br label %128
128: ; preds = %125, %93
%129 = load i32, i32* %7
%130 = add nsw i32 %129, 1
store i32 %130, i32* %7
br label %77
131: ; preds = %77
%132 = load i32, i32* %3
%133 = call i32 @setjmp(i32 %132)
%134 = icmp eq i32 %133, 1
br i1 %134, label %135, label %186
135: ; preds = %131
%136 = call i32 (...) @setsid()
%137 = icmp eq i32 %136, -1
br i1 %137, label %138, label %142
138: ; preds = %135
%139 = load i32, i32* @stderr
%140 = call i32 (i32, i8*, ...) @fprintf(i32 %139, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0))
%141 = call i32 @exit(i32 1)
unreachable
142: ; preds = %135
%143 = load i32, i32* %11
%144 = icmp ne i32 %143, -1
br i1 %144, label %145, label %185
145: ; preds = %142
%146 = load i32, i32* %11
%147 = load i32, i32* @TIOCSCTTY
%148 = call i32 @ioctl(i32 %146, i32 %147, i32 0)
%149 = icmp eq i32 %148, -1
br i1 %149, label %150, label %154
150: ; preds = %145
%151 = load i32, i32* @stderr
%152 = call i32 (i32, i8*, ...) @fprintf(i32 %151, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0))
%153 = call i32 @exit(i32 1)
unreachable
154: ; preds = %145
%155 = load i32, i32* %11
%156 = load i64, i64* @STDIN_FILENO
%157 = call i64 @dup2(i32 %155, i64 %156)
%158 = load i64, i64* @STDIN_FILENO
%159 = icmp ne i64 %157, %158
br i1 %159, label %160, label %164
160: ; preds = %154
%161 = load i32, i32* @stderr
%162 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%163 = call i32 @exit(i32 1)
unreachable
164: ; preds = %154
%165 = load i32, i32* %11
%166 = load i64, i64* @STDOUT_FILENO
%167 = call i64 @dup2(i32 %165, i64 %166)
%168 = load i64, i64* @STDOUT_FILENO
%169 = icmp ne i64 %167, %168
br i1 %169, label %170, label %174
170: ; preds = %164
%171 = load i32, i32* @stderr
%172 = call i32 (i32, i8*, ...) @fprintf(i32 %171, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.17, i64 0, i64 0))
%173 = call i32 @exit(i32 1)
unreachable
174: ; preds = %164
%175 = load i32, i32* %11
%176 = load i64, i64* @STDERR_FILENO
%177 = call i64 @dup2(i32 %175, i64 %176)
%178 = load i64, i64* @STDERR_FILENO
%179 = icmp ne i64 %177, %178
br i1 %179, label %180, label %184
180: ; preds = %174
%181 = load i32, i32* @stderr
%182 = call i32 (i32, i8*, ...) @fprintf(i32 %181, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0))
%183 = call i32 @exit(i32 1)
unreachable
184: ; preds = %174
br label %185
185: ; preds = %184, %142
store i32 1, i32* %14
br label %211
186: ; preds = %131
%187 = call i32 @clone_parent(i32* %3)
store i32 %187, i32* %9
%188 = load i32, i32* %9
%189 = icmp slt i32 %188, 0
br i1 %189, label %190, label %194
190: ; preds = %186
%191 = load i32, i32* @stderr
%192 = call i32 (i32, i8*, ...) @fprintf(i32 %191, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.19, i64 0, i64 0))
%193 = call i32 @exit(i32 1)
unreachable
194: ; preds = %186
%195 = trunc i64 %25 to i32
%196 = load i32, i32* %9
%197 = call i32 @snprintf(i8* %27, i32 %195, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i32 %196)
store i32 %197, i32* %10
%198 = load i32, i32* %10
%199 = call i32 @write(i32 3, i8* %27, i32 %198)
%200 = load i32, i32* %10
%201 = icmp ne i32 %199, %200
br i1 %201, label %202, label %209
202: ; preds = %194
%203 = load i32, i32* @stderr
%204 = call i32 (i32, i8*, ...) @fprintf(i32 %203, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.21, i64 0, i64 0))
%205 = load i32, i32* %9
%206 = load i32, i32* @SIGKILL
%207 = call i32 @kill(i32 %205, i32 %206)
%208 = call i32 @exit(i32 1)
unreachable
209: ; preds = %194
%210 = call i32 @exit(i32 0)
unreachable
211: ; preds = %185, %31
%212 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [4 x i8] c"ipc\00"
@.str.1 = [4 x i8] c"uts\00"
@.str.2 = [4 x i8] c"net\00"
@.str.3 = [4 x i8] c"pid\00"
@.str.4 = [4 x i8] c"mnt\00"
@PATH_MAX = global i32 0
@.str.5 = [22 x i8] c"_LIBCONTAINER_INITPID\00"
@.str.6 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.7 = [52 x i8] c"nsenter: Unable to parse _LIBCONTAINER_INITPID: %m\0A\00"
@.str.8 = [27 x i8] c"_LIBCONTAINER_CONSOLE_PATH\00"
@O_RDWR = global i32 0
@.str.9 = [40 x i8] c"nsenter: Failed to open console %s: %m\0A\00"
@.str.10 = [12 x i8] c"/proc/%d/ns\00"
@O_DIRECTORY = global i32 0
@O_RDONLY = global i32 0
@.str.11 = [34 x i8] c"nsenter: Failed to open \22%s\22: %m\0A\00"
@AT_SYMLINK_NOFOLLOW = global i32 0
@errno = global i64 0
@ENOENT = global i64 0
@.str.12 = [50 x i8] c"nsenter: Failed to open ns file %s for ns %s: %m\0A\00"
@.str.13 = [37 x i8] c"nsenter: Failed to setns for %s: %m\0A\00"
@.str.14 = [28 x i8] c"nsenter: setsid failed: %m\0A\00"
@TIOCSCTTY = global i32 0
@.str.15 = [37 x i8] c"nsenter: ioctl TIOCSCTTY failed: %m\0A\00"
@STDIN_FILENO = global i64 0
@.str.16 = [30 x i8] c"nsenter: Failed to dup 0: %m\0A\00"
@STDOUT_FILENO = global i64 0
@.str.17 = [30 x i8] c"nsenter: Failed to dup 1: %m\0A\00"
@STDERR_FILENO = global i64 0
@.str.18 = [30 x i8] c"nsenter: Failed to dup 2: %m\0A\00"
@.str.19 = [29 x i8] c"nsenter: Unable to fork: %m\0A\00"
@.str.20 = [16 x i8] c"{ \22pid\22 : %d }\0A\00"
@.str.21 = [41 x i8] c"nsenter: Unable to send a child pid: %m\0A\00"
@SIGKILL = global i32 0
define void @nsexec() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = bitcast i32* %1 to i8*
%4 = load i32, i32* @PATH_MAX
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
%7 = alloca i8, i64 %5
%8 = call i8* @getenv(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %206, label %10
10: ; preds = %0
%11 = call i32 @atoi(i8* %8)
%12 = call i32 @snprintf(i8* %7, i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %11)
%13 = call i64 @strcmp(i8* %8, i8* %7)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %10
%20 = call i8* @getenv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%21 = icmp eq i8* %20, null
br i1 %21, label %30, label %22
22: ; preds = %19
%23 = load i32, i32* @O_RDWR
%24 = call i32 @open(i8* %20, i32 %23)
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %20)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %22, %19
%31 = phi i32 [ %24, %22 ], [ -1, %19 ]
%32 = load i32, i32* @PATH_MAX
%33 = add nsw i32 %32, -1
%34 = call i32 @snprintf(i8* %7, i32 %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %11)
%35 = load i32, i32* @O_DIRECTORY
%36 = load i32, i32* @O_RDONLY
%37 = or i32 %36, %35
%38 = call i32 @open(i8* %7, i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %45, label %40
40: ; preds = %30
%41 = bitcast %struct.stat* %2 to i8*
%42 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%43 = call i32 @fstatat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %struct.stat* %2, i32 %42)
%44 = icmp eq i32 %43, -1
br i1 %44, label %49, label %53
45: ; preds = %30
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8* %7)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %40
%50 = load i64, i64* @errno
%51 = load i64, i64* @ENOENT
%52 = icmp eq i64 %50, %51
br i1 %52, label %72, label %53
53: ; preds = %49, %40
%54 = load i32, i32* @O_RDONLY
%55 = call i32 @openat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %54)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %62
57: ; preds = %131, %114, %97, %80, %53
%58 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %53 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %80 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %97 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %114 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %131 ]
%59 = load i32, i32* @stderr
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), i8* %7, i8* %58)
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %53
%63 = call i32 @setns(i32 %55, i32 0)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %70
65: ; preds = %135, %118, %101, %84, %62
%66 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %62 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %84 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %101 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %118 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %135 ]
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* %66)
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %62
%71 = call i32 @close(i32 %55)
br label %72
72: ; preds = %49, %70
%73 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%74 = call i32 @fstatat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %2, i32 %73)
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %80
76: ; preds = %72
%77 = load i64, i64* @errno
%78 = load i64, i64* @ENOENT
%79 = icmp eq i64 %77, %78
br i1 %79, label %89, label %80
80: ; preds = %76, %72
%81 = load i32, i32* @O_RDONLY
%82 = call i32 @openat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %81)
%83 = icmp eq i32 %82, -1
br i1 %83, label %57, label %84
84: ; preds = %80
%85 = call i32 @setns(i32 %82, i32 0)
%86 = icmp eq i32 %85, -1
br i1 %86, label %65, label %87
87: ; preds = %84
%88 = call i32 @close(i32 %82)
br label %89
89: ; preds = %87, %76
%90 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%91 = call i32 @fstatat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2, i32 %90)
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %97
93: ; preds = %89
%94 = load i64, i64* @errno
%95 = load i64, i64* @ENOENT
%96 = icmp eq i64 %94, %95
br i1 %96, label %106, label %97
97: ; preds = %93, %89
%98 = load i32, i32* @O_RDONLY
%99 = call i32 @openat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %98)
%100 = icmp eq i32 %99, -1
br i1 %100, label %57, label %101
101: ; preds = %97
%102 = call i32 @setns(i32 %99, i32 0)
%103 = icmp eq i32 %102, -1
br i1 %103, label %65, label %104
104: ; preds = %101
%105 = call i32 @close(i32 %99)
br label %106
106: ; preds = %104, %93
%107 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%108 = call i32 @fstatat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %struct.stat* %2, i32 %107)
%109 = icmp eq i32 %108, -1
br i1 %109, label %110, label %114
110: ; preds = %106
%111 = load i64, i64* @errno
%112 = load i64, i64* @ENOENT
%113 = icmp eq i64 %111, %112
br i1 %113, label %123, label %114
114: ; preds = %110, %106
%115 = load i32, i32* @O_RDONLY
%116 = call i32 @openat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %115)
%117 = icmp eq i32 %116, -1
br i1 %117, label %57, label %118
118: ; preds = %114
%119 = call i32 @setns(i32 %116, i32 0)
%120 = icmp eq i32 %119, -1
br i1 %120, label %65, label %121
121: ; preds = %118
%122 = call i32 @close(i32 %116)
br label %123
123: ; preds = %121, %110
%124 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%125 = call i32 @fstatat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %struct.stat* %2, i32 %124)
%126 = icmp eq i32 %125, -1
br i1 %126, label %127, label %131
127: ; preds = %123
%128 = load i64, i64* @errno
%129 = load i64, i64* @ENOENT
%130 = icmp eq i64 %128, %129
br i1 %130, label %140, label %131
131: ; preds = %127, %123
%132 = load i32, i32* @O_RDONLY
%133 = call i32 @openat(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %132)
%134 = icmp eq i32 %133, -1
br i1 %134, label %57, label %135
135: ; preds = %131
%136 = call i32 @setns(i32 %133, i32 0)
%137 = icmp eq i32 %136, -1
br i1 %137, label %65, label %138
138: ; preds = %135
%139 = call i32 @close(i32 %133)
br label %140
140: ; preds = %138, %127
%141 = call i32 @setjmp(i32 undef)
%142 = icmp eq i32 %141, 1
br i1 %142, label %143, label %187
143: ; preds = %140
%144 = call i32 (...) @setsid()
%145 = icmp eq i32 %144, -1
br i1 %145, label %146, label %150
146: ; preds = %143
%147 = load i32, i32* @stderr
%148 = call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0))
%149 = call i32 @exit(i32 1)
unreachable
150: ; preds = %143
%151 = icmp eq i32 %31, -1
br i1 %151, label %206, label %152
152: ; preds = %150
%153 = load i32, i32* @TIOCSCTTY
%154 = call i32 @ioctl(i32 %31, i32 %153, i32 0)
%155 = icmp eq i32 %154, -1
br i1 %155, label %156, label %160
156: ; preds = %152
%157 = load i32, i32* @stderr
%158 = call i32 (i32, i8*, ...) @fprintf(i32 %157, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0))
%159 = call i32 @exit(i32 1)
unreachable
160: ; preds = %152
%161 = load i64, i64* @STDIN_FILENO
%162 = call i64 @dup2(i32 %31, i64 %161)
%163 = load i64, i64* @STDIN_FILENO
%164 = icmp eq i64 %162, %163
br i1 %164, label %169, label %165
165: ; preds = %160
%166 = load i32, i32* @stderr
%167 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%168 = call i32 @exit(i32 1)
unreachable
169: ; preds = %160
%170 = load i64, i64* @STDOUT_FILENO
%171 = call i64 @dup2(i32 %31, i64 %170)
%172 = load i64, i64* @STDOUT_FILENO
%173 = icmp eq i64 %171, %172
br i1 %173, label %178, label %174
174: ; preds = %169
%175 = load i32, i32* @stderr
%176 = call i32 (i32, i8*, ...) @fprintf(i32 %175, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.17, i64 0, i64 0))
%177 = call i32 @exit(i32 1)
unreachable
178: ; preds = %169
%179 = load i64, i64* @STDERR_FILENO
%180 = call i64 @dup2(i32 %31, i64 %179)
%181 = load i64, i64* @STDERR_FILENO
%182 = icmp eq i64 %180, %181
br i1 %182, label %206, label %183
183: ; preds = %178
%184 = load i32, i32* @stderr
%185 = call i32 (i32, i8*, ...) @fprintf(i32 %184, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0))
%186 = call i32 @exit(i32 1)
unreachable
187: ; preds = %140
%188 = call i32 @clone_parent(i32* %1)
%189 = icmp slt i32 %188, 0
br i1 %189, label %190, label %194
190: ; preds = %187
%191 = load i32, i32* @stderr
%192 = call i32 (i32, i8*, ...) @fprintf(i32 %191, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.19, i64 0, i64 0))
%193 = call i32 @exit(i32 1)
unreachable
194: ; preds = %187
%195 = call i32 @snprintf(i8* %7, i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i32 %188)
%196 = call i32 @write(i32 3, i8* %7, i32 %195)
%197 = icmp eq i32 %196, %195
br i1 %197, label %204, label %198
198: ; preds = %194
%199 = load i32, i32* @stderr
%200 = call i32 (i32, i8*, ...) @fprintf(i32 %199, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.21, i64 0, i64 0))
%201 = load i32, i32* @SIGKILL
%202 = call i32 @kill(i32 %188, i32 %201)
%203 = call i32 @exit(i32 1)
unreachable
204: ; preds = %194
%205 = call i32 @exit(i32 0)
unreachable
206: ; preds = %150, %178, %0
ret void
}