#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef scalar_t__ uid_t;
struct rlimit {
  int rlim_cur;
  int rlim_max;
};
struct passwd {
  scalar_t__ pw_gid;
  scalar_t__ pw_uid;
};
struct group {
  scalar_t__ gr_gid;
};
typedef int pid_t;
typedef scalar_t__ gid_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_NOFILE;
scalar_t__ chdir(char *);
scalar_t__ chroot(char *);
int errno;
int execve(char *, char **, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
struct group *getgrnam(char *);
struct passwd *getpwnam(char *);
scalar_t__ getrlimit(int /*<<< orphan*/, struct rlimit *);
scalar_t__ getuid();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, long, ...);
int setgid(scalar_t__);
scalar_t__ setrlimit(int /*<<< orphan*/, struct rlimit *);
int setsid();
int setuid(scalar_t__);
int /*<<< orphan*/ stdIOfiles(char *, char *, char *);
int /*<<< orphan*/ *stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  pid_t pid;
  int debug = 0;
  char *chroot_dir = "";
  char *cd_dir = "";
  char *username = "";
  char *groupname = "";
  char *stdout_fn = "";
  char *stderr_fn = "";
  char *stdin_fn = "";
  char *pid_fn = "";
  int cmd_start = 1;
  int ulimit_set = 0;
  int i, j, c;
  char *s;
  FILE *pid_fp = NULL;
  uid_t uid;
  gid_t gid;
  struct rlimit limit;
  for (i = 1; i < argc; i++) {
    s = argv[i];
    c = *s++;
    if (c != '-') {
      cmd_start = i;
      goto done;
    } else if (i + 1 >= argc) {
      usage();
    } else {
      c = *s;
      switch (c) {
      case 'R':
        chroot_dir = argv[++i];
        break;
      case 'c':
        cd_dir = argv[++i];
        break;
      case 'u':
        username = argv[++i];
        break;
      case 'D':
        debug++;
        break;
      case 'g':
        groupname = argv[++i];
        break;
      case 'o':
        stdout_fn = argv[++i];
        break;
      case 'O':
        stderr_fn = argv[++i];
        break;
      case 'p':
        pid_fn = argv[++i];
        break;
      case 'i':
        stdin_fn = argv[++i];
        break;
      case 'U':
        ulimit_set = 1;
        break;
      case '-':
        cmd_start = ++i;
        goto done;
      default:
        usage();
      }
    }
  }
