#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 {
  scalar_t__ st_ino;
};
struct nlmsghdr {
  int nlmsg_type;
};
struct nlattr {
  int nla_len;
  int nla_type;
};
typedef int pid_t;
typedef int /*<<< orphan*/ namespaces;
typedef int /*<<< orphan*/ jmp_buf;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ ENOENT;
scalar_t__ NLA_ALIGN(int);
int NLA_HDRLEN;
int NLMSG_ERROR;
int NLMSG_HDRLEN;
int NLMSG_PAYLOAD(struct nlmsghdr *, int /*<<< orphan*/);
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__ dup3(int, scalar_t__, int /*<<< orphan*/);
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 read(int, char *, int);
int /*<<< orphan*/ readint32(char *);
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", "user"};
  const int num = sizeof(namespaces) / sizeof(char *);
  jmp_buf env;
  char buf[PATH_MAX], *val;
  int i, tfd, self_tfd, child, n, len, pipenum, consolefd = -1;
  pid_t pid = 0;
  val = getenv("_LIBCONTAINER_INITTYPE");
  if (val == NULL || strcmp(val, "standard") == 0) {
    return;
  }
  if (strcmp(val, "setns") != 0) {
    fprintf(stderr,
            "nsenter: "
            "Invalid inittype %s"
            ": %m\n",
            val);
    exit(1);
  }
  val = getenv("_LIBCONTAINER_INITPIPE");
  if (val == NULL) {
    fprintf(stderr, "nsenter: "
                    "Child pipe not found"
                    ": %m\n");
    exit(1);
  }
  pipenum = atoi(val);
  snprintf(buf, sizeof(buf), "%d", pipenum);
  if (strcmp(val, buf)) {
    fprintf(stderr, "nsenter: "
                    "Unable to parse _LIBCONTAINER_INITPIPE"
                    ": %m\n");
    exit(1);
  }
  char nlbuf[NLMSG_HDRLEN];
  struct nlmsghdr *nh;
  if ((n = read(pipenum, nlbuf, NLMSG_HDRLEN)) != NLMSG_HDRLEN) {
    fprintf(stderr,
            "nsenter: "
            "Failed to read netlink header, got %d"
            ": %m\n",
            n);
    exit(1);
  }
  nh = (struct nlmsghdr *)nlbuf;
  if (nh->nlmsg_type == NLMSG_ERROR) {
    fprintf(stderr, "nsenter: "
                    "Invalid netlink header message"
                    ": %m\n");
    exit(1);
  }
  if (nh->nlmsg_type != 62000) {
    fprintf(stderr,
            "nsenter: "
            "Unexpected netlink message type %d"
            ": %m\n",
            nh->nlmsg_type);
    exit(1);
  }
  len = NLMSG_PAYLOAD(nh, 0);
  char data[len];
  if ((n = read(pipenum, data, len)) != len) {
    fprintf(stderr,
            "nsenter: "
            "Failed to read netlink payload, got %d"
            ": %m\n",
            n);
    exit(1);
  }
  int start = 0;
  struct nlattr *attr;
  while (start < len) {
    int payload_len;
    attr = (struct nlattr *)((void *)data + start);
    start += NLA_HDRLEN;
    payload_len = attr->nla_len - NLA_HDRLEN;
    switch (attr->nla_type) {
    case 27281:
      pid = (pid_t)readint32(data + start);
      break;
    case 27282:
      consolefd = open((char *)data + start, O_RDWR);
      if (consolefd < 0) {
        fprintf(stderr,
                "nsenter: "
                "Failed to open console %s"
                ": %m\n",
                (char *)data + start);
        exit(1);
      }
      break;
    }
    start += NLA_ALIGN(payload_len);
  }
  if (pid == 0) {
    fprintf(stderr, "nsenter: "
                    "missing pid"
                    ": %m\n");
    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);
  }
  self_tfd = open("/proc/self/ns", O_DIRECTORY | O_RDONLY);
  if (self_tfd == -1) {
    fprintf(stderr, "nsenter: "
                    "Failed to open /proc/self/ns"
                    ": %m\n");
    exit(1);
  }
  for (i = 0; i < num; i++) {
    struct stat st;
    struct stat self_st;
    int fd;
    if (fstatat(tfd, namespaces[i], &st, 0) == -1) {
      if (errno == ENOENT)
        continue;
    }
    if (fstatat(self_tfd, namespaces[i], &self_st, 0) != -1 &&
        st.st_ino == self_st.st_ino) {
      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);
  }
  close(self_tfd);
  close(tfd);
  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 (dup3(consolefd, STDIN_FILENO, 0) != STDIN_FILENO) {
        fprintf(stderr, "nsenter: "
                        "Failed to dup 0"
                        ": %m\n");
        exit(1);
      }
      if (dup3(consolefd, STDOUT_FILENO, 0) != STDOUT_FILENO) {
        fprintf(stderr, "nsenter: "
                        "Failed to dup 1"
                        ": %m\n");
        exit(1);
      }
      if (dup3(consolefd, STDERR_FILENO, 0) != 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(pipenum, 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    $0xf0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,-0x10(%rbp)
movaps %xmm0,-0x20(%rbp)
movaps %xmm0,-0x30(%rbp)
lea    0xd7f(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xd78(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xd71(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xd6a(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xd63(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xd5c(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x6,-0x34(%rbp)
mov    0x2d26(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xd0(%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,-0xc8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movl   $0xffffffff,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
lea    0xd0b(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     133c <nsexec+0xdc>
mov    -0x50(%rbp),%rdi
lea    0xd03(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1348 <nsexec+0xe8>
movl   $0x1,-0x78(%rbp)
jmp    1b21 <nsexec+0x8c1>
mov    -0x50(%rbp),%rdi
lea    0xce6(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
je     1387 <nsexec+0x127>
mov    0x2c3f(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rdx
lea    0xcc9(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
lea    0xcd3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    13c3 <nsexec+0x163>
mov    0x2bff(%rip),%rax
mov    (%rax),%edi
lea    0xcc6(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x50(%rbp),%rdi
call   1150 <atoi@plt>
mov    -0xc8(%rbp),%rdi
mov    %eax,%ecx
mov    -0xd0(%rbp),%rax
mov    %ecx,-0x6c(%rbp)
mov    %eax,%esi
mov    -0x6c(%rbp),%ecx
lea    0xcb0(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0xc8(%rbp),%rsi
mov    -0x50(%rbp),%rdi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
je     142b <nsexec+0x1cb>
mov    0x2b97(%rip),%rax
mov    (%rax),%edi
lea    0xc84(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    0x2bae(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0xd8(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x80(%rbp)
mov    -0x6c(%rbp),%edi
mov    0x2b83(%rip),%rax
mov    (%rax),%edx
call   10d0 <read@plt>
mov    %eax,-0x64(%rbp)
mov    0x2b72(%rip),%rcx
cmp    (%rcx),%eax
je     149a <nsexec+0x23a>
mov    0x2b2b(%rip),%rax
mov    (%rax),%edi
mov    -0x64(%rbp),%edx
lea    0xc4a(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0xd8(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    (%rax),%eax
mov    0x2b08(%rip),%rcx
cmp    (%rcx),%eax
jne    14e1 <nsexec+0x281>
mov    0x2ae1(%rip),%rax
mov    (%rax),%edi
lea    0xc37(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x88(%rbp),%rax
cmpl   $0xf230,(%rax)
je     151e <nsexec+0x2be>
mov    0x2aad(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%rax
mov    (%rax),%edx
lea    0xc27(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x88(%rbp),%rdi
xor    %esi,%esi
call   1100 <NLMSG_PAYLOAD@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0xe0(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x90(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%edx
call   10d0 <read@plt>
mov    %eax,-0x64(%rbp)
cmp    -0x68(%rbp),%eax
je     158f <nsexec+0x32f>
mov    0x2a36(%rip),%rax
mov    (%rax),%edi
mov    -0x64(%rbp),%edx
lea    0xbe7(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x68(%rbp),%eax
jge    16c4 <nsexec+0x464>
mov    -0xe0(%rbp),%rax
movslq -0x94(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    0x29d9(%rip),%rcx
mov    (%rcx),%edx
mov    -0x94(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x94(%rbp)
mov    -0xa0(%rbp),%rax
mov    (%rax),%eax
mov    (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0xa4(%rbp)
mov    -0xa0(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0xe4(%rbp)
sub    $0x6a91,%eax
je     1620 <nsexec+0x3c0>
jmp    160a <nsexec+0x3aa>
mov    -0xe4(%rbp),%eax
sub    $0x6a92,%eax
je     163e <nsexec+0x3de>
jmp    16a1 <nsexec+0x441>
mov    -0xe0(%rbp),%rdi
movslq -0x94(%rbp),%rax
add    %rax,%rdi
call   1120 <readint32@plt>
mov    %eax,-0x74(%rbp)
jmp    16a1 <nsexec+0x441>
mov    -0xe0(%rbp),%rdi
movslq -0x94(%rbp),%rax
add    %rax,%rdi
mov    0x297a(%rip),%rax
mov    (%rax),%esi
call   1140 <open@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x0,-0x70(%rbp)
jge    169c <nsexec+0x43c>
mov    -0xe0(%rbp),%rdx
mov    0x2930(%rip),%rax
mov    (%rax),%edi
movslq -0x94(%rbp),%rax
add    %rax,%rdx
lea    0xb0f(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    16a1 <nsexec+0x441>
mov    -0xa4(%rbp),%edi
call   1170 <NLA_ALIGN@plt>
mov    %rax,%rcx
movslq -0x94(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x94(%rbp)
jmp    1599 <nsexec+0x339>
cmpl   $0x0,-0x74(%rbp)
jne    16ef <nsexec+0x48f>
mov    0x28d3(%rip),%rax
mov    (%rax),%edi
lea    0xae4(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0xc8(%rbp),%rdi
mov    0x28f3(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
mov    -0x74(%rbp),%ecx
lea    0xad0(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0xc8(%rbp),%rdi
mov    0x2891(%rip),%rax
mov    (%rax),%esi
mov    0x28a0(%rip),%rax
or     (%rax),%esi
call   1140 <open@plt>
mov    %eax,-0x58(%rbp)
cmpl   $0xffffffff,-0x58(%rbp)
jne    1764 <nsexec+0x504>
mov    -0xc8(%rbp),%rdx
mov    0x285e(%rip),%rax
mov    (%rax),%edi
lea    0xa95(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    0x2845(%rip),%rax
mov    (%rax),%esi
mov    0x2854(%rip),%rax
or     (%rax),%esi
lea    0xa8d(%rip),%rdi
call   1140 <open@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0xffffffff,-0x5c(%rbp)
jne    17b0 <nsexec+0x550>
mov    0x2812(%rip),%rax
mov    (%rax),%edi
lea    0xa79(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x6,-0x54(%rbp)
jge    18fb <nsexec+0x69b>
mov    -0x58(%rbp),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    -0xb0(%rbp),%rdx
xor    %ecx,%ecx
call   1180 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    1808 <nsexec+0x5a8>
mov    0x27ad(%rip),%rax
mov    (%rax),%rax
mov    0x2773(%rip),%rcx
cmp    (%rcx),%rax
jne    1803 <nsexec+0x5a3>
jmp    18ed <nsexec+0x68d>
jmp    1808 <nsexec+0x5a8>
mov    -0x5c(%rbp),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    -0xb8(%rbp),%rdx
xor    %ecx,%ecx
call   1180 <fstatat@plt>
cmp    $0xffffffff,%eax
je     1844 <nsexec+0x5e4>
mov    -0xb0(%rbp),%rax
cmp    -0xb8(%rbp),%rax
jne    1844 <nsexec+0x5e4>
jmp    18ed <nsexec+0x68d>
mov    -0x58(%rbp),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
mov    0x2771(%rip),%rax
mov    (%rax),%edx
call   1070 <openat@plt>
mov    %eax,-0xbc(%rbp)
cmpl   $0xffffffff,-0xbc(%rbp)
jne    18a2 <nsexec+0x642>
mov    -0xc8(%rbp),%rdx
mov    0x2729(%rip),%rax
mov    (%rax),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rcx
lea    0x9b2(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0xbc(%rbp),%edi
xor    %esi,%esi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
jne    18e2 <nsexec+0x682>
mov    0x26e9(%rip),%rax
mov    (%rax),%edi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdx
lea    0x9a4(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0xbc(%rbp),%edi
call   10b0 <close@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    17b7 <nsexec+0x557>
mov    -0x5c(%rbp),%edi
call   10b0 <close@plt>
mov    -0x58(%rbp),%edi
call   10b0 <close@plt>
mov    -0x38(%rbp),%edi
call   1130 <setjmp@plt>
cmp    $0x1,%eax
jne    1a74 <nsexec+0x814>
mov    $0x0,%al
call   10c0 <setsid@plt>
cmp    $0xffffffff,%eax
jne    194d <nsexec+0x6ed>
mov    0x2675(%rip),%rax
mov    (%rax),%edi
lea    0x95e(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
cmpl   $0xffffffff,-0x70(%rbp)
je     1a68 <nsexec+0x808>
mov    -0x70(%rbp),%edi
mov    0x261f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    1994 <nsexec+0x734>
mov    0x262e(%rip),%rax
mov    (%rax),%edi
lea    0x933(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x70(%rbp),%edi
mov    0x25da(%rip),%rax
mov    (%rax),%rsi
xor    %edx,%edx
call   1060 <dup3@plt>
mov    0x25c9(%rip),%rcx
cmp    (%rcx),%rax
je     19d9 <nsexec+0x779>
mov    0x25e9(%rip),%rax
mov    (%rax),%edi
lea    0x913(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x70(%rbp),%edi
mov    0x2605(%rip),%rax
mov    (%rax),%rsi
xor    %edx,%edx
call   1060 <dup3@plt>
mov    0x25f4(%rip),%rcx
cmp    (%rcx),%rax
je     1a1e <nsexec+0x7be>
mov    0x25a4(%rip),%rax
mov    (%rax),%edi
lea    0x8ec(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x70(%rbp),%edi
mov    0x2568(%rip),%rax
mov    (%rax),%rsi
xor    %edx,%edx
call   1060 <dup3@plt>
mov    0x2557(%rip),%rcx
cmp    (%rcx),%rax
je     1a63 <nsexec+0x803>
mov    0x255f(%rip),%rax
mov    (%rax),%edi
lea    0x8c5(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
jmp    1a68 <nsexec+0x808>
movl   $0x1,-0x78(%rbp)
jmp    1b21 <nsexec+0x8c1>
lea    -0x38(%rbp),%rdi
call   1040 <clone_parent@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
jge    1aab <nsexec+0x84b>
mov    0x2517(%rip),%rax
mov    (%rax),%edi
lea    0x89b(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xd0(%rbp),%rax
mov    %eax,%esi
mov    -0x60(%rbp),%ecx
lea    0x88d(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0xc8(%rbp),%rsi
mov    %eax,-0x68(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%edx
call   1050 <write@plt>
cmp    -0x68(%rbp),%eax
je     1b1a <nsexec+0x8ba>
mov    0x24b9(%rip),%rax
mov    (%rax),%edi
lea    0x86a(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x60(%rbp),%edi
mov    0x247f(%rip),%rax
mov    (%rax),%esi
call   1110 <kill@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
xor    %edi,%edi
call   1160 <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    $0x78,%rsp
mov    %rsp,%r15
lea    0xd85(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    0xd7b(%rip),%rax
mov    %rax,-0x98(%rbp)
lea    0xd71(%rip),%rax
mov    %rax,-0x90(%rbp)
lea    0xd67(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    0xd5d(%rip),%rax
mov    %rax,-0x80(%rbp)
lea    0xd56(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0x2d27(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ebx
mov    %rsp,%r12
lea    0xf(%rbx),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r12
mov    %r12,%rsp
lea    0xd34(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1677 <nsexec+0x417>
mov    %rax,%r14
lea    0xd33(%rip),%rsi
mov    %rax,%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     1677 <nsexec+0x417>
lea    0xd24(%rip),%rsi
mov    %r14,%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
jne    1701 <nsexec+0x4a1>
lea    0xd34(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1718 <nsexec+0x4b8>
mov    %ebx,%r13d
mov    %rax,%rbx
mov    %rax,%rdi
call   1150 <atoi@plt>
mov    %eax,%r14d
lea    0xd48(%rip),%rdx
mov    %r12,%rdi
mov    %r13d,%esi
mov    %eax,%ecx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10e0 <strcmp@plt>
test   %rax,%rax
jne    172d <nsexec+0x4cd>
mov    %r14d,%edi
mov    0x2c62(%rip),%r14
mov    (%r14),%eax
mov    %eax,%edx
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %edi,-0x30(%rbp)
mov    %rbx,%rsi
call   10d0 <read@plt>
cmp    (%r14),%eax
jne    1742 <nsexec+0x4e2>
mov    (%rbx),%edx
mov    0x2c0f(%rip),%rax
cmp    (%rax),%edx
je     1756 <nsexec+0x4f6>
cmp    $0xf230,%edx
jne    176b <nsexec+0x50b>
mov    %r13d,-0x4c(%rbp)
xor    %esi,%esi
mov    %rbx,%rdi
call   1100 <NLMSG_PAYLOAD@plt>
mov    %eax,%ebx
mov    %eax,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rcx
mov    %rcx,%rsi
sub    %rax,%rsi
mov    %rsi,%rsp
mov    -0x30(%rbp),%edi
mov    %rsi,-0x38(%rbp)
mov    %ebx,%edx
call   10d0 <read@plt>
cmp    %ebx,%eax
jne    177d <nsexec+0x51d>
mov    %r12,-0x40(%rbp)
mov    %r15,-0x60(%rbp)
mov    %ebx,-0x44(%rbp)
test   %ebx,%ebx
jle    16ec <nsexec+0x48c>
mov    $0xffffffff,%eax
xor    %ecx,%ecx
mov    %ecx,%r14d
jmp    1463 <nsexec+0x203>
movslq %r15d,%rbx
add    -0x38(%rbp),%rbx
mov    0x2ba2(%rip),%rax
mov    (%rax),%esi
mov    %edi,%r13d
mov    %rbx,%rdi
call   1140 <open@plt>
mov    %r13d,%edi
mov    %eax,%r13d
test   %eax,%eax
js     16c8 <nsexec+0x468>
mov    %r14d,%ebx
sub    %r12d,%edi
call   1170 <NLA_ALIGN@plt>
add    %eax,%r15d
mov    %r15d,%ecx
mov    %r13d,%eax
cmp    -0x44(%rbp),%r15d
jge    14ac <nsexec+0x24c>
movslq %ecx,%rdx
mov    0x2b33(%rip),%rcx
mov    (%rcx),%r12d
mov    -0x38(%rbp),%rcx
mov    (%rcx,%rdx,1),%edi
mov    0x4(%rcx,%rdx,1),%ecx
mov    %r12d,%esi
lea    (%rdx,%rsi,1),%r15d
cmp    $0x6a92,%ecx
je     1420 <nsexec+0x1c0>
mov    %eax,%r13d
cmp    $0x6a91,%ecx
jne    1449 <nsexec+0x1e9>
mov    %edi,%r14d
movslq %r15d,%rdi
add    -0x38(%rbp),%rdi
call   1120 <readint32@plt>
mov    %r14d,%edi
mov    %eax,%r14d
jmp    1449 <nsexec+0x1e9>
mov    %r13d,-0x48(%rbp)
test   %ebx,%ebx
je     16ec <nsexec+0x48c>
mov    0x2b31(%rip),%rax
mov    (%rax),%esi
add    $0xffffffff,%esi
lea    0xd11(%rip),%rdx
mov    -0x40(%rbp),%r12
mov    %r12,%rdi
mov    %ebx,%ecx
call   1080 <snprintf@plt>
mov    0x2ad0(%rip),%r15
mov    0x2ae1(%rip),%rbx
mov    (%rbx),%esi
or     (%r15),%esi
mov    %r12,%rdi
call   1140 <open@plt>
cmp    $0xffffffff,%eax
je     17a0 <nsexec+0x540>
mov    %eax,%r14d
mov    (%rbx),%esi
or     (%r15),%esi
lea    0xcfe(%rip),%rdi
call   1140 <open@plt>
cmp    $0xffffffff,%eax
je     17ba <nsexec+0x55a>
mov    %eax,-0x2c(%rbp)
mov    $0x1,%r12d
xor    %ebx,%ebx
lea    0xad4(%rip),%r15
xor    %r13d,%r13d
nop
mov    %r14d,%edi
mov    %r15,%rsi
lea    -0x58(%rbp),%rdx
mov    %ebx,%ecx
call   1180 <fstatat@plt>
cmp    $0xffffffff,%eax
jne    155c <nsexec+0x2fc>
mov    0x2a4b(%rip),%rax
mov    (%rax),%rax
mov    0x2a11(%rip),%rcx
cmp    (%rcx),%rax
je     15b7 <nsexec+0x357>
mov    -0x2c(%rbp),%edi
mov    %r15,%rsi
lea    -0x68(%rbp),%rdx
mov    %ebx,%ecx
call   1180 <fstatat@plt>
cmp    $0xffffffff,%eax
je     157c <nsexec+0x31c>
mov    -0x58(%rbp),%rax
cmp    -0x68(%rbp),%rax
je     15b7 <nsexec+0x357>
mov    0x2a45(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    %r15,%rsi
call   1070 <openat@plt>
cmp    $0xffffffff,%eax
je     16a0 <nsexec+0x440>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r13d,%esi
call   1090 <setns@plt>
cmp    $0xffffffff,%eax
je     1689 <nsexec+0x429>
mov    %ebx,%edi
call   10b0 <close@plt>
xor    %ebx,%ebx
cmp    $0x6,%r12
je     15ce <nsexec+0x36e>
mov    -0xa0(%rbp,%r12,8),%r15
ff
add    $0x1,%r12
jmp    1530 <nsexec+0x2d0>
mov    -0x2c(%rbp),%edi
call   10b0 <close@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
call   1130 <setjmp@plt>
cmp    $0x1,%eax
jne    17cc <nsexec+0x56c>
xor    %eax,%eax
call   10c0 <setsid@plt>
cmp    $0xffffffff,%eax
mov    -0x60(%rbp),%r15
mov    -0x48(%rbp),%ebx
je     17eb <nsexec+0x58b>
cmp    $0xffffffff,%ebx
je     1677 <nsexec+0x417>
mov    0x2971(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
mov    %ebx,%edi
call   10a0 <ioctl@plt>
cmp    $0xffffffff,%eax
je     17fd <nsexec+0x59d>
mov    0x294e(%rip),%r14
mov    (%r14),%rsi
xor    %edx,%edx
mov    %ebx,%edi
call   1060 <dup3@plt>
cmp    (%r14),%rax
jne    180f <nsexec+0x5af>
mov    0x29a2(%rip),%r14
mov    (%r14),%rsi
xor    %edx,%edx
mov    %ebx,%edi
call   1060 <dup3@plt>
cmp    (%r14),%rax
jne    1821 <nsexec+0x5c1>
mov    0x292e(%rip),%r14
mov    (%r14),%rsi
xor    %edx,%edx
mov    %ebx,%edi
call   1060 <dup3@plt>
cmp    (%r14),%rax
jne    1833 <nsexec+0x5d3>
mov    %r15,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2918(%rip),%rax
mov    (%rax),%edi
lea    0xbdc(%rip),%rsi
xor    %eax,%eax
mov    %r15,%rdx
jmp    16dd <nsexec+0x47d>
mov    0x2901(%rip),%rax
mov    (%rax),%edi
lea    0xb93(%rip),%rsi
xor    %eax,%eax
mov    -0x40(%rbp),%rdx
mov    %r15,%rcx
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    0x28d9(%rip),%rax
mov    (%rax),%edi
lea    0xac2(%rip),%rsi
xor    %eax,%eax
mov    %rbx,%rdx
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    0x28b5(%rip),%rax
mov    (%rax),%edi
lea    0xac6(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x28a0(%rip),%rax
mov    (%rax),%edi
lea    0x92e(%rip),%rsi
xor    %eax,%eax
mov    %r14,%rdx
jmp    16dd <nsexec+0x47d>
mov    0x2889(%rip),%rax
mov    (%rax),%edi
lea    0x950(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x2874(%rip),%rax
mov    (%rax),%edi
lea    0x961(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    %eax,%edx
mov    0x285d(%rip),%rax
mov    (%rax),%edi
lea    0x97f(%rip),%rsi
jmp    178f <nsexec+0x52f>
mov    0x284b(%rip),%rax
mov    (%rax),%edi
lea    0x9a1(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x2836(%rip),%rax
mov    (%rax),%edi
lea    0x9b9(%rip),%rsi
jmp    178f <nsexec+0x52f>
mov    %eax,%edx
mov    0x2822(%rip),%rax
mov    (%rax),%edi
lea    0x9d6(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    0x2801(%rip),%rax
mov    (%rax),%edi
lea    0xa38(%rip),%rsi
xor    %eax,%eax
mov    %r12,%rdx
jmp    16dd <nsexec+0x47d>
mov    0x27e7(%rip),%rax
mov    (%rax),%edi
lea    0xa4e(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
lea    -0x58(%rbp),%rdi
call   1040 <clone_parent@plt>
test   %eax,%eax
jns    1854 <nsexec+0x5f4>
mov    0x27c8(%rip),%rax
mov    (%rax),%edi
lea    0xb4c(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x27b6(%rip),%rax
mov    (%rax),%edi
lea    0xa9f(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x27a4(%rip),%rax
mov    (%rax),%edi
lea    0xaa9(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x2792(%rip),%rax
mov    (%rax),%edi
lea    0xabc(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x2780(%rip),%rax
mov    (%rax),%edi
lea    0xac8(%rip),%rsi
jmp    1843 <nsexec+0x5e3>
mov    0x276e(%rip),%rax
mov    (%rax),%edi
lea    0xad4(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    %eax,%r14d
lea    0xaf4(%rip),%rdx
mov    -0x40(%rbp),%r15
mov    %r15,%rdi
mov    -0x4c(%rbp),%esi
mov    %eax,%ecx
call   1080 <snprintf@plt>
mov    %eax,%ebx
mov    -0x30(%rbp),%edi
mov    %r15,%rsi
mov    %eax,%edx
call   1050 <write@plt>
cmp    %ebx,%eax
jne    1889 <nsexec+0x629>
xor    %edi,%edi
call   1160 <exit@plt>
mov    0x2718(%rip),%rax
mov    (%rax),%edi
lea    0xac9(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    0x26e1(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
call   1110 <kill@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
%struct.nlmsghdr = type { i32 }
%struct.nlattr = type { i32, i32 }
%struct.stat = type { i64 }
@.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"
@.str.5 = [5 x i8] c"user\00"
@PATH_MAX = global i32 0
@.str.6 = [23 x i8] c"_LIBCONTAINER_INITTYPE\00"
@.str.7 = [9 x i8] c"standard\00"
@.str.8 = [6 x i8] c"setns\00"
@stderr = global i32 0
@.str.9 = [34 x i8] c"nsenter: Invalid inittype %s: %m\0A\00"
@.str.10 = [23 x i8] c"_LIBCONTAINER_INITPIPE\00"
@.str.11 = [35 x i8] c"nsenter: Child pipe not found: %m\0A\00"
@.str.12 = [3 x i8] c"%d\00"
@.str.13 = [53 x i8] c"nsenter: Unable to parse _LIBCONTAINER_INITPIPE: %m\0A\00"
@NLMSG_HDRLEN = global i32 0
@.str.14 = [52 x i8] c"nsenter: Failed to read netlink header, got %d: %m\0A\00"
@NLMSG_ERROR = global i32 0
@.str.15 = [45 x i8] c"nsenter: Invalid netlink header message: %m\0A\00"
@.str.16 = [49 x i8] c"nsenter: Unexpected netlink message type %d: %m\0A\00"
@.str.17 = [53 x i8] c"nsenter: Failed to read netlink payload, got %d: %m\0A\00"
@NLA_HDRLEN = global i32 0
@O_RDWR = global i32 0
@.str.18 = [40 x i8] c"nsenter: Failed to open console %s: %m\0A\00"
@.str.19 = [26 x i8] c"nsenter: missing pid: %m\0A\00"
@.str.20 = [12 x i8] c"/proc/%d/ns\00"
@O_DIRECTORY = global i32 0
@O_RDONLY = global i32 0
@.str.21 = [34 x i8] c"nsenter: Failed to open \22%s\22: %m\0A\00"
@.str.22 = [14 x i8] c"/proc/self/ns\00"
@.str.23 = [43 x i8] c"nsenter: Failed to open /proc/self/ns: %m\0A\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.24 = [50 x i8] c"nsenter: Failed to open ns file %s for ns %s: %m\0A\00"
@.str.25 = [37 x i8] c"nsenter: Failed to setns for %s: %m\0A\00"
@.str.26 = [28 x i8] c"nsenter: setsid failed: %m\0A\00"
@TIOCSCTTY = global i32 0
@.str.27 = [37 x i8] c"nsenter: ioctl TIOCSCTTY failed: %m\0A\00"
@STDIN_FILENO = global i64 0
@.str.28 = [30 x i8] c"nsenter: Failed to dup 0: %m\0A\00"
@STDOUT_FILENO = global i64 0
@.str.29 = [30 x i8] c"nsenter: Failed to dup 1: %m\0A\00"
@STDERR_FILENO = global i64 0
@.str.30 = [30 x i8] c"nsenter: Failed to dup 2: %m\0A\00"
@.str.31 = [29 x i8] c"nsenter: Unable to fork: %m\0A\00"
@.str.32 = [16 x i8] c"{ \22pid\22 : %d }\0A\00"
@.str.33 = [41 x i8] c"nsenter: Unable to send a child pid: %m\0A\00"
@SIGKILL = global i32 0
define void @nsexec() {
%1 = alloca [6 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 i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i64
%18 = alloca %struct.nlmsghdr*
%19 = alloca i64
%20 = alloca i32
%21 = alloca %struct.nlattr*
%22 = alloca i32
%23 = alloca %struct.stat
%24 = alloca %struct.stat
%25 = alloca i32
%26 = bitcast [6 x i8*]* %1 to i8*
%27 = bitcast i8* %26 to [6 x i8*]*
%28 = getelementptr inbounds [6 x i8*], [6 x i8*]* %27, i32 0, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8** %28
%29 = getelementptr inbounds [6 x i8*], [6 x i8*]* %27, i32 0, i32 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8** %29
%30 = getelementptr inbounds [6 x i8*], [6 x i8*]* %27, i32 0, i32 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8** %30
%31 = getelementptr inbounds [6 x i8*], [6 x i8*]* %27, i32 0, i32 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8** %31
%32 = getelementptr inbounds [6 x i8*], [6 x i8*]* %27, i32 0, i32 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8** %32
%33 = getelementptr inbounds [6 x i8*], [6 x i8*]* %27, i32 0, i32 5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8** %33
store i32 6, i32* %2
%34 = load i32, i32* @PATH_MAX
%35 = zext i32 %34 to i64
%36 = call i8* @llvm.stacksave()
store i8* %36, i8** %4
%37 = alloca i8, i64 %35
store i64 %35, i64* %5
store i32 -1, i32* %14
store i32 0, i32* %15
%38 = call i8* @getenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
store i8* %38, i8** %6
%39 = load i8*, i8** %6
%40 = icmp eq i8* %39, null
br i1 %40, label %45, label %41
41: ; preds = %0
%42 = load i8*, i8** %6
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %41, %0
store i32 1, i32* %16
br label %365
46: ; preds = %41
%47 = load i8*, i8** %6
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %6
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* %52)
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %46
%56 = call i8* @getenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
store i8* %56, i8** %6
%57 = load i8*, i8** %6
%58 = icmp eq i8* %57, null
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %55
%64 = load i8*, i8** %6
%65 = call i32 @atoi(i8* %64)
store i32 %65, i32* %13
%66 = trunc i64 %35 to i32
%67 = load i32, i32* %13
%68 = call i32 @snprintf(i8* %37, i32 %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %67)
%69 = load i8*, i8** %6
%70 = call i64 @strcmp(i8* %69, i8* %37)
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %63
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.13, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %63
%77 = load i32, i32* @NLMSG_HDRLEN
%78 = zext i32 %77 to i64
%79 = alloca i8, i64 %78
store i64 %78, i64* %17
%80 = load i32, i32* %13
%81 = load i32, i32* @NLMSG_HDRLEN
%82 = call i32 @read(i32 %80, i8* %79, i32 %81)
store i32 %82, i32* %11
%83 = load i32, i32* @NLMSG_HDRLEN
%84 = icmp ne i32 %82, %83
br i1 %84, label %85, label %90
85: ; preds = %76
%86 = load i32, i32* @stderr
%87 = load i32, i32* %11
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.14, i64 0, i64 0), i32 %87)
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %76
%91 = bitcast i8* %79 to %struct.nlmsghdr*
store %struct.nlmsghdr* %91, %struct.nlmsghdr** %18
%92 = load %struct.nlmsghdr*, %struct.nlmsghdr** %18
%93 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %92, i32 0, i32 0
%94 = load i32, i32* %93
%95 = load i32, i32* @NLMSG_ERROR
%96 = icmp eq i32 %94, %95
br i1 %96, label %97, label %101
97: ; preds = %90
%98 = load i32, i32* @stderr
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %90
%102 = load %struct.nlmsghdr*, %struct.nlmsghdr** %18
%103 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %102, i32 0, i32 0
%104 = load i32, i32* %103
%105 = icmp ne i32 %104, 62000
br i1 %105, label %106, label %113
106: ; preds = %101
%107 = load i32, i32* @stderr
%108 = load %struct.nlmsghdr*, %struct.nlmsghdr** %18
%109 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %108, i32 0, i32 0
%110 = load i32, i32* %109
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.16, i64 0, i64 0), i32 %110)
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %101
%114 = load %struct.nlmsghdr*, %struct.nlmsghdr** %18
%115 = call i32 @NLMSG_PAYLOAD(%struct.nlmsghdr* %114, i32 0)
store i32 %115, i32* %12
%116 = load i32, i32* %12
%117 = zext i32 %116 to i64
%118 = alloca i8, i64 %117
store i64 %117, i64* %19
%119 = load i32, i32* %13
%120 = load i32, i32* %12
%121 = call i32 @read(i32 %119, i8* %118, i32 %120)
store i32 %121, i32* %11
%122 = load i32, i32* %12
%123 = icmp ne i32 %121, %122
br i1 %123, label %124, label %129
124: ; preds = %113
%125 = load i32, i32* @stderr
%126 = load i32, i32* %11
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0), i32 %126)
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %113
store i32 0, i32* %20
br label %130
130: ; preds = %171, %129
%131 = load i32, i32* %20
%132 = load i32, i32* %12
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %178
134: ; preds = %130
%135 = load i32, i32* %20
%136 = sext i32 %135 to i64
%137 = getelementptr i8, i8* %118, i64 %136
%138 = bitcast i8* %137 to %struct.nlattr*
store %struct.nlattr* %138, %struct.nlattr** %21
%139 = load i32, i32* @NLA_HDRLEN
%140 = load i32, i32* %20
%141 = add nsw i32 %140, %139
store i32 %141, i32* %20
%142 = load %struct.nlattr*, %struct.nlattr** %21
%143 = getelementptr inbounds %struct.nlattr, %struct.nlattr* %142, i32 0, i32 0
%144 = load i32, i32* %143
%145 = load i32, i32* @NLA_HDRLEN
%146 = sub nsw i32 %144, %145
store i32 %146, i32* %22
%147 = load %struct.nlattr*, %struct.nlattr** %21
%148 = getelementptr inbounds %struct.nlattr, %struct.nlattr* %147, i32 0, i32 1
%149 = load i32, i32* %148
switch i32 %149, label %171 [
i32 27281, label %150
i32 27282, label %155
]
150: ; preds = %134
%151 = load i32, i32* %20
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i8, i8* %118, i64 %152
%154 = call i32 @readint32(i8* %153)
store i32 %154, i32* %15
br label %171
155: ; preds = %134
%156 = load i32, i32* %20
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %118, i64 %157
%159 = load i32, i32* @O_RDWR
%160 = call i32 @open(i8* %158, i32 %159)
store i32 %160, i32* %14
%161 = load i32, i32* %14
%162 = icmp slt i32 %161, 0
br i1 %162, label %163, label %170
163: ; preds = %155
%164 = load i32, i32* @stderr
%165 = load i32, i32* %20
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i8, i8* %118, i64 %166
%168 = call i32 (i32, i8*, ...) @fprintf(i32 %164, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.18, i64 0, i64 0), i8* %167)
%169 = call i32 @exit(i32 1)
unreachable
170: ; preds = %155
br label %171
171: ; preds = %134, %170, %150
%172 = load i32, i32* %22
%173 = call i64 @NLA_ALIGN(i32 %172)
%174 = load i32, i32* %20
%175 = sext i32 %174 to i64
%176 = add nsw i64 %175, %173
%177 = trunc i64 %176 to i32
store i32 %177, i32* %20
br label %130
178: ; preds = %130
%179 = load i32, i32* %15
%180 = icmp eq i32 %179, 0
br i1 %180, label %181, label %185
181: ; preds = %178
%182 = load i32, i32* @stderr
%183 = call i32 (i32, i8*, ...) @fprintf(i32 %182, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
%184 = call i32 @exit(i32 1)
unreachable
185: ; preds = %178
%186 = load i32, i32* @PATH_MAX
%187 = sub nsw i32 %186, 1
%188 = load i32, i32* %15
%189 = call i32 @snprintf(i8* %37, i32 %187, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i32 %188)
%190 = load i32, i32* @O_DIRECTORY
%191 = load i32, i32* @O_RDONLY
%192 = or i32 %190, %191
%193 = call i32 @open(i8* %37, i32 %192)
store i32 %193, i32* %8
%194 = load i32, i32* %8
%195 = icmp eq i32 %194, -1
br i1 %195, label %196, label %200
196: ; preds = %185
%197 = load i32, i32* @stderr
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %197, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.21, i64 0, i64 0), i8* %37)
%199 = call i32 @exit(i32 1)
unreachable
200: ; preds = %185
%201 = load i32, i32* @O_DIRECTORY
%202 = load i32, i32* @O_RDONLY
%203 = or i32 %201, %202
%204 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.22, i64 0, i64 0), i32 %203)
store i32 %204, i32* %9
%205 = load i32, i32* %9
%206 = icmp eq i32 %205, -1
br i1 %206, label %207, label %211
207: ; preds = %200
%208 = load i32, i32* @stderr
%209 = call i32 (i32, i8*, ...) @fprintf(i32 %208, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.23, i64 0, i64 0))
%210 = call i32 @exit(i32 1)
unreachable
211: ; preds = %200
store i32 0, i32* %7
br label %212
212: ; preds = %277, %211
%213 = load i32, i32* %7
%214 = icmp slt i32 %213, 6
br i1 %214, label %215, label %280
215: ; preds = %212
%216 = load i32, i32* %8
%217 = load i32, i32* %7
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %218
%220 = load i8*, i8** %219
%221 = call i32 @fstatat(i32 %216, i8* %220, %struct.stat* %23, i32 0)
%222 = icmp eq i32 %221, -1
br i1 %222, label %223, label %229
223: ; preds = %215
%224 = load i64, i64* @errno
%225 = load i64, i64* @ENOENT
%226 = icmp eq i64 %224, %225
br i1 %226, label %227, label %228
227: ; preds = %223
br label %277
228: ; preds = %223
br label %229
229: ; preds = %228, %215
%230 = load i32, i32* %9
%231 = load i32, i32* %7
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %232
%234 = load i8*, i8** %233
%235 = call i32 @fstatat(i32 %230, i8* %234, %struct.stat* %24, i32 0)
%236 = icmp ne i32 %235, -1
br i1 %236, label %237, label %244
237: ; preds = %229
%238 = getelementptr inbounds %struct.stat, %struct.stat* %23, i32 0, i32 0
%239 = load i64, i64* %238
%240 = getelementptr inbounds %struct.stat, %struct.stat* %24, i32 0, i32 0
%241 = load i64, i64* %240
%242 = icmp eq i64 %239, %241
br i1 %242, label %243, label %244
243: ; preds = %237
br label %277
244: ; preds = %237, %229
%245 = load i32, i32* %8
%246 = load i32, i32* %7
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %247
%249 = load i8*, i8** %248
%250 = load i32, i32* @O_RDONLY
%251 = call i32 @openat(i32 %245, i8* %249, i32 %250)
store i32 %251, i32* %25
%252 = load i32, i32* %25
%253 = icmp eq i32 %252, -1
br i1 %253, label %254, label %262
254: ; preds = %244
%255 = load i32, i32* @stderr
%256 = load i32, i32* %7
%257 = sext i32 %256 to i64
%258 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %257
%259 = load i8*, i8** %258
%260 = call i32 (i32, i8*, ...) @fprintf(i32 %255, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.24, i64 0, i64 0), i8* %37, i8* %259)
%261 = call i32 @exit(i32 1)
unreachable
262: ; preds = %244
%263 = load i32, i32* %25
%264 = call i32 @setns(i32 %263, i32 0)
%265 = icmp eq i32 %264, -1
br i1 %265, label %266, label %274
266: ; preds = %262
%267 = load i32, i32* @stderr
%268 = load i32, i32* %7
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %269
%271 = load i8*, i8** %270
%272 = call i32 (i32, i8*, ...) @fprintf(i32 %267, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.25, i64 0, i64 0), i8* %271)
%273 = call i32 @exit(i32 1)
unreachable
274: ; preds = %262
%275 = load i32, i32* %25
%276 = call i32 @close(i32 %275)
br label %277
277: ; preds = %274, %243, %227
%278 = load i32, i32* %7
%279 = add nsw i32 %278, 1
store i32 %279, i32* %7
br label %212
280: ; preds = %212
%281 = load i32, i32* %9
%282 = call i32 @close(i32 %281)
%283 = load i32, i32* %8
%284 = call i32 @close(i32 %283)
%285 = load i32, i32* %3
%286 = call i32 @setjmp(i32 %285)
%287 = icmp eq i32 %286, 1
br i1 %287, label %288, label %339
288: ; preds = %280
%289 = call i32 (...) @setsid()
%290 = icmp eq i32 %289, -1
br i1 %290, label %291, label %295
291: ; preds = %288
%292 = load i32, i32* @stderr
%293 = call i32 (i32, i8*, ...) @fprintf(i32 %292, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.26, i64 0, i64 0))
%294 = call i32 @exit(i32 1)
unreachable
295: ; preds = %288
%296 = load i32, i32* %14
%297 = icmp ne i32 %296, -1
br i1 %297, label %298, label %338
298: ; preds = %295
%299 = load i32, i32* %14
%300 = load i32, i32* @TIOCSCTTY
%301 = call i32 @ioctl(i32 %299, i32 %300, i32 0)
%302 = icmp eq i32 %301, -1
br i1 %302, label %303, label %307
303: ; preds = %298
%304 = load i32, i32* @stderr
%305 = call i32 (i32, i8*, ...) @fprintf(i32 %304, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.27, i64 0, i64 0))
%306 = call i32 @exit(i32 1)
unreachable
307: ; preds = %298
%308 = load i32, i32* %14
%309 = load i64, i64* @STDIN_FILENO
%310 = call i64 @dup3(i32 %308, i64 %309, i32 0)
%311 = load i64, i64* @STDIN_FILENO
%312 = icmp ne i64 %310, %311
br i1 %312, label %313, label %317
313: ; preds = %307
%314 = load i32, i32* @stderr
%315 = call i32 (i32, i8*, ...) @fprintf(i32 %314, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.28, i64 0, i64 0))
%316 = call i32 @exit(i32 1)
unreachable
317: ; preds = %307
%318 = load i32, i32* %14
%319 = load i64, i64* @STDOUT_FILENO
%320 = call i64 @dup3(i32 %318, i64 %319, i32 0)
%321 = load i64, i64* @STDOUT_FILENO
%322 = icmp ne i64 %320, %321
br i1 %322, label %323, label %327
323: ; preds = %317
%324 = load i32, i32* @stderr
%325 = call i32 (i32, i8*, ...) @fprintf(i32 %324, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.29, i64 0, i64 0))
%326 = call i32 @exit(i32 1)
unreachable
327: ; preds = %317
%328 = load i32, i32* %14
%329 = load i64, i64* @STDERR_FILENO
%330 = call i64 @dup3(i32 %328, i64 %329, i32 0)
%331 = load i64, i64* @STDERR_FILENO
%332 = icmp ne i64 %330, %331
br i1 %332, label %333, label %337
333: ; preds = %327
%334 = load i32, i32* @stderr
%335 = call i32 (i32, i8*, ...) @fprintf(i32 %334, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.30, i64 0, i64 0))
%336 = call i32 @exit(i32 1)
unreachable
337: ; preds = %327
br label %338
338: ; preds = %337, %295
store i32 1, i32* %16
br label %365
339: ; preds = %280
%340 = call i32 @clone_parent(i32* %3)
store i32 %340, i32* %10
%341 = load i32, i32* %10
%342 = icmp slt i32 %341, 0
br i1 %342, label %343, label %347
343: ; preds = %339
%344 = load i32, i32* @stderr
%345 = call i32 (i32, i8*, ...) @fprintf(i32 %344, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.31, i64 0, i64 0))
%346 = call i32 @exit(i32 1)
unreachable
347: ; preds = %339
%348 = trunc i64 %35 to i32
%349 = load i32, i32* %10
%350 = call i32 @snprintf(i8* %37, i32 %348, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i32 %349)
store i32 %350, i32* %12
%351 = load i32, i32* %13
%352 = load i32, i32* %12
%353 = call i32 @write(i32 %351, i8* %37, i32 %352)
%354 = load i32, i32* %12
%355 = icmp ne i32 %353, %354
br i1 %355, label %356, label %363
356: ; preds = %347
%357 = load i32, i32* @stderr
%358 = call i32 (i32, i8*, ...) @fprintf(i32 %357, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.33, i64 0, i64 0))
%359 = load i32, i32* %10
%360 = load i32, i32* @SIGKILL
%361 = call i32 @kill(i32 %359, i32 %360)
%362 = call i32 @exit(i32 1)
unreachable
363: ; preds = %347
%364 = call i32 @exit(i32 0)
unreachable
365: ; preds = %338, %45
%366 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
%struct.stat = type { i64 }
%struct.nlmsghdr = 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"
@.str.5 = [5 x i8] c"user\00"
@PATH_MAX = global i32 0
@.str.6 = [23 x i8] c"_LIBCONTAINER_INITTYPE\00"
@.str.7 = [9 x i8] c"standard\00"
@.str.8 = [6 x i8] c"setns\00"
@stderr = global i32 0
@.str.9 = [34 x i8] c"nsenter: Invalid inittype %s: %m\0A\00"
@.str.10 = [23 x i8] c"_LIBCONTAINER_INITPIPE\00"
@.str.11 = [35 x i8] c"nsenter: Child pipe not found: %m\0A\00"
@.str.12 = [3 x i8] c"%d\00"
@.str.13 = [53 x i8] c"nsenter: Unable to parse _LIBCONTAINER_INITPIPE: %m\0A\00"
@NLMSG_HDRLEN = global i32 0
@.str.14 = [52 x i8] c"nsenter: Failed to read netlink header, got %d: %m\0A\00"
@NLMSG_ERROR = global i32 0
@.str.15 = [45 x i8] c"nsenter: Invalid netlink header message: %m\0A\00"
@.str.16 = [49 x i8] c"nsenter: Unexpected netlink message type %d: %m\0A\00"
@.str.17 = [53 x i8] c"nsenter: Failed to read netlink payload, got %d: %m\0A\00"
@NLA_HDRLEN = global i32 0
@O_RDWR = global i32 0
@.str.18 = [40 x i8] c"nsenter: Failed to open console %s: %m\0A\00"
@.str.19 = [26 x i8] c"nsenter: missing pid: %m\0A\00"
@.str.20 = [12 x i8] c"/proc/%d/ns\00"
@O_DIRECTORY = global i32 0
@O_RDONLY = global i32 0
@.str.21 = [34 x i8] c"nsenter: Failed to open \22%s\22: %m\0A\00"
@.str.22 = [14 x i8] c"/proc/self/ns\00"
@.str.23 = [43 x i8] c"nsenter: Failed to open /proc/self/ns: %m\0A\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.24 = [50 x i8] c"nsenter: Failed to open ns file %s for ns %s: %m\0A\00"
@.str.25 = [37 x i8] c"nsenter: Failed to setns for %s: %m\0A\00"
@.str.26 = [28 x i8] c"nsenter: setsid failed: %m\0A\00"
@TIOCSCTTY = global i32 0
@.str.27 = [37 x i8] c"nsenter: ioctl TIOCSCTTY failed: %m\0A\00"
@STDIN_FILENO = global i64 0
@.str.28 = [30 x i8] c"nsenter: Failed to dup 0: %m\0A\00"
@STDOUT_FILENO = global i64 0
@.str.29 = [30 x i8] c"nsenter: Failed to dup 1: %m\0A\00"
@STDERR_FILENO = global i64 0
@.str.30 = [30 x i8] c"nsenter: Failed to dup 2: %m\0A\00"
@.str.31 = [29 x i8] c"nsenter: Unable to fork: %m\0A\00"
@.str.32 = [16 x i8] c"{ \22pid\22 : %d }\0A\00"
@.str.33 = [41 x i8] c"nsenter: Unable to send a child pid: %m\0A\00"
@SIGKILL = global i32 0
define void @nsexec() {
%1 = alloca [6 x i8*]
%2 = alloca i32
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = bitcast [6 x i8*]* %1 to i8*
%6 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %11
%12 = bitcast i32* %2 to i8*
%13 = load i32, i32* @PATH_MAX
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
%16 = alloca i8, i64 %14
%17 = call i8* @getenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%18 = icmp eq i8* %17, null
br i1 %18, label %260, label %19
19: ; preds = %0
%20 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %260, label %22
22: ; preds = %19
%23 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* %17)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %22
%30 = call i8* @getenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %29
%37 = call i32 @atoi(i8* %30)
%38 = call i32 @snprintf(i8* %16, i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %37)
%39 = call i64 @strcmp(i8* %30, i8* %16)
%40 = icmp eq i64 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %36
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.13, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %36
%46 = load i32, i32* @NLMSG_HDRLEN
%47 = zext i32 %46 to i64
%48 = alloca i8, i64 %47
%49 = call i32 @read(i32 %37, i8* %48, i32 %46)
%50 = load i32, i32* @NLMSG_HDRLEN
%51 = icmp eq i32 %49, %50
br i1 %51, label %56, label %52
52: ; preds = %45
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.14, i64 0, i64 0), i32 %49)
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %45
%57 = bitcast i8* %48 to %struct.nlmsghdr*
%58 = bitcast i8* %48 to i32*
%59 = load i32, i32* %58
%60 = load i32, i32* @NLMSG_ERROR
%61 = icmp eq i32 %59, %60
br i1 %61, label %62, label %66
62: ; preds = %56
%63 = load i32, i32* @stderr
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %56
%67 = icmp eq i32 %59, 62000
br i1 %67, label %72, label %68
68: ; preds = %66
%69 = load i32, i32* @stderr
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.16, i64 0, i64 0), i32 %59)
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %66
%73 = call i32 @NLMSG_PAYLOAD(%struct.nlmsghdr* %57, i32 0)
%74 = zext i32 %73 to i64
%75 = alloca i8, i64 %74
%76 = call i32 @read(i32 %37, i8* %75, i32 %73)
%77 = icmp eq i32 %76, %73
br i1 %77, label %78, label %80
78: ; preds = %72
%79 = icmp sgt i32 %73, 0
br i1 %79, label %84, label %121
80: ; preds = %72
%81 = load i32, i32* @stderr
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0), i32 %76)
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %78, %112
%85 = phi i32 [ %117, %112 ], [ 0, %78 ]
%86 = phi i32 [ %114, %112 ], [ -1, %78 ]
%87 = phi i32 [ %113, %112 ], [ 0, %78 ]
%88 = sext i32 %85 to i64
%89 = getelementptr i8, i8* %75, i64 %88
%90 = load i32, i32* @NLA_HDRLEN
%91 = add nsw i32 %90, %85
%92 = bitcast i8* %89 to i32*
%93 = load i32, i32* %92
%94 = sub nsw i32 %93, %90
%95 = getelementptr inbounds i8, i8* %89, i64 4
%96 = bitcast i8* %95 to i32*
%97 = load i32, i32* %96
switch i32 %97, label %112 [
i32 27281, label %98
i32 27282, label %102
]
98: ; preds = %84
%99 = sext i32 %91 to i64
%100 = getelementptr inbounds i8, i8* %75, i64 %99
%101 = call i32 @readint32(i8* %100)
br label %112
102: ; preds = %84
%103 = sext i32 %91 to i64
%104 = getelementptr inbounds i8, i8* %75, i64 %103
%105 = load i32, i32* @O_RDWR
%106 = call i32 @open(i8* %104, i32 %105)
%107 = icmp slt i32 %106, 0
br i1 %107, label %108, label %112
108: ; preds = %102
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.18, i64 0, i64 0), i8* %104)
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %102, %84, %98
%113 = phi i32 [ %87, %84 ], [ %87, %102 ], [ %101, %98 ]
%114 = phi i32 [ %86, %84 ], [ %106, %102 ], [ %86, %98 ]
%115 = call i64 @NLA_ALIGN(i32 %94)
%116 = trunc i64 %115 to i32
%117 = add i32 %91, %116
%118 = icmp slt i32 %117, %73
br i1 %118, label %84, label %119
119: ; preds = %112
%120 = icmp eq i32 %113, 0
br i1 %120, label %121, label %125
121: ; preds = %78, %119
%122 = load i32, i32* @stderr
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %119
%126 = load i32, i32* @PATH_MAX
%127 = add nsw i32 %126, -1
%128 = call i32 @snprintf(i8* %16, i32 %127, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i32 %113)
%129 = load i32, i32* @O_DIRECTORY
%130 = load i32, i32* @O_RDONLY
%131 = or i32 %130, %129
%132 = call i32 @open(i8* %16, i32 %131)
%133 = icmp eq i32 %132, -1
br i1 %133, label %134, label %138
134: ; preds = %125
%135 = load i32, i32* @stderr
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.21, i64 0, i64 0), i8* %16)
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %125
%139 = load i32, i32* @O_DIRECTORY
%140 = load i32, i32* @O_RDONLY
%141 = or i32 %140, %139
%142 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.22, i64 0, i64 0), i32 %141)
%143 = icmp eq i32 %142, -1
br i1 %143, label %149, label %144
144: ; preds = %138
%145 = bitcast %struct.stat* %3 to i8*
%146 = bitcast %struct.stat* %4 to i8*
%147 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%148 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
br label %153
149: ; preds = %138
%150 = load i32, i32* @stderr
%151 = call i32 (i32, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.23, i64 0, i64 0))
%152 = call i32 @exit(i32 1)
unreachable
153: ; preds = %189, %144
%154 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %144 ], [ %191, %189 ]
%155 = phi i64 [ 0, %144 ], [ %187, %189 ]
%156 = call i32 @fstatat(i32 %132, i8* %154, %struct.stat* %3, i32 0)
%157 = icmp eq i32 %156, -1
br i1 %157, label %158, label %162
158: ; preds = %153
%159 = load i64, i64* @errno
%160 = load i64, i64* @ENOENT
%161 = icmp eq i64 %159, %160
br i1 %161, label %186, label %162
162: ; preds = %158, %153
%163 = call i32 @fstatat(i32 %142, i8* %154, %struct.stat* %4, i32 0)
%164 = icmp eq i32 %163, -1
br i1 %164, label %169, label %165
165: ; preds = %162
%166 = load i64, i64* %147
%167 = load i64, i64* %148
%168 = icmp eq i64 %166, %167
br i1 %168, label %186, label %169
169: ; preds = %165, %162
%170 = load i32, i32* @O_RDONLY
%171 = call i32 @openat(i32 %132, i8* %154, i32 %170)
%172 = icmp eq i32 %171, -1
br i1 %172, label %173, label %177
173: ; preds = %169
%174 = load i32, i32* @stderr
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %174, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.24, i64 0, i64 0), i8* %16, i8* %154)
%176 = call i32 @exit(i32 1)
unreachable
177: ; preds = %169
%178 = call i32 @setns(i32 %171, i32 0)
%179 = icmp eq i32 %178, -1
br i1 %179, label %180, label %184
180: ; preds = %177
%181 = load i32, i32* @stderr
%182 = call i32 (i32, i8*, ...) @fprintf(i32 %181, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.25, i64 0, i64 0), i8* %154)
%183 = call i32 @exit(i32 1)
unreachable
184: ; preds = %177
%185 = call i32 @close(i32 %171)
br label %186
186: ; preds = %165, %158, %184
%187 = add nuw nsw i64 %155, 1
%188 = icmp eq i64 %187, 6
br i1 %188, label %192, label %189
189: ; preds = %186
%190 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %187
%191 = load i8*, i8** %190
br label %153
192: ; preds = %186
%193 = call i32 @close(i32 %142)
%194 = call i32 @close(i32 %132)
%195 = call i32 @setjmp(i32 undef)
%196 = icmp eq i32 %195, 1
br i1 %196, label %197, label %241
197: ; preds = %192
%198 = call i32 (...) @setsid()
%199 = icmp eq i32 %198, -1
br i1 %199, label %200, label %204
200: ; preds = %197
%201 = load i32, i32* @stderr
%202 = call i32 (i32, i8*, ...) @fprintf(i32 %201, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.26, i64 0, i64 0))
%203 = call i32 @exit(i32 1)
unreachable
204: ; preds = %197
%205 = icmp eq i32 %114, -1
br i1 %205, label %260, label %206
206: ; preds = %204
%207 = load i32, i32* @TIOCSCTTY
%208 = call i32 @ioctl(i32 %114, i32 %207, i32 0)
%209 = icmp eq i32 %208, -1
br i1 %209, label %210, label %214
210: ; preds = %206
%211 = load i32, i32* @stderr
%212 = call i32 (i32, i8*, ...) @fprintf(i32 %211, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.27, i64 0, i64 0))
%213 = call i32 @exit(i32 1)
unreachable
214: ; preds = %206
%215 = load i64, i64* @STDIN_FILENO
%216 = call i64 @dup3(i32 %114, i64 %215, i32 0)
%217 = load i64, i64* @STDIN_FILENO
%218 = icmp eq i64 %216, %217
br i1 %218, label %223, label %219
219: ; preds = %214
%220 = load i32, i32* @stderr
%221 = call i32 (i32, i8*, ...) @fprintf(i32 %220, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.28, i64 0, i64 0))
%222 = call i32 @exit(i32 1)
unreachable
223: ; preds = %214
%224 = load i64, i64* @STDOUT_FILENO
%225 = call i64 @dup3(i32 %114, i64 %224, i32 0)
%226 = load i64, i64* @STDOUT_FILENO
%227 = icmp eq i64 %225, %226
br i1 %227, label %232, label %228
228: ; preds = %223
%229 = load i32, i32* @stderr
%230 = call i32 (i32, i8*, ...) @fprintf(i32 %229, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.29, i64 0, i64 0))
%231 = call i32 @exit(i32 1)
unreachable
232: ; preds = %223
%233 = load i64, i64* @STDERR_FILENO
%234 = call i64 @dup3(i32 %114, i64 %233, i32 0)
%235 = load i64, i64* @STDERR_FILENO
%236 = icmp eq i64 %234, %235
br i1 %236, label %260, label %237
237: ; preds = %232
%238 = load i32, i32* @stderr
%239 = call i32 (i32, i8*, ...) @fprintf(i32 %238, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.30, i64 0, i64 0))
%240 = call i32 @exit(i32 1)
unreachable
241: ; preds = %192
%242 = call i32 @clone_parent(i32* %2)
%243 = icmp slt i32 %242, 0
br i1 %243, label %244, label %248
244: ; preds = %241
%245 = load i32, i32* @stderr
%246 = call i32 (i32, i8*, ...) @fprintf(i32 %245, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.31, i64 0, i64 0))
%247 = call i32 @exit(i32 1)
unreachable
248: ; preds = %241
%249 = call i32 @snprintf(i8* %16, i32 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i32 %242)
%250 = call i32 @write(i32 %37, i8* %16, i32 %249)
%251 = icmp eq i32 %250, %249
br i1 %251, label %258, label %252
252: ; preds = %248
%253 = load i32, i32* @stderr
%254 = call i32 (i32, i8*, ...) @fprintf(i32 %253, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.33, i64 0, i64 0))
%255 = load i32, i32* @SIGKILL
%256 = call i32 @kill(i32 %242, i32 %255)
%257 = call i32 @exit(i32 1)
unreachable
258: ; preds = %248
%259 = call i32 @exit(i32 0)
unreachable
260: ; preds = %204, %232, %0, %19
ret void
}