done:;
  if (getuid() != 0) {
    fprintf(stderr, "Error: only root can execute %s, exiting\n", argv[0]);
    exit(1);
  }
  if (ulimit_set) {
    limit.rlim_cur = 65535;
    limit.rlim_max = 65535;
    if (setrlimit(RLIMIT_NOFILE, &limit) != 0) {
      fprintf(stderr, "setrlimit() failed with errno=%d\n", errno);
      exit(1);
    }
    if (getrlimit(RLIMIT_NOFILE, &limit) != 0) {
      fprintf(stderr, "getrlimit() failed with errno=%d\n", errno);
      exit(1);
    }
    if (debug) {
      printf("The soft limit is %llu\n", limit.rlim_cur);
      printf("The hard limit is %llu\n", limit.rlim_max);
    }
  }
  if (strcmp(pid_fn, "") != 0) {
    if ((pid_fp = fopen(pid_fn, "w")) == NULL) {
      fprintf(stderr,
              "Error: unable to open %s for writing - pid file, exiting\n",
              pid_fn);
      exit(1);
    }
  }
  uid = 0;
  gid = 0;
  if (strcmp(username, "") != 0) {
    struct passwd *pw = getpwnam(username);
    if (pw == NULL) {
      fprintf(stderr, "Error: invalid username >%s<, exiting\n", username);
      exit(1);
    }
    uid = pw->pw_uid;
    gid = pw->pw_gid;
  }
  if (strcmp(groupname, "") != 0) {
    struct group *gr = getgrnam(groupname);
    if (gr == NULL) {
      fprintf(stderr, "Error: invalid groupname >%s<, exiting\n", groupname);
      exit(1);
    }
    gid = gr->gr_gid;
  }
  if (debug) {
    printf("uid = %ld gid = %ld\n", (long)uid, (long)gid);
  }
  if (strcmp(chroot_dir, "") != 0) {
    if (chdir(chroot_dir) != 0) {
      fprintf(stderr, "Error: chroot dir %s did not exist, exiting\n",
              chroot_dir);
      exit(1);
    }
    if (chroot(chroot_dir) != 0) {
      fprintf(stderr, "Error: unable to chroot to %s, exiting\n", chroot_dir);
      exit(1);
    }
  }
  if (setgid(gid) == -1) {
    fprintf(stderr, "Error: unable to switch groupid, exiting\n");
    exit(1);
  }
  if (setuid(uid) == -1) {
    fprintf(stderr, "Error: unable to switch userid, exiting\n");
    exit(1);
  }
  pid = fork();
  if (pid == 0) {
    if (strcmp(cd_dir, "") != 0) {
      if (chdir(cd_dir) != 0) {
        fprintf(stderr, "Error: unable to change working directory, exiting\n");
        exit(1);
      }
    }
    if (setsid() == -1) {
      fprintf(stderr, "Error: Unable to create new processgroup, exiting\n");
      exit(1);
    }
    stdIOfiles(stdout_fn, stderr_fn, stdin_fn);
    char *prog = argv[cmd_start];
    char **args = (char **)malloc(argc * sizeof(char *));
    for (i = cmd_start, j = 0; i < argc; i++, j++) {
      args[j] = argv[i];
    }
    args[j] = NULL;
    char *eenv[0 + 1];
    eenv[0] = NULL;
    return execve(prog, args, eenv);
  } else if (pid == -1) {
    fprintf(stderr, "Error: unable to fork the wrapped process, exiting\n");
    exit(1);
  }
  fprintf(stderr, "PID of child = %d\n", pid);
  if (pid_fp) {
    fprintf(pid_fp, "%ld\n", (long)pid);
    fclose(pid_fp);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0x1140(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0x1135(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0x112a(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0x111f(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0x1114(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0x1109(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0x10fe(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0x10f3(%rip),%rax
mov    %rax,-0x58(%rbp)
movl   $0x1,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movq   $0x0,-0x80(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14b6 <main+0x266>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x78(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x6c(%rbp)
cmpl   $0x2d,-0x6c(%rbp)
je     132b <main+0xdb>
mov    -0x64(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    14bb <main+0x26b>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     1346 <main+0xf6>
mov    $0x0,%al
call   1110 <usage@plt>
jmp    149e <main+0x24e>
mov    -0x78(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
add    $0xffffffd3,%eax
mov    %eax,%ecx
mov    %rcx,-0xc8(%rbp)
sub    $0x48,%eax
ja     1492 <main+0x242>
mov    -0xc8(%rbp),%rax
lea    0xc8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
jmp    1499 <main+0x249>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
jmp    1499 <main+0x249>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
jmp    1499 <main+0x249>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1499 <main+0x249>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
jmp    1499 <main+0x249>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
jmp    1499 <main+0x249>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x48(%rbp)
jmp    1499 <main+0x249>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x58(%rbp)
jmp    1499 <main+0x249>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x50(%rbp)
jmp    1499 <main+0x249>
movl   $0x1,-0x60(%rbp)
jmp    1499 <main+0x249>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    %eax,-0x5c(%rbp)
jmp    14bb <main+0x26b>
mov    $0x0,%al
call   1110 <usage@plt>
jmp    149e <main+0x24e>
jmp    14a3 <main+0x253>
jmp    14a8 <main+0x258>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12e5 <main+0x95>
jmp    14bb <main+0x26b>
mov    $0x0,%al
call   1060 <getuid@plt>
cmp    $0x0,%rax
je     14f5 <main+0x2a5>
mov    0x2b05(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc40(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
cmpl   $0x0,-0x60(%rbp)
je     15e0 <main+0x390>
movl   $0xffff,-0x98(%rbp)
movl   $0xffff,-0x94(%rbp)
mov    0x2ace(%rip),%rax
mov    (%rax),%edi
lea    -0x98(%rbp),%rsi
call   1100 <setrlimit@plt>
cmp    $0x0,%rax
je     155d <main+0x30d>
mov    0x2a9f(%rip),%rax
mov    (%rax),%rdi
mov    0x2a8d(%rip),%rax
mov    (%rax),%edx
lea    0xc02(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    0x2a84(%rip),%rax
mov    (%rax),%edi
lea    -0x98(%rbp),%rsi
call   1150 <getrlimit@plt>
cmp    $0x0,%rax
je     15a7 <main+0x357>
mov    0x2a55(%rip),%rax
mov    (%rax),%rdi
mov    0x2a43(%rip),%rax
mov    (%rax),%edx
lea    0xbda(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
cmpl   $0x0,-0x18(%rbp)
je     15db <main+0x38b>
movslq -0x98(%rbp),%rsi
lea    0xbd3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movslq -0x94(%rbp),%rsi
lea    0xbd6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    15e0 <main+0x390>
mov    -0x58(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1643 <main+0x3f3>
mov    -0x58(%rbp),%rdi
lea    0xbbd(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
jne    163e <main+0x3ee>
mov    0x29b9(%rip),%rax
mov    (%rax),%rdi
mov    -0x58(%rbp),%rdx
lea    0xb97(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
jmp    1643 <main+0x3f3>
movq   $0x0,-0x88(%rbp)
movq   $0x0,-0x90(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     16da <main+0x48a>
mov    -0x30(%rbp),%rdi
call   10b0 <getpwnam@plt>
mov    %rax,-0xa0(%rbp)
cmpq   $0x0,-0xa0(%rbp)
jne    16b7 <main+0x467>
mov    0x2940(%rip),%rax
mov    (%rax),%rdi
mov    -0x30(%rbp),%rdx
lea    0xb58(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0xa0(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    -0xa0(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xcd2(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1749 <main+0x4f9>
mov    -0x38(%rbp),%rdi
call   10d0 <getgrnam@plt>
mov    %rax,-0xa8(%rbp)
cmpq   $0x0,-0xa8(%rbp)
jne    1738 <main+0x4e8>
mov    0x28bf(%rip),%rax
mov    (%rax),%rdi
mov    -0x38(%rbp),%rdx
lea    0xafe(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0xa8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     176f <main+0x51f>
mov    -0x88(%rbp),%rsi
mov    -0x90(%rbp),%rdx
lea    0xae5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xc3d(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1800 <main+0x5b0>
mov    -0x20(%rbp),%rdi
call   1050 <chdir@plt>
cmp    $0x0,%rax
je     17c2 <main+0x572>
mov    0x2835(%rip),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xab1(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1030 <chroot@plt>
cmp    $0x0,%rax
je     17fb <main+0x5ab>
mov    0x27fc(%rip),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xaa5(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
jmp    1800 <main+0x5b0>
mov    -0x90(%rbp),%rdi
call   1120 <setgid@plt>
cmp    $0xffffffff,%eax
jne    1837 <main+0x5e7>
mov    0x27bc(%rip),%rax
mov    (%rax),%rdi
lea    0xa91(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x88(%rbp),%rdi
call   1160 <setuid@plt>
cmp    $0xffffffff,%eax
jne    186e <main+0x61e>
mov    0x2785(%rip),%rax
mov    (%rax),%rdi
lea    0xa84(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    $0x0,%al
call   1170 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    19ce <main+0x77e>
mov    -0x28(%rbp),%rdi
lea    0xb2a(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     18d6 <main+0x686>
mov    -0x28(%rbp),%rdi
call   1050 <chdir@plt>
cmp    $0x0,%rax
je     18d1 <main+0x681>
mov    0x2722(%rip),%rax
mov    (%rax),%rdi
lea    0xa4a(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
jmp    18d6 <main+0x686>
mov    $0x0,%al
call   1080 <setsid@plt>
cmp    $0xffffffff,%eax
jne    1908 <main+0x6b8>
mov    0x26eb(%rip),%rax
mov    (%rax),%rdi
lea    0xa47(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rdx
call   10e0 <stdIOfiles@plt>
mov    -0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0xb0(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0xb8(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    198d <main+0x73d>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0xb8(%rbp),%rax
movslq -0x68(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    194f <main+0x6ff>
mov    -0xb8(%rbp),%rax
movslq -0x68(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
movq   $0x0,-0xc0(%rbp)
mov    -0xb0(%rbp),%rdi
mov    -0xb8(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   1090 <execve@plt>
add    $0xd0,%rsp
pop    %rbp
ret
cmpl   $0xffffffff,-0x14(%rbp)
jne    19fa <main+0x7aa>
mov    0x25f9(%rip),%rax
mov    (%rax),%rdi
lea    0x988(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
jmp    19ff <main+0x7af>
mov    0x25d2(%rip),%rax
mov    (%rax),%rdi
mov    -0x14(%rbp),%edx
lea    0x992(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
cmpq   $0x0,-0x80(%rbp)
je     1a44 <main+0x7f4>
mov    -0x80(%rbp),%rdi
movslq -0x14(%rbp),%rdx
lea    0x829(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x80(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1140 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
cmp    $0x2,%edi
mov    %rbx,0x50(%rsp)
jl     12c5 <main+0x65>
mov    $0x1,%r12d
lea    0x112d(%rip),%rcx
lea    0xd6f(%rip),%rbp
movl   $0x0,0x4(%rsp)
mov    %rcx,0x10(%rsp)
mov    %rcx,0x48(%rsp)
xor    %eax,%eax
mov    %rcx,0x18(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rcx,0x38(%rsp)
mov    %rcx,0x30(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rcx,0x8(%rsp)
jmp    1333 <main+0xd3>
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
call   1060 <getuid@plt>
test   %rax,%rax
jne    185f <main+0x5ff>
mov    $0x1,%r15d
lea    0x10cd(%rip),%rbx
mov    %rbx,0x30(%rsp)
mov    %rbx,0x38(%rsp)
mov    %rbx,0x40(%rsp)
mov    %rbx,%r12
mov    %rbx,0x48(%rsp)
mov    %rbx,%r13
mov    %rbx,%rbp
jmp    14be <main+0x25e>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x20(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %r13d,%eax
mov    %r15d,%r12d
add    $0x1,%r12d
cmp    %ebx,%r12d
jge    1405 <main+0x1a5>
mov    %eax,%r13d
movslq %r12d,%rax
mov    (%r14,%rax,8),%rax
cmpb   $0x2d,(%rax)
jne    1400 <main+0x1a0>
lea    0x1(%r12),%r15d
cmp    %ebx,%r15d
jge    1380 <main+0x120>
movsbl 0x1(%rax),%ecx
add    $0xffffffd3,%ecx
cmp    $0x48,%ecx
ja     1380 <main+0x120>
mov    $0x1,%eax
movslq 0x0(%rbp,%rcx,4),%rcx
add    %rbp,%rcx
jmp    *%rcx
addl   $0x1,0x4(%rsp)
jmp    1387 <main+0x127>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1110 <usage@plt>
mov    %r13d,%eax
jmp    1326 <main+0xc6>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x38(%rsp)
jmp    1320 <main+0xc0>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x10(%rsp)
jmp    1320 <main+0xc0>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x8(%rsp)
jmp    1320 <main+0xc0>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x40(%rsp)
jmp    1320 <main+0xc0>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x30(%rsp)
jmp    1320 <main+0xc0>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x18(%rsp)
jmp    1320 <main+0xc0>
movslq %r15d,%rax
mov    (%r14,%rax,8),%rax
mov    %rax,0x48(%rsp)
jmp    1320 <main+0xc0>
mov    %r12d,%r15d
jmp    140e <main+0x1ae>
mov    $0x1,%r15d
mov    %eax,%r13d
xor    %eax,%eax
call   1060 <getuid@plt>
test   %rax,%rax
jne    185f <main+0x5ff>
test   %r13d,%r13d
mov    0x8(%rsp),%rbx
je     14af <main+0x24f>
movabs $0xffff0000ffff,%rax
mov    %rax,0x28(%rsp)
mov    0x2ba6(%rip),%r12
mov    (%r12),%edi
lea    0x28(%rsp),%rsi
call   1100 <setrlimit@plt>
test   %rax,%rax
jne    199a <main+0x73a>
mov    (%r12),%edi
lea    0x28(%rsp),%rsi
call   1160 <getrlimit@plt>
test   %rax,%rax
jne    19b6 <main+0x756>
cmpl   $0x0,0x4(%rsp)
je     14a7 <main+0x247>
movslq 0x28(%rsp),%rsi
lea    0xd0f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movslq 0x2c(%rsp),%rsi
lea    0xd14(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movl   $0x1,0x4(%rsp)
jmp    14af <main+0x24f>
movl   $0x0,0x4(%rsp)
mov    0x10(%rsp),%r13
mov    0x20(%rsp),%rbp
mov    0x18(%rsp),%r12
lea    0xef2(%rip),%rsi
mov    %r12,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1504 <main+0x2a4>
lea    0xce9(%rip),%rsi
mov    %r12,%rdi
call   1130 <fopen@plt>
mov    %rax,%rcx
mov    %rax,0x8(%rsp)
test   %rax,%rax
jne    150b <main+0x2ab>
mov    0x2ae3(%rip),%rax
mov    (%rax),%rdi
lea    0xcc5(%rip),%rsi
jmp    191d <main+0x6bd>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xea5(%rip),%rsi
mov    0x48(%rsp),%r12
mov    %r12,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
mov    %r13,0x10(%rsp)
mov    %r14,0x58(%rsp)
je     1548 <main+0x2e8>
mov    %r12,%rdi
call   10b0 <getpwnam@plt>
test   %rax,%rax
je     190c <main+0x6ac>
mov    (%rax),%r12
mov    0x8(%rax),%r14
jmp    154e <main+0x2ee>
xor    %r14d,%r14d
xor    %r12d,%r12d
lea    0xe62(%rip),%rsi
mov    %rbx,%r13
mov    %rbx,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1579 <main+0x319>
mov    %r13,%rdi
call   10d0 <getgrnam@plt>
test   %rax,%rax
je     1922 <main+0x6c2>
mov    (%rax),%r12
cmpl   $0x0,0x4(%rsp)
je     1594 <main+0x334>
lea    0xcc6(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe1c(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
mov    0x58(%rsp),%rbx
je     15cf <main+0x36f>
mov    %rbp,%rdi
call   1050 <chdir@plt>
test   %rax,%rax
jne    1938 <main+0x6d8>
mov    %rbp,%rdi
call   1030 <chroot@plt>
test   %rax,%rax
jne    194b <main+0x6eb>
mov    %r12,%rdi
call   1120 <setgid@plt>
cmp    $0xffffffff,%eax
je     1878 <main+0x618>
mov    %r14,%rdi
call   1170 <setuid@plt>
cmp    $0xffffffff,%eax
je     1893 <main+0x633>
xor    %eax,%eax
call   1180 <fork@plt>
test   %eax,%eax
mov    0x50(%rsp),%r14
jne    1842 <main+0x5e2>
lea    0xdab(%rip),%rsi
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     162f <main+0x3cf>
mov    %rbp,%rdi
call   1050 <chdir@plt>
test   %rax,%rax
jne    1970 <main+0x710>
xor    %eax,%eax
call   1080 <setsid@plt>
cmp    $0xffffffff,%eax
je     18ae <main+0x64e>
mov    0x30(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x40(%rsp),%rdx
call   10e0 <stdIOfiles@plt>
movslq %r15d,%rbp
mov    (%rbx,%rbp,8),%r12
lea    0x0(,%r14,8),%edi
call   10f0 <malloc@plt>
cmp    %r14d,%ebp
jge    1721 <main+0x4c1>
sub    %r15d,%r14d
cmp    $0x4,%r14d
jb     169b <main+0x43b>
lea    (%r14,%rbp,1),%rcx
lea    (%rbx,%rcx,8),%rcx
cmp    %rcx,%rax
jae    1754 <main+0x4f4>
lea    (%rax,%r14,8),%rcx
lea    (%rbx,%rbp,8),%rdx
cmp    %rcx,%rdx
jae    1754 <main+0x4f4>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %r14,%rdx
mov    %r14,%rsi
and    $0x3,%rsi
je     16c6 <main+0x466>
nop
mov    (%rbx,%rbp,8),%rdi
mov    %rdi,(%rax,%rcx,8)
add    $0x1,%rbp
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    16b0 <main+0x450>
cmp    $0x3,%rdx
jb     1724 <main+0x4c4>
lea    (%rbx,%rbp,8),%rdx
add    $0x18,%rdx
mov    %r14,%rsi
sub    %rcx,%rsi
lea    (%rax,%rcx,8),%rcx
add    $0x18,%rcx
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    -0x18(%rdx,%rdi,8),%rbp
mov    %rbp,-0x18(%rcx,%rdi,8)
mov    -0x10(%rdx,%rdi,8),%rbp
mov    %rbp,-0x10(%rcx,%rdi,8)
mov    -0x8(%rdx,%rdi,8),%rbp
mov    %rbp,-0x8(%rcx,%rdi,8)
mov    (%rdx,%rdi,8),%rbp
mov    %rbp,(%rcx,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%rsi
jne    16f0 <main+0x490>
jmp    1724 <main+0x4c4>
xor    %r14d,%r14d
movq   $0x0,(%rax,%r14,8)
movq   $0x0,0x60(%rsp)
lea    0x60(%rsp),%rdx
mov    %r12,%rdi
mov    %rax,%rsi
call   1090 <execve@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%r9
mov    %r14d,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0xc,%rdi
jae    177e <main+0x51e>
mov    %rbx,%r8
xor    %edi,%edi
jmp    17e8 <main+0x588>
and    $0xfffffffffffffffc,%rsi
mov    %rbx,%r8
lea    (%rbx,%rbp,8),%rbx
add    $0x70,%rbx
xor    %edi,%edi
nop
movups -0x70(%rbx,%rdi,8),%xmm0
movups -0x60(%rbx,%rdi,8),%xmm1
movups %xmm0,(%rax,%rdi,8)
movups %xmm1,0x10(%rax,%rdi,8)
movups -0x50(%rbx,%rdi,8),%xmm0
movups -0x40(%rbx,%rdi,8),%xmm1
movups %xmm0,0x20(%rax,%rdi,8)
movups %xmm1,0x30(%rax,%rdi,8)
movups -0x30(%rbx,%rdi,8),%xmm0
movups -0x20(%rbx,%rdi,8),%xmm1
movups %xmm0,0x40(%rax,%rdi,8)
movups %xmm1,0x50(%rax,%rdi,8)
movups -0x10(%rbx,%rdi,8),%xmm0
movups (%rbx,%rdi,8),%xmm1
movups %xmm0,0x60(%rax,%rdi,8)
movups %xmm1,0x70(%rax,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1790 <main+0x530>
test   %rdx,%rdx
je     182b <main+0x5cb>
lea    (%rax,%rdi,8),%rsi
add    $0x10,%rsi
add    %rbp,%rdi
lea    (%r8,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rdx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movups -0x10(%rdi,%rbx,1),%xmm0
movups (%rdi,%rbx,1),%xmm1
movups %xmm0,-0x10(%rsi,%rbx,1)
movups %xmm1,(%rsi,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%rdx
jne    1810 <main+0x5b0>
mov    %r9,%r14
cmp    %r9,%rcx
je     1724 <main+0x4c4>
mov    %r8,%rbx
add    %rcx,%rbp
jmp    169d <main+0x43d>
mov    %eax,%ebp
mov    0x278d(%rip),%rax
cmp    $0xffffffff,%ebp
jne    18c9 <main+0x669>
mov    (%rax),%rcx
lea    0xb17(%rip),%rdi
jmp    1981 <main+0x721>
mov    0x2772(%rip),%rax
mov    (%rax),%rdi
mov    (%r14),%rdx
lea    0x8b1(%rip),%rsi
jmp    195f <main+0x6ff>
mov    0x2759(%rip),%rax
mov    (%rax),%rcx
lea    0xa2e(%rip),%rdi
mov    $0x29,%esi
jmp    1986 <main+0x726>
mov    0x273e(%rip),%rax
mov    (%rax),%rcx
lea    0xa3d(%rip),%rdi
mov    $0x28,%esi
jmp    1986 <main+0x726>
mov    0x2723(%rip),%rax
mov    (%rax),%rcx
lea    0xa7f(%rip),%rdi
mov    $0x32,%esi
jmp    1986 <main+0x726>
mov    (%rax),%rdi
lea    0xad2(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10c0 <fprintf@plt>
cmpq   $0x0,0x8(%rsp)
je     1905 <main+0x6a5>
movslq %ebp,%rdx
lea    0x96f(%rip),%rsi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1140 <exit@plt>
mov    0x26c5(%rip),%rax
mov    (%rax),%rdi
lea    0x8e1(%rip),%rsi
mov    %r12,%rdx
jmp    195f <main+0x6ff>
mov    0x26af(%rip),%rax
mov    (%rax),%rdi
lea    0x8f2(%rip),%rsi
mov    %r13,%rdx
jmp    195f <main+0x6ff>
mov    0x2699(%rip),%rax
mov    (%rax),%rdi
lea    0x919(%rip),%rsi
jmp    195c <main+0x6fc>
mov    0x2686(%rip),%rax
mov    (%rax),%rdi
lea    0x933(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    0x2661(%rip),%rax
mov    (%rax),%rcx
lea    0x989(%rip),%rdi
mov    $0x33,%esi
mov    $0x1,%edx
call   1150 <fwrite@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    0x2637(%rip),%rax
mov    (%rax),%rdi
mov    0x2625(%rip),%rax
mov    (%rax),%edx
lea    0x79a(%rip),%rsi
jmp    19d0 <main+0x770>
mov    0x261b(%rip),%rax
mov    (%rax),%rdi
mov    0x2609(%rip),%rax
mov    (%rax),%edx
lea    0x7a0(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
%struct.passwd = type { i64, i64 }
%struct.group = type { i64 }
@.str = [1 x i8] zeroinitializer
@stderr = global i32* null
@.str.1 = [42 x i8] c"Error: only root can execute %s, exiting\0A\00"
@RLIMIT_NOFILE = global i32 0
@.str.2 = [34 x i8] c"setrlimit() failed with errno=%d\0A\00"
@errno = global i32 0
@.str.3 = [34 x i8] c"getrlimit() failed with errno=%d\0A\00"
@.str.4 = [24 x i8] c"The soft limit is %llu\0A\00"
@.str.5 = [24 x i8] c"The hard limit is %llu\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [58 x i8] c"Error: unable to open %s for writing - pid file, exiting\0A\00"
@.str.8 = [39 x i8] c"Error: invalid username >%s<, exiting\0A\00"
@.str.9 = [40 x i8] c"Error: invalid groupname >%s<, exiting\0A\00"
@.str.10 = [21 x i8] c"uid = %ld gid = %ld\0A\00"
@.str.11 = [45 x i8] c"Error: chroot dir %s did not exist, exiting\0A\00"
@.str.12 = [40 x i8] c"Error: unable to chroot to %s, exiting\0A\00"
@.str.13 = [42 x i8] c"Error: unable to switch groupid, exiting\0A\00"
@.str.14 = [41 x i8] c"Error: unable to switch userid, exiting\0A\00"
@.str.15 = [52 x i8] c"Error: unable to change working directory, exiting\0A\00"
@.str.16 = [51 x i8] c"Error: Unable to create new processgroup, exiting\0A\00"
@.str.17 = [52 x i8] c"Error: unable to fork the wrapped process, exiting\0A\00"
@.str.18 = [19 x i8] c"PID of child = %d\0A\00"
@.str.19 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i32*
%23 = alloca i64
%24 = alloca i64
%25 = alloca %struct.rlimit
%26 = alloca %struct.passwd*
%27 = alloca %struct.group*
%28 = alloca i8*
%29 = alloca i8**
%30 = alloca [1 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %11
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %13
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %14
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %15
store i32 1, i32* %16
store i32 0, i32* %17
store i32* null, i32** %22
store i32 1, i32* %18
br label %31
31: ; preds = %129, %2
%32 = load i32, i32* %18
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %132
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = load i32, i32* %18
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
store i8* %40, i8** %21
%41 = load i8*, i8** %21
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %21
%43 = load i8, i8* %41
%44 = sext i8 %43 to i32
store i32 %44, i32* %20
%45 = load i32, i32* %20
%46 = icmp ne i32 %45, 45
br i1 %46, label %47, label %49
47: ; preds = %35
%48 = load i32, i32* %18
store i32 %48, i32* %16
br label %133
49: ; preds = %35
%50 = load i32, i32* %18
%51 = add nsw i32 %50, 1
%52 = load i32, i32* %4
%53 = icmp sge i32 %51, %52
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 (...) @usage()
br label %127
56: ; preds = %49
%57 = load i8*, i8** %21
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
store i32 %59, i32* %20
%60 = load i32, i32* %20
switch i32 %60, label %124 [
i32 82, label %61
i32 99, label %68
i32 117, label %75
i32 68, label %82
i32 103, label %85
i32 111, label %92
i32 79, label %99
i32 112, label %106
i32 105, label %113
i32 85, label %120
i32 45, label %121
]
61: ; preds = %56
%62 = load i8**, i8*** %5
%63 = load i32, i32* %18
%64 = add nsw i32 %63, 1
store i32 %64, i32* %18
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %62, i64 %65
%67 = load i8*, i8** %66
store i8* %67, i8** %8
br label %126
68: ; preds = %56
%69 = load i8**, i8*** %5
%70 = load i32, i32* %18
%71 = add nsw i32 %70, 1
store i32 %71, i32* %18
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %69, i64 %72
%74 = load i8*, i8** %73
store i8* %74, i8** %9
br label %126
75: ; preds = %56
%76 = load i8**, i8*** %5
%77 = load i32, i32* %18
%78 = add nsw i32 %77, 1
store i32 %78, i32* %18
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %76, i64 %79
%81 = load i8*, i8** %80
store i8* %81, i8** %10
br label %126
82: ; preds = %56
%83 = load i32, i32* %7
%84 = add nsw i32 %83, 1
store i32 %84, i32* %7
br label %126
85: ; preds = %56
%86 = load i8**, i8*** %5
%87 = load i32, i32* %18
%88 = add nsw i32 %87, 1
store i32 %88, i32* %18
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8*, i8** %86, i64 %89
%91 = load i8*, i8** %90
store i8* %91, i8** %11
br label %126
92: ; preds = %56
%93 = load i8**, i8*** %5
%94 = load i32, i32* %18
%95 = add nsw i32 %94, 1
store i32 %95, i32* %18
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8*, i8** %93, i64 %96
%98 = load i8*, i8** %97
store i8* %98, i8** %12
br label %126
99: ; preds = %56
%100 = load i8**, i8*** %5
%101 = load i32, i32* %18
%102 = add nsw i32 %101, 1
store i32 %102, i32* %18
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8*, i8** %100, i64 %103
%105 = load i8*, i8** %104
store i8* %105, i8** %13
br label %126
106: ; preds = %56
%107 = load i8**, i8*** %5
%108 = load i32, i32* %18
%109 = add nsw i32 %108, 1
store i32 %109, i32* %18
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8*, i8** %107, i64 %110
%112 = load i8*, i8** %111
store i8* %112, i8** %15
br label %126
113: ; preds = %56
%114 = load i8**, i8*** %5
%115 = load i32, i32* %18
%116 = add nsw i32 %115, 1
store i32 %116, i32* %18
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8*, i8** %114, i64 %117
%119 = load i8*, i8** %118
store i8* %119, i8** %14
br label %126
120: ; preds = %56
store i32 1, i32* %17
br label %126
121: ; preds = %56
%122 = load i32, i32* %18
%123 = add nsw i32 %122, 1
store i32 %123, i32* %18
store i32 %123, i32* %16
br label %133
124: ; preds = %56
%125 = call i32 (...) @usage()
br label %126
126: ; preds = %124, %120, %113, %106, %99, %92, %85, %82, %75, %68, %61
br label %127
127: ; preds = %126, %54
br label %128
128: ; preds = %127
br label %129
129: ; preds = %128
%130 = load i32, i32* %18
%131 = add nsw i32 %130, 1
store i32 %131, i32* %18
br label %31
132: ; preds = %31
br label %133
133: ; preds = %132, %121, %47
%134 = call i64 (...) @getuid()
%135 = icmp ne i64 %134, 0
br i1 %135, label %136, label %143
136: ; preds = %133
%137 = load i32*, i32** @stderr
%138 = load i8**, i8*** %5
%139 = getelementptr inbounds i8*, i8** %138, i64 0
%140 = load i8*, i8** %139
%141 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %140)
%142 = call i32 @exit(i32 1)
unreachable
143: ; preds = %133
%144 = load i32, i32* %17
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %179
146: ; preds = %143
%147 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %25, i32 0, i32 0
store i32 65535, i32* %147
%148 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %25, i32 0, i32 1
store i32 65535, i32* %148
%149 = load i32, i32* @RLIMIT_NOFILE
%150 = call i64 @setrlimit(i32 %149, %struct.rlimit* %25)
%151 = icmp ne i64 %150, 0
br i1 %151, label %152, label %157
152: ; preds = %146
%153 = load i32*, i32** @stderr
%154 = load i32, i32* @errno
%155 = call i32 (i32*, i8*, ...) @fprintf(i32* %153, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %154)
%156 = call i32 @exit(i32 1)
unreachable
157: ; preds = %146
%158 = load i32, i32* @RLIMIT_NOFILE
%159 = call i64 @getrlimit(i32 %158, %struct.rlimit* %25)
%160 = icmp ne i64 %159, 0
br i1 %160, label %161, label %166
161: ; preds = %157
%162 = load i32*, i32** @stderr
%163 = load i32, i32* @errno
%164 = call i32 (i32*, i8*, ...) @fprintf(i32* %162, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %163)
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %157
%167 = load i32, i32* %7
%168 = icmp ne i32 %167, 0
br i1 %168, label %169, label %178
169: ; preds = %166
%170 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %25, i32 0, i32 0
%171 = load i32, i32* %170
%172 = sext i32 %171 to i64
%173 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %172)
%174 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %25, i32 0, i32 1
%175 = load i32, i32* %174
%176 = sext i32 %175 to i64
%177 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i64 %176)
br label %178
178: ; preds = %169, %166
br label %179
179: ; preds = %178, %143
%180 = load i8*, i8** %15
%181 = call i64 @strcmp(i8* %180, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%182 = icmp ne i64 %181, 0
br i1 %182, label %183, label %193
183: ; preds = %179
%184 = load i8*, i8** %15
%185 = call i32* @fopen(i8* %184, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %185, i32** %22
%186 = icmp eq i32* %185, null
br i1 %186, label %187, label %192
187: ; preds = %183
%188 = load i32*, i32** @stderr
%189 = load i8*, i8** %15
%190 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i8* %189)
%191 = call i32 @exit(i32 1)
unreachable
192: ; preds = %183
br label %193
193: ; preds = %192, %179
store i64 0, i64* %23
store i64 0, i64* %24
%194 = load i8*, i8** %10
%195 = call i64 @strcmp(i8* %194, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%196 = icmp ne i64 %195, 0
br i1 %196, label %197, label %214
197: ; preds = %193
%198 = load i8*, i8** %10
%199 = call %struct.passwd* @getpwnam(i8* %198)
store %struct.passwd* %199, %struct.passwd** %26
%200 = load %struct.passwd*, %struct.passwd** %26
%201 = icmp eq %struct.passwd* %200, null
br i1 %201, label %202, label %207
202: ; preds = %197
%203 = load i32*, i32** @stderr
%204 = load i8*, i8** %10
%205 = call i32 (i32*, i8*, ...) @fprintf(i32* %203, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %204)
%206 = call i32 @exit(i32 1)
unreachable
207: ; preds = %197
%208 = load %struct.passwd*, %struct.passwd** %26
%209 = getelementptr inbounds %struct.passwd, %struct.passwd* %208, i32 0, i32 1
%210 = load i64, i64* %209
store i64 %210, i64* %23
%211 = load %struct.passwd*, %struct.passwd** %26
%212 = getelementptr inbounds %struct.passwd, %struct.passwd* %211, i32 0, i32 0
%213 = load i64, i64* %212
store i64 %213, i64* %24
br label %214
214: ; preds = %207, %193
%215 = load i8*, i8** %11
%216 = call i64 @strcmp(i8* %215, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%217 = icmp ne i64 %216, 0
br i1 %217, label %218, label %232
218: ; preds = %214
%219 = load i8*, i8** %11
%220 = call %struct.group* @getgrnam(i8* %219)
store %struct.group* %220, %struct.group** %27
%221 = load %struct.group*, %struct.group** %27
%222 = icmp eq %struct.group* %221, null
br i1 %222, label %223, label %228
223: ; preds = %218
%224 = load i32*, i32** @stderr
%225 = load i8*, i8** %11
%226 = call i32 (i32*, i8*, ...) @fprintf(i32* %224, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %225)
%227 = call i32 @exit(i32 1)
unreachable
228: ; preds = %218
%229 = load %struct.group*, %struct.group** %27
%230 = getelementptr inbounds %struct.group, %struct.group* %229, i32 0, i32 0
%231 = load i64, i64* %230
store i64 %231, i64* %24
br label %232
232: ; preds = %228, %214
%233 = load i32, i32* %7
%234 = icmp ne i32 %233, 0
br i1 %234, label %235, label %239
235: ; preds = %232
%236 = load i64, i64* %23
%237 = load i64, i64* %24
%238 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i64 %236, i64 %237)
br label %239
239: ; preds = %235, %232
%240 = load i8*, i8** %8
%241 = call i64 @strcmp(i8* %240, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%242 = icmp ne i64 %241, 0
br i1 %242, label %243, label %262
243: ; preds = %239
%244 = load i8*, i8** %8
%245 = call i64 @chdir(i8* %244)
%246 = icmp ne i64 %245, 0
br i1 %246, label %247, label %252
247: ; preds = %243
%248 = load i32*, i32** @stderr
%249 = load i8*, i8** %8
%250 = call i32 (i32*, i8*, ...) @fprintf(i32* %248, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i8* %249)
%251 = call i32 @exit(i32 1)
unreachable
252: ; preds = %243
%253 = load i8*, i8** %8
%254 = call i64 @chroot(i8* %253)
%255 = icmp ne i64 %254, 0
br i1 %255, label %256, label %261
256: ; preds = %252
%257 = load i32*, i32** @stderr
%258 = load i8*, i8** %8
%259 = call i32 (i32*, i8*, ...) @fprintf(i32* %257, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i64 0, i64 0), i8* %258)
%260 = call i32 @exit(i32 1)
unreachable
261: ; preds = %252
br label %262
262: ; preds = %261, %239
%263 = load i64, i64* %24
%264 = call i32 @setgid(i64 %263)
%265 = icmp eq i32 %264, -1
br i1 %265, label %266, label %270
266: ; preds = %262
%267 = load i32*, i32** @stderr
%268 = call i32 (i32*, i8*, ...) @fprintf(i32* %267, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0))
%269 = call i32 @exit(i32 1)
unreachable
270: ; preds = %262
%271 = load i64, i64* %23
%272 = call i32 @setuid(i64 %271)
%273 = icmp eq i32 %272, -1
br i1 %273, label %274, label %278
274: ; preds = %270
%275 = load i32*, i32** @stderr
%276 = call i32 (i32*, i8*, ...) @fprintf(i32* %275, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0))
%277 = call i32 @exit(i32 1)
unreachable
278: ; preds = %270
%279 = call i32 (...) @fork()
store i32 %279, i32* %6
%280 = load i32, i32* %6
%281 = icmp eq i32 %280, 0
br i1 %281, label %282, label %348
282: ; preds = %278
%283 = load i8*, i8** %9
%284 = call i64 @strcmp(i8* %283, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%285 = icmp ne i64 %284, 0
br i1 %285, label %286, label %295
286: ; preds = %282
%287 = load i8*, i8** %9
%288 = call i64 @chdir(i8* %287)
%289 = icmp ne i64 %288, 0
br i1 %289, label %290, label %294
290: ; preds = %286
%291 = load i32*, i32** @stderr
%292 = call i32 (i32*, i8*, ...) @fprintf(i32* %291, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.15, i64 0, i64 0))
%293 = call i32 @exit(i32 1)
unreachable
294: ; preds = %286
br label %295
295: ; preds = %294, %282
%296 = call i32 (...) @setsid()
%297 = icmp eq i32 %296, -1
br i1 %297, label %298, label %302
298: ; preds = %295
%299 = load i32*, i32** @stderr
%300 = call i32 (i32*, i8*, ...) @fprintf(i32* %299, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0))
%301 = call i32 @exit(i32 1)
unreachable
302: ; preds = %295
%303 = load i8*, i8** %12
%304 = load i8*, i8** %13
%305 = load i8*, i8** %14
%306 = call i32 @stdIOfiles(i8* %303, i8* %304, i8* %305)
%307 = load i8**, i8*** %5
%308 = load i32, i32* %16
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds i8*, i8** %307, i64 %309
%311 = load i8*, i8** %310
store i8* %311, i8** %28
%312 = load i32, i32* %4
%313 = sext i32 %312 to i64
%314 = mul i64 %313, 8
%315 = trunc i64 %314 to i32
%316 = call i64 @malloc(i32 %315)
%317 = inttoptr i64 %316 to i8**
store i8** %317, i8*** %29
%318 = load i32, i32* %16
store i32 %318, i32* %18
store i32 0, i32* %19
br label %319
319: ; preds = %333, %302
%320 = load i32, i32* %18
%321 = load i32, i32* %4
%322 = icmp slt i32 %320, %321
br i1 %322, label %323, label %338
323: ; preds = %319
%324 = load i8**, i8*** %5
%325 = load i32, i32* %18
%326 = sext i32 %325 to i64
%327 = getelementptr inbounds i8*, i8** %324, i64 %326
%328 = load i8*, i8** %327
%329 = load i8**, i8*** %29
%330 = load i32, i32* %19
%331 = sext i32 %330 to i64
%332 = getelementptr inbounds i8*, i8** %329, i64 %331
store i8* %328, i8** %332
br label %333
333: ; preds = %323
%334 = load i32, i32* %18
%335 = add nsw i32 %334, 1
store i32 %335, i32* %18
%336 = load i32, i32* %19
%337 = add nsw i32 %336, 1
store i32 %337, i32* %19
br label %319
338: ; preds = %319
%339 = load i8**, i8*** %29
%340 = load i32, i32* %19
%341 = sext i32 %340 to i64
%342 = getelementptr inbounds i8*, i8** %339, i64 %341
store i8* null, i8** %342
%343 = getelementptr inbounds [1 x i8*], [1 x i8*]* %30, i64 0, i64 0
store i8* null, i8** %343
%344 = load i8*, i8** %28
%345 = load i8**, i8*** %29
%346 = getelementptr inbounds [1 x i8*], [1 x i8*]* %30, i64 0, i64 0
%347 = call i32 @execve(i8* %344, i8** %345, i8** %346)
ret i32 %347
348: ; preds = %278
%349 = load i32, i32* %6
%350 = icmp eq i32 %349, -1
br i1 %350, label %351, label %355
351: ; preds = %348
%352 = load i32*, i32** @stderr
%353 = call i32 (i32*, i8*, ...) @fprintf(i32* %352, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.17, i64 0, i64 0))
%354 = call i32 @exit(i32 1)
unreachable
355: ; preds = %348
br label %356
356: ; preds = %355
%357 = load i32*, i32** @stderr
%358 = load i32, i32* %6
%359 = call i32 (i32*, i8*, ...) @fprintf(i32* %357, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i32 %358)
%360 = load i32*, i32** %22
%361 = icmp ne i32* %360, null
br i1 %361, label %362, label %369
362: ; preds = %356
%363 = load i32*, i32** %22
%364 = load i32, i32* %6
%365 = sext i32 %364 to i64
%366 = call i32 (i32*, i8*, ...) @fprintf(i32* %363, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i64 %365)
%367 = load i32*, i32** %22
%368 = call i32 @fclose(i32* %367)
br label %369
369: ; preds = %362, %356
%370 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
%struct.passwd = type { i64, i64 }
%struct.group = type { i64 }
@.str = [1 x i8] zeroinitializer
@stderr = global i32* null
@.str.1 = [42 x i8] c"Error: only root can execute %s, exiting\0A\00"
@RLIMIT_NOFILE = global i32 0
@.str.2 = [34 x i8] c"setrlimit() failed with errno=%d\0A\00"
@errno = global i32 0
@.str.3 = [34 x i8] c"getrlimit() failed with errno=%d\0A\00"
@.str.4 = [24 x i8] c"The soft limit is %llu\0A\00"
@.str.5 = [24 x i8] c"The hard limit is %llu\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [58 x i8] c"Error: unable to open %s for writing - pid file, exiting\0A\00"
@.str.8 = [39 x i8] c"Error: invalid username >%s<, exiting\0A\00"
@.str.9 = [40 x i8] c"Error: invalid groupname >%s<, exiting\0A\00"
@.str.10 = [21 x i8] c"uid = %ld gid = %ld\0A\00"
@.str.11 = [45 x i8] c"Error: chroot dir %s did not exist, exiting\0A\00"
@.str.12 = [40 x i8] c"Error: unable to chroot to %s, exiting\0A\00"
@.str.13 = [42 x i8] c"Error: unable to switch groupid, exiting\0A\00"
@.str.14 = [41 x i8] c"Error: unable to switch userid, exiting\0A\00"
@.str.15 = [52 x i8] c"Error: unable to change working directory, exiting\0A\00"
@.str.16 = [51 x i8] c"Error: Unable to create new processgroup, exiting\0A\00"
@.str.17 = [52 x i8] c"Error: unable to fork the wrapped process, exiting\0A\00"
@.str.18 = [19 x i8] c"PID of child = %d\0A\00"
@.str.19 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.rlimit
%4 = alloca [1 x i8*]
%5 = bitcast %struct.rlimit* %3 to i8*
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %97
7: ; preds = %2, %69
%8 = phi i32 [ %80, %69 ], [ 0, %2 ]
%9 = phi i8* [ %79, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%10 = phi i8* [ %78, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%11 = phi i8* [ %77, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%12 = phi i32 [ %81, %69 ], [ 1, %2 ]
%13 = phi i32 [ %75, %69 ], [ 0, %2 ]
%14 = phi i8* [ %74, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%15 = phi i8* [ %73, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%16 = phi i8* [ %72, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%17 = phi i8* [ %71, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%18 = phi i8* [ %70, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%19 = sext i32 %12 to i64
%20 = getelementptr inbounds i8*, i8** %1, i64 %19
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %21
%24 = icmp eq i8 %23, 45
br i1 %24, label %25, label %83
25: ; preds = %7
%26 = add nsw i32 %12, 1
%27 = icmp slt i32 %26, %0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 (...) @usage()
br label %69
30: ; preds = %25
%31 = load i8, i8* %22
%32 = sext i8 %31 to i32
switch i32 %32, label %67 [
i32 82, label %33
i32 99, label %37
i32 117, label %41
i32 68, label %45
i32 103, label %47
i32 111, label %51
i32 79, label %55
i32 112, label %59
i32 105, label %63
i32 85, label %69
i32 45, label %83
]
33: ; preds = %30
%34 = sext i32 %26 to i64
%35 = getelementptr inbounds i8*, i8** %1, i64 %34
%36 = load i8*, i8** %35
br label %69
37: ; preds = %30
%38 = sext i32 %26 to i64
%39 = getelementptr inbounds i8*, i8** %1, i64 %38
%40 = load i8*, i8** %39
br label %69
41: ; preds = %30
%42 = sext i32 %26 to i64
%43 = getelementptr inbounds i8*, i8** %1, i64 %42
%44 = load i8*, i8** %43
br label %69
45: ; preds = %30
%46 = add nsw i32 %8, 1
br label %69
47: ; preds = %30
%48 = sext i32 %26 to i64
%49 = getelementptr inbounds i8*, i8** %1, i64 %48
%50 = load i8*, i8** %49
br label %69
51: ; preds = %30
%52 = sext i32 %26 to i64
%53 = getelementptr inbounds i8*, i8** %1, i64 %52
%54 = load i8*, i8** %53
br label %69
55: ; preds = %30
%56 = sext i32 %26 to i64
%57 = getelementptr inbounds i8*, i8** %1, i64 %56
%58 = load i8*, i8** %57
br label %69
59: ; preds = %30
%60 = sext i32 %26 to i64
%61 = getelementptr inbounds i8*, i8** %1, i64 %60
%62 = load i8*, i8** %61
br label %69
63: ; preds = %30
%64 = sext i32 %26 to i64
%65 = getelementptr inbounds i8*, i8** %1, i64 %64
%66 = load i8*, i8** %65
br label %69
67: ; preds = %30
%68 = tail call i32 (...) @usage()
br label %69
69: ; preds = %30, %33, %37, %41, %45, %47, %51, %55, %59, %63, %67, %28
%70 = phi i8* [ %18, %28 ], [ %18, %67 ], [ %18, %63 ], [ %18, %59 ], [ %18, %55 ], [ %18, %51 ], [ %50, %47 ], [ %18, %45 ], [ %18, %41 ], [ %18, %37 ], [ %18, %33 ], [ %18, %30 ]
%71 = phi i8* [ %17, %28 ], [ %17, %67 ], [ %17, %63 ], [ %17, %59 ], [ %17, %55 ], [ %54, %51 ], [ %17, %47 ], [ %17, %45 ], [ %17, %41 ], [ %17, %37 ], [ %17, %33 ], [ %17, %30 ]
%72 = phi i8* [ %16, %28 ], [ %16, %67 ], [ %16, %63 ], [ %16, %59 ], [ %58, %55 ], [ %16, %51 ], [ %16, %47 ], [ %16, %45 ], [ %16, %41 ], [ %16, %37 ], [ %16, %33 ], [ %16, %30 ]
%73 = phi i8* [ %15, %28 ], [ %15, %67 ], [ %66, %63 ], [ %15, %59 ], [ %15, %55 ], [ %15, %51 ], [ %15, %47 ], [ %15, %45 ], [ %15, %41 ], [ %15, %37 ], [ %15, %33 ], [ %15, %30 ]
%74 = phi i8* [ %14, %28 ], [ %14, %67 ], [ %14, %63 ], [ %62, %59 ], [ %14, %55 ], [ %14, %51 ], [ %14, %47 ], [ %14, %45 ], [ %14, %41 ], [ %14, %37 ], [ %14, %33 ], [ %14, %30 ]
%75 = phi i32 [ %13, %28 ], [ %13, %67 ], [ %13, %63 ], [ %13, %59 ], [ %13, %55 ], [ %13, %51 ], [ %13, %47 ], [ %13, %45 ], [ %13, %41 ], [ %13, %37 ], [ %13, %33 ], [ 1, %30 ]
%76 = phi i32 [ %12, %28 ], [ %12, %67 ], [ %26, %63 ], [ %26, %59 ], [ %26, %55 ], [ %26, %51 ], [ %26, %47 ], [ %12, %45 ], [ %26, %41 ], [ %26, %37 ], [ %26, %33 ], [ %12, %30 ]
%77 = phi i8* [ %11, %28 ], [ %11, %67 ], [ %11, %63 ], [ %11, %59 ], [ %11, %55 ], [ %11, %51 ], [ %11, %47 ], [ %11, %45 ], [ %44, %41 ], [ %11, %37 ], [ %11, %33 ], [ %11, %30 ]
%78 = phi i8* [ %10, %28 ], [ %10, %67 ], [ %10, %63 ], [ %10, %59 ], [ %10, %55 ], [ %10, %51 ], [ %10, %47 ], [ %10, %45 ], [ %10, %41 ], [ %40, %37 ], [ %10, %33 ], [ %10, %30 ]
%79 = phi i8* [ %9, %28 ], [ %9, %67 ], [ %9, %63 ], [ %9, %59 ], [ %9, %55 ], [ %9, %51 ], [ %9, %47 ], [ %9, %45 ], [ %9, %41 ], [ %9, %37 ], [ %36, %33 ], [ %9, %30 ]
%80 = phi i32 [ %8, %28 ], [ %8, %67 ], [ %8, %63 ], [ %8, %59 ], [ %8, %55 ], [ %8, %51 ], [ %8, %47 ], [ %46, %45 ], [ %8, %41 ], [ %8, %37 ], [ %8, %33 ], [ %8, %30 ]
%81 = add nsw i32 %76, 1
%82 = icmp slt i32 %81, %0
br i1 %82, label %7, label %83
83: ; preds = %69, %7, %30
%84 = phi i8* [ %70, %69 ], [ %18, %7 ], [ %18, %30 ]
%85 = phi i8* [ %71, %69 ], [ %17, %7 ], [ %17, %30 ]
%86 = phi i8* [ %72, %69 ], [ %16, %7 ], [ %16, %30 ]
%87 = phi i8* [ %73, %69 ], [ %15, %7 ], [ %15, %30 ]
%88 = phi i8* [ %74, %69 ], [ %14, %7 ], [ %14, %30 ]
%89 = phi i32 [ %75, %69 ], [ %13, %7 ], [ %13, %30 ]
%90 = phi i8* [ %77, %69 ], [ %11, %7 ], [ %11, %30 ]
%91 = phi i8* [ %78, %69 ], [ %10, %7 ], [ %10, %30 ]
%92 = phi i8* [ %79, %69 ], [ %9, %7 ], [ %9, %30 ]
%93 = phi i32 [ %80, %69 ], [ %8, %7 ], [ %8, %30 ]
%94 = phi i32 [ 1, %69 ], [ %12, %7 ], [ %26, %30 ]
%95 = tail call i64 (...) @getuid()
%96 = icmp eq i64 %95, 0
br i1 %96, label %105, label %100
97: ; preds = %2
%98 = tail call i64 (...) @getuid()
%99 = icmp eq i64 %98, 0
br i1 %99, label %136, label %100
100: ; preds = %97, %83
%101 = load i32*, i32** @stderr
%102 = load i8*, i8** %1
%103 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %102)
%104 = tail call i32 @exit(i32 1)
unreachable
105: ; preds = %83
%106 = icmp eq i32 %89, 0
br i1 %106, label %136, label %107
107: ; preds = %105
%108 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 0
store i32 65535, i32* %108
%109 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 1
store i32 65535, i32* %109
%110 = load i32, i32* @RLIMIT_NOFILE
%111 = call i64 @setrlimit(i32 %110, %struct.rlimit* %3)
%112 = icmp eq i64 %111, 0
br i1 %112, label %118, label %113
113: ; preds = %107
%114 = load i32*, i32** @stderr
%115 = load i32, i32* @errno
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %114, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %115)
%117 = call i32 @exit(i32 1)
unreachable
118: ; preds = %107
%119 = load i32, i32* @RLIMIT_NOFILE
%120 = call i64 @getrlimit(i32 %119, %struct.rlimit* %3)
%121 = icmp eq i64 %120, 0
br i1 %121, label %127, label %122
122: ; preds = %118
%123 = load i32*, i32** @stderr
%124 = load i32, i32* @errno
%125 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %124)
%126 = call i32 @exit(i32 1)
unreachable
127: ; preds = %118
%128 = icmp eq i32 %93, 0
br i1 %128, label %136, label %129
129: ; preds = %127
%130 = load i32, i32* %108
%131 = sext i32 %130 to i64
%132 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %131)
%133 = load i32, i32* %109
%134 = sext i32 %133 to i64
%135 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i64 %134)
br label %136
136: ; preds = %97, %127, %129, %105
%137 = phi i8* [ %84, %127 ], [ %84, %129 ], [ %84, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%138 = phi i8* [ %85, %127 ], [ %85, %129 ], [ %85, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%139 = phi i8* [ %86, %127 ], [ %86, %129 ], [ %86, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%140 = phi i8* [ %87, %127 ], [ %87, %129 ], [ %87, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%141 = phi i8* [ %88, %127 ], [ %88, %129 ], [ %88, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%142 = phi i8* [ %90, %127 ], [ %90, %129 ], [ %90, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%143 = phi i8* [ %91, %127 ], [ %91, %129 ], [ %91, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%144 = phi i8* [ %92, %127 ], [ %92, %129 ], [ %92, %105 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %97 ]
%145 = phi i32 [ 0, %127 ], [ 1, %129 ], [ %93, %105 ], [ 0, %97 ]
%146 = phi i32 [ %94, %127 ], [ %94, %129 ], [ %94, %105 ], [ 1, %97 ]
%147 = call i64 @strcmp(i8* %141, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%148 = icmp eq i64 %147, 0
br i1 %148, label %156, label %149
149: ; preds = %136
%150 = call i32* @fopen(i8* %141, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%151 = icmp eq i32* %150, null
br i1 %151, label %152, label %156
152: ; preds = %149
%153 = load i32*, i32** @stderr
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %153, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i8* %141)
%155 = call i32 @exit(i32 1)
unreachable
156: ; preds = %149, %136
%157 = phi i32* [ %150, %149 ], [ null, %136 ]
%158 = call i64 @strcmp(i8* %142, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%159 = icmp eq i64 %158, 0
br i1 %159, label %172, label %160
160: ; preds = %156
%161 = call %struct.passwd* @getpwnam(i8* %142)
%162 = icmp eq %struct.passwd* %161, null
br i1 %162, label %163, label %167
163: ; preds = %160
%164 = load i32*, i32** @stderr
%165 = call i32 (i32*, i8*, ...) @fprintf(i32* %164, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %142)
%166 = call i32 @exit(i32 1)
unreachable
167: ; preds = %160
%168 = getelementptr inbounds %struct.passwd, %struct.passwd* %161, i64 0, i32 1
%169 = load i64, i64* %168
%170 = getelementptr inbounds %struct.passwd, %struct.passwd* %161, i64 0, i32 0
%171 = load i64, i64* %170
br label %172
172: ; preds = %167, %156
%173 = phi i64 [ %169, %167 ], [ 0, %156 ]
%174 = phi i64 [ %171, %167 ], [ 0, %156 ]
%175 = call i64 @strcmp(i8* %137, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%176 = icmp eq i64 %175, 0
br i1 %176, label %187, label %177
177: ; preds = %172
%178 = call %struct.group* @getgrnam(i8* %137)
%179 = icmp eq %struct.group* %178, null
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 ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %137)
%183 = call i32 @exit(i32 1)
unreachable
184: ; preds = %177
%185 = getelementptr inbounds %struct.group, %struct.group* %178, i64 0, i32 0
%186 = load i64, i64* %185
br label %187
187: ; preds = %184, %172
%188 = phi i64 [ %186, %184 ], [ %174, %172 ]
%189 = icmp eq i32 %145, 0
br i1 %189, label %192, label %190
190: ; preds = %187
%191 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i64 %173, i64 %188)
br label %192
192: ; preds = %190, %187
%193 = call i64 @strcmp(i8* %144, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%194 = icmp eq i64 %193, 0
br i1 %194, label %209, label %195
195: ; preds = %192
%196 = call i64 @chdir(i8* %144)
%197 = icmp eq i64 %196, 0
br i1 %197, label %202, label %198
198: ; preds = %195
%199 = load i32*, i32** @stderr
%200 = call i32 (i32*, i8*, ...) @fprintf(i32* %199, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i8* %144)
%201 = call i32 @exit(i32 1)
unreachable
202: ; preds = %195
%203 = call i64 @chroot(i8* %144)
%204 = icmp eq i64 %203, 0
br i1 %204, label %209, label %205
205: ; preds = %202
%206 = load i32*, i32** @stderr
%207 = call i32 (i32*, i8*, ...) @fprintf(i32* %206, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i64 0, i64 0), i8* %144)
%208 = call i32 @exit(i32 1)
unreachable
209: ; preds = %202, %192
%210 = call i32 @setgid(i64 %188)
%211 = icmp eq i32 %210, -1
br i1 %211, label %212, label %216
212: ; preds = %209
%213 = load i32*, i32** @stderr
%214 = call i64 @fwrite(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i64 41, i64 1, i32* %213)
%215 = call i32 @exit(i32 1)
unreachable
216: ; preds = %209
%217 = call i32 @setuid(i64 %173)
%218 = icmp eq i32 %217, -1
br i1 %218, label %219, label %223
219: ; preds = %216
%220 = load i32*, i32** @stderr
%221 = call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0), i64 40, i64 1, i32* %220)
%222 = call i32 @exit(i32 1)
unreachable
223: ; preds = %216
%224 = call i32 (...) @fork()
switch i32 %224, label %408 [
i32 0, label %225
i32 -1, label %404
]
225: ; preds = %223
%226 = call i64 @strcmp(i8* %143, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%227 = icmp eq i64 %226, 0
br i1 %227, label %235, label %228
228: ; preds = %225
%229 = call i64 @chdir(i8* %143)
%230 = icmp eq i64 %229, 0
br i1 %230, label %235, label %231
231: ; preds = %228
%232 = load i32*, i32** @stderr
%233 = call i64 @fwrite(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.15, i64 0, i64 0), i64 51, i64 1, i32* %232)
%234 = call i32 @exit(i32 1)
unreachable
235: ; preds = %228, %225
%236 = call i32 (...) @setsid()
%237 = icmp eq i32 %236, -1
br i1 %237, label %238, label %242
238: ; preds = %235
%239 = load i32*, i32** @stderr
%240 = call i64 @fwrite(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0), i64 50, i64 1, i32* %239)
%241 = call i32 @exit(i32 1)
unreachable
242: ; preds = %235
%243 = call i32 @stdIOfiles(i8* %138, i8* %139, i8* %140)
%244 = sext i32 %146 to i64
%245 = getelementptr inbounds i8*, i8** %1, i64 %244
%246 = load i8*, i8** %245
%247 = shl i32 %0, 3
%248 = call i64 @malloc(i32 %247)
%249 = inttoptr i64 %248 to i8**
%250 = inttoptr i64 %248 to i8*
%251 = icmp slt i32 %146, %0
br i1 %251, label %252, label %398
252: ; preds = %242
%253 = sub i32 %0, %146
%254 = zext i32 %253 to i64
%255 = icmp ult i32 %253, 4
br i1 %255, label %350, label %256
256: ; preds = %252
%257 = getelementptr i8*, i8** %249, i64 %254
%258 = getelementptr i8*, i8** %1, i64 %244
%259 = add nsw i64 %244, %254
%260 = getelementptr i8*, i8** %1, i64 %259
%261 = bitcast i8** %260 to i8*
%262 = icmp ult i8* %250, %261
%263 = icmp ult i8** %258, %257
%264 = and i1 %262, %263
br i1 %264, label %350, label %265
265: ; preds = %256
%266 = and i64 %254, 4294967292
%267 = add nsw i64 %266, %244
%268 = add nsw i64 %266, -4
%269 = lshr exact i64 %268, 2
%270 = add nuw nsw i64 %269, 1
%271 = and i64 %270, 3
%272 = icmp ult i64 %268, 12
br i1 %272, label %328, label %273
273: ; preds = %265
%274 = and i64 %270, 9223372036854775804
br label %275
275: ; preds = %275, %273
%276 = phi i64 [ 0, %273 ], [ %325, %275 ]
%277 = phi i64 [ 0, %273 ], [ %326, %275 ]
%278 = add i64 %276, %244
%279 = getelementptr inbounds i8*, i8** %1, i64 %278
%280 = bitcast i8** %279 to <2 x i8*>*
%281 = load <2 x i8*>, <2 x i8*>* %280
%282 = getelementptr inbounds i8*, i8** %279, i64 2
%283 = bitcast i8** %282 to <2 x i8*>*
%284 = load <2 x i8*>, <2 x i8*>* %283
%285 = getelementptr inbounds i8*, i8** %249, i64 %276
%286 = bitcast i8** %285 to <2 x i8*>*
store <2 x i8*> %281, <2 x i8*>* %286
%287 = getelementptr inbounds i8*, i8** %285, i64 2
%288 = bitcast i8** %287 to <2 x i8*>*
store <2 x i8*> %284, <2 x i8*>* %288
%289 = or i64 %276, 4
%290 = add i64 %289, %244
%291 = getelementptr inbounds i8*, i8** %1, i64 %290
%292 = bitcast i8** %291 to <2 x i8*>*
%293 = load <2 x i8*>, <2 x i8*>* %292
%294 = getelementptr inbounds i8*, i8** %291, i64 2
%295 = bitcast i8** %294 to <2 x i8*>*
%296 = load <2 x i8*>, <2 x i8*>* %295
%297 = getelementptr inbounds i8*, i8** %249, i64 %289
%298 = bitcast i8** %297 to <2 x i8*>*
store <2 x i8*> %293, <2 x i8*>* %298
%299 = getelementptr inbounds i8*, i8** %297, i64 2
%300 = bitcast i8** %299 to <2 x i8*>*
store <2 x i8*> %296, <2 x i8*>* %300
%301 = or i64 %276, 8
%302 = add i64 %301, %244
%303 = getelementptr inbounds i8*, i8** %1, i64 %302
%304 = bitcast i8** %303 to <2 x i8*>*
%305 = load <2 x i8*>, <2 x i8*>* %304
%306 = getelementptr inbounds i8*, i8** %303, i64 2
%307 = bitcast i8** %306 to <2 x i8*>*
%308 = load <2 x i8*>, <2 x i8*>* %307
%309 = getelementptr inbounds i8*, i8** %249, i64 %301
%310 = bitcast i8** %309 to <2 x i8*>*
store <2 x i8*> %305, <2 x i8*>* %310
%311 = getelementptr inbounds i8*, i8** %309, i64 2
%312 = bitcast i8** %311 to <2 x i8*>*
store <2 x i8*> %308, <2 x i8*>* %312
%313 = or i64 %276, 12
%314 = add i64 %313, %244
%315 = getelementptr inbounds i8*, i8** %1, i64 %314
%316 = bitcast i8** %315 to <2 x i8*>*
%317 = load <2 x i8*>, <2 x i8*>* %316
%318 = getelementptr inbounds i8*, i8** %315, i64 2
%319 = bitcast i8** %318 to <2 x i8*>*
%320 = load <2 x i8*>, <2 x i8*>* %319
%321 = getelementptr inbounds i8*, i8** %249, i64 %313
%322 = bitcast i8** %321 to <2 x i8*>*
store <2 x i8*> %317, <2 x i8*>* %322
%323 = getelementptr inbounds i8*, i8** %321, i64 2
%324 = bitcast i8** %323 to <2 x i8*>*
store <2 x i8*> %320, <2 x i8*>* %324
%325 = add nuw i64 %276, 16
%326 = add nuw i64 %277, 4
%327 = icmp eq i64 %326, %274
br i1 %327, label %328, label %275
328: ; preds = %275, %265
%329 = phi i64 [ 0, %265 ], [ %325, %275 ]
%330 = icmp eq i64 %271, 0
br i1 %330, label %348, label %331
331: ; preds = %328, %331
%332 = phi i64 [ %345, %331 ], [ %329, %328 ]
%333 = phi i64 [ %346, %331 ], [ 0, %328 ]
%334 = add i64 %332, %244
%335 = getelementptr inbounds i8*, i8** %1, i64 %334
%336 = bitcast i8** %335 to <2 x i8*>*
%337 = load <2 x i8*>, <2 x i8*>* %336
%338 = getelementptr inbounds i8*, i8** %335, i64 2
%339 = bitcast i8** %338 to <2 x i8*>*
%340 = load <2 x i8*>, <2 x i8*>* %339
%341 = getelementptr inbounds i8*, i8** %249, i64 %332
%342 = bitcast i8** %341 to <2 x i8*>*
store <2 x i8*> %337, <2 x i8*>* %342
%343 = getelementptr inbounds i8*, i8** %341, i64 2
%344 = bitcast i8** %343 to <2 x i8*>*
store <2 x i8*> %340, <2 x i8*>* %344
%345 = add nuw i64 %332, 4
%346 = add i64 %333, 1
%347 = icmp eq i64 %346, %271
br i1 %347, label %348, label %331
348: ; preds = %331, %328
%349 = icmp eq i64 %266, %254
br i1 %349, label %396, label %350
350: ; preds = %256, %252, %348
%351 = phi i64 [ %244, %256 ], [ %244, %252 ], [ %267, %348 ]
%352 = phi i64 [ 0, %256 ], [ 0, %252 ], [ %266, %348 ]
%353 = xor i64 %352, -1
%354 = add nsw i64 %353, %254
%355 = and i64 %254, 3
%356 = icmp eq i64 %355, 0
br i1 %356, label %368, label %357
357: ; preds = %350, %357
%358 = phi i64 [ %364, %357 ], [ %351, %350 ]
%359 = phi i64 [ %365, %357 ], [ %352, %350 ]
%360 = phi i64 [ %366, %357 ], [ 0, %350 ]
%361 = getelementptr inbounds i8*, i8** %1, i64 %358
%362 = load i8*, i8** %361
%363 = getelementptr inbounds i8*, i8** %249, i64 %359
store i8* %362, i8** %363
%364 = add nsw i64 %358, 1
%365 = add nuw nsw i64 %359, 1
%366 = add i64 %360, 1
%367 = icmp eq i64 %366, %355
br i1 %367, label %368, label %357
368: ; preds = %357, %350
%369 = phi i64 [ %351, %350 ], [ %364, %357 ]
%370 = phi i64 [ %352, %350 ], [ %365, %357 ]
%371 = icmp ult i64 %354, 3
br i1 %371, label %396, label %372
372: ; preds = %368, %372
%373 = phi i64 [ %393, %372 ], [ %369, %368 ]
%374 = phi i64 [ %394, %372 ], [ %370, %368 ]
%375 = getelementptr inbounds i8*, i8** %1, i64 %373
%376 = load i8*, i8** %375
%377 = getelementptr inbounds i8*, i8** %249, i64 %374
store i8* %376, i8** %377
%378 = add nsw i64 %373, 1
%379 = add nuw nsw i64 %374, 1
%380 = getelementptr inbounds i8*, i8** %1, i64 %378
%381 = load i8*, i8** %380
%382 = getelementptr inbounds i8*, i8** %249, i64 %379
store i8* %381, i8** %382
%383 = add nsw i64 %373, 2
%384 = add nuw nsw i64 %374, 2
%385 = getelementptr inbounds i8*, i8** %1, i64 %383
%386 = load i8*, i8** %385
%387 = getelementptr inbounds i8*, i8** %249, i64 %384
store i8* %386, i8** %387
%388 = add nsw i64 %373, 3
%389 = add nuw nsw i64 %374, 3
%390 = getelementptr inbounds i8*, i8** %1, i64 %388
%391 = load i8*, i8** %390
%392 = getelementptr inbounds i8*, i8** %249, i64 %389
store i8* %391, i8** %392
%393 = add nsw i64 %373, 4
%394 = add nuw nsw i64 %374, 4
%395 = icmp eq i64 %394, %254
br i1 %395, label %396, label %372
396: ; preds = %368, %372, %348
%397 = zext i32 %253 to i64
br label %398
398: ; preds = %242, %396
%399 = phi i64 [ %397, %396 ], [ 0, %242 ]
%400 = getelementptr inbounds i8*, i8** %249, i64 %399
store i8* null, i8** %400
%401 = bitcast [1 x i8*]* %4 to i8*
%402 = getelementptr inbounds [1 x i8*], [1 x i8*]* %4, i64 0, i64 0
store i8* null, i8** %402
%403 = call i32 @execve(i8* %246, i8** %249, i8** %402)
ret i32 %403
404: ; preds = %223
%405 = load i32*, i32** @stderr
%406 = call i64 @fwrite(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.17, i64 0, i64 0), i64 51, i64 1, i32* %405)
%407 = call i32 @exit(i32 1)
unreachable
408: ; preds = %223
%409 = load i32*, i32** @stderr
%410 = call i32 (i32*, i8*, ...) @fprintf(i32* %409, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i32 %224)
%411 = icmp eq i32* %157, null
br i1 %411, label %416, label %412
412: ; preds = %408
%413 = sext i32 %224 to i64
%414 = call i32 (i32*, i8*, ...) @fprintf(i32* %157, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i64 %413)
%415 = call i32 @fclose(i32* %157)
br label %416
416: ; preds = %412, %408
%417 = call i32 @exit(i32 0)
unreachable
}