#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 int uid_t;
struct passwd {
  int pw_uid;
};
struct group {
  int gr_gid;
};
typedef int gid_t;

/* Variables and functions */
int /*<<< orphan*/ Usage_and_abort(char *);
int atoi(char *);
int errno;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct group *getgrnam(char *);
int getopt(int, char **, char *);
struct passwd *getpwnam(char *);
int /*<<< orphan*/ isdigit(char);
scalar_t__ malloc(int);
char *optarg;
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int setgroups(int, int *);
int setregid(int, int);
int setreuid(int, int);
int /*<<< orphan*/ stderr;
char *strerror(int);
char *strsep(char **, char *);
int main(int argc, char **argv) {
  char **my_argv, *name = argv[0], *grp;
  int status, c, i;
  int gid_is_set = 0, uid_is_set = 0, num_supp = -1;
  uid_t user_id = 0;
  gid_t grp_id = 0, supp_groups[32] = {0};
  int euid_is_set = 0, egid_is_set = 0;
  uid_t euid = 0;
  gid_t egid = 0;
  if (argc == 1) {
    fprintf(stderr, "No parameter count\n");
    Usage_and_abort(name);
  }
  while ((c = getopt(argc, argv, "+u:g:v:j:hG::")) != -1) {
    switch (c) {
    case 'u':
      if (!isdigit(optarg[0])) {
        struct passwd *pw = getpwnam(optarg);
        if (pw == NULL) {
          fprintf(stderr, "parameter '%s' bad\n", optarg);
          Usage_and_abort(name);
        }
        user_id = pw->pw_uid;
      } else {
        user_id = (uid_t)atoi(optarg);
      }
      uid_is_set = 1;
      if (!gid_is_set)
        grp_id = user_id;
      break;
    case 'g':
      if (!isdigit(optarg[0])) {
        struct group *gr = getgrnam(optarg);
        if (gr == NULL) {
          fprintf(stderr, "getgrname %s failed\n", optarg);
          Usage_and_abort(name);
        }
        grp_id = gr->gr_gid;
      } else {
        grp_id = (gid_t)atoi(optarg);
      }
      gid_is_set = 1;
      break;
    case 'v':
      if (!isdigit(optarg[0])) {
        struct passwd *pw = getpwnam(optarg);
        if (pw == NULL) {
          fprintf(stderr, "parameter '%s' bad\n", optarg);
          Usage_and_abort(name);
        }
        euid = pw->pw_uid;
      } else {
        euid = (uid_t)atoi(optarg);
      }
      euid_is_set = 1;
      break;
    case 'j':
      if (!isdigit(optarg[0])) {
        struct group *gr = getgrnam(optarg);
        if (gr == NULL) {
          fprintf(stderr, "getgrname %s failed\n", optarg);
          Usage_and_abort(name);
        }
        egid = gr->gr_gid;
      } else {
        egid = (gid_t)atoi(optarg);
      }
      egid_is_set = 1;
      break;
    case 'G':
      num_supp = 0;
      if (optarg == NULL || !isdigit(optarg[0]))
        break;
      while ((grp = strsep(&optarg, ",")) != NULL) {
        printf("adding supp group %d\n", atoi(grp));
        supp_groups[num_supp++] = atoi(grp);
        if (num_supp >= 32)
          break;
      }
      break;
    default:
    case 'h':
      Usage_and_abort(name);
      break;
    }
  }
  if (!uid_is_set) {
    fprintf(stderr, "Must specify uid to run.\n");
    Usage_and_abort(name);
  }
  if (optind == argc) {
    fprintf(stderr, "Must specify command to run.\n");
    Usage_and_abort(name);
  }
  my_argv = (char **)malloc(sizeof(char *) * (argc + 1 - optind));
  if (my_argv == NULL) {
    fprintf(stderr, "Error in allocating memory. (%s)\n", strerror(errno));
    exit(-1);
  }
  for (i = optind; i < argc; i++) {
    my_argv[i - optind] = argv[i];
  }
  my_argv[i - optind] = NULL;
  if (!egid_is_set)
    egid = grp_id;
  status = setregid(grp_id, egid);
  if (status == -1) {
    fprintf(stderr, "Cannot change gid to %d/%d, errno=%d (%s)\n", grp_id, egid,
            errno, strerror(errno));
    exit(-1);
  }
  if (num_supp >= 0) {
    status = setgroups(num_supp, supp_groups);
    if (status == -1) {
      perror("setting supplementary groups");
      exit(-1);
    }
  }
  if (!euid_is_set)
    euid = user_id;
  status = setreuid(user_id, euid);
  if (status == -1) {
    fprintf(stderr, "Cannot change uid to %d/%d, errno=%d (%s)\n", user_id,
            euid, errno, strerror(errno));
    exit(-1);
  }
  fprintf(stderr, "running as uid/gid/euid/egid %d/%d/%d/%d, groups:", user_id,
          grp_id, euid, egid);
  for (i = 0; i < num_supp; i++)
    fprintf(stderr, " %d", supp_groups[i]);
  fprintf(stderr, "\n");
  for (i = 0; i < argc - optind; i++)
    fprintf(stderr, " [%s]", my_argv[i]);
  fprintf(stderr, "\n");
  fflush(stderr);
  execvp(my_argv[0], my_argv);
  fprintf(stderr, "execvp fails running %s (%d): %s\n", my_argv[0], errno,
          strerror(errno));
  exit(-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0xffffffff,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xd8(%rbp)
movl   $0x0,-0xdc(%rbp)
movl   $0x0,-0xe0(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    12dc <main+0xac>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edi
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
jmp    12e1 <main+0xb1>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xde5(%rip),%rdx
call   1110 <getopt@plt>
mov    %eax,-0x30(%rbp)
cmp    $0xffffffff,%eax
je     1671 <main+0x441>
mov    -0x30(%rbp),%eax
add    $0xffffffb9,%eax
mov    %eax,%ecx
mov    %rcx,-0x108(%rbp)
sub    $0x2f,%eax
ja     165e <main+0x42e>
mov    -0x108(%rbp),%rax
lea    0xcda(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2cc2(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    13a9 <main+0x179>
mov    0x2ca7(%rip),%rax
mov    (%rax),%rdi
call   1080 <getpwnam@plt>
mov    %rax,-0xe8(%rbp)
cmpq   $0x0,-0xe8(%rbp)
jne    1398 <main+0x168>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
mov    0x2c7a(%rip),%rax
mov    (%rax),%rdx
lea    0xd5a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
mov    -0xe8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
jmp    13bb <main+0x18b>
mov    0x2c48(%rip),%rax
mov    (%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x44(%rbp)
movl   $0x1,-0x3c(%rbp)
cmpl   $0x0,-0x38(%rbp)
jne    13d2 <main+0x1a2>
mov    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    166c <main+0x43c>
mov    0x2c1a(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1451 <main+0x221>
mov    0x2bff(%rip),%rax
mov    (%rax),%rdi
call   10a0 <getgrnam@plt>
mov    %rax,-0xf0(%rbp)
cmpq   $0x0,-0xf0(%rbp)
jne    1440 <main+0x210>
mov    0x2bb3(%rip),%rax
mov    (%rax),%edi
mov    0x2bd2(%rip),%rax
mov    (%rax),%rdx
lea    0xcc6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
mov    -0xf0(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
jmp    1463 <main+0x233>
mov    0x2ba0(%rip),%rax
mov    (%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x48(%rbp)
movl   $0x1,-0x38(%rbp)
jmp    166c <main+0x43c>
mov    0x2b82(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    14ec <main+0x2bc>
mov    0x2b67(%rip),%rax
mov    (%rax),%rdi
call   1080 <getpwnam@plt>
mov    %rax,-0xf8(%rbp)
cmpq   $0x0,-0xf8(%rbp)
jne    14d8 <main+0x2a8>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
mov    0x2b3a(%rip),%rax
mov    (%rax),%rdx
lea    0xc1a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
mov    -0xf8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xdc(%rbp)
jmp    1501 <main+0x2d1>
mov    0x2b05(%rip),%rax
mov    (%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0xdc(%rbp)
movl   $0x1,-0xd4(%rbp)
jmp    166c <main+0x43c>
mov    0x2ae1(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    158d <main+0x35d>
mov    0x2ac6(%rip),%rax
mov    (%rax),%rdi
call   10a0 <getgrnam@plt>
mov    %rax,-0x100(%rbp)
cmpq   $0x0,-0x100(%rbp)
jne    1579 <main+0x349>
mov    0x2a7a(%rip),%rax
mov    (%rax),%edi
mov    0x2a99(%rip),%rax
mov    (%rax),%rdx
lea    0xb8d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
mov    -0x100(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xe0(%rbp)
jmp    15a2 <main+0x372>
mov    0x2a64(%rip),%rax
mov    (%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0xe0(%rbp)
movl   $0x1,-0xd8(%rbp)
jmp    166c <main+0x43c>
movl   $0x0,-0x40(%rbp)
mov    0x2a39(%rip),%rax
cmpq   $0x0,(%rax)
je     15e4 <main+0x3b4>
mov    0x2a28(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    15e9 <main+0x3b9>
jmp    166c <main+0x43c>
jmp    15ee <main+0x3be>
mov    0x2a03(%rip),%rdi
lea    0xb0f(%rip),%rsi
call   10d0 <strsep@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1659 <main+0x429>
mov    -0x28(%rbp),%rdi
call   1130 <atoi@plt>
mov    %eax,%esi
lea    0xaec(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1130 <atoi@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x40(%rbp)
cltq
mov    %ecx,-0xd0(%rbp,%rax,4)
cmpl   $0x20,-0x40(%rbp)
jl     1654 <main+0x424>
jmp    1659 <main+0x429>
jmp    15ee <main+0x3be>
jmp    166c <main+0x43c>
jmp    1663 <main+0x433>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
jmp    12e1 <main+0xb1>
cmpl   $0x0,-0x3c(%rbp)
jne    169b <main+0x46b>
mov    0x294e(%rip),%rax
mov    (%rax),%edi
lea    0xa98(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
mov    0x293e(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    16cd <main+0x49d>
mov    0x291c(%rip),%rax
mov    (%rax),%edi
lea    0xa80(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <Usage_and_abort@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    0x2906(%rip),%rcx
sub    (%rcx),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1736 <main+0x506>
mov    0x28d1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10c(%rbp)
mov    0x28ba(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x10c(%rbp),%edi
mov    %rax,%rdx
lea    0xa36(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   1140 <exit@plt>
mov    0x28a3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    177f <main+0x54f>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    0x2878(%rip),%rsi
sub    (%rsi),%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1742 <main+0x512>
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    0x2853(%rip),%rdx
sub    (%rdx),%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
cmpl   $0x0,-0xd8(%rbp)
jne    17b0 <main+0x580>
mov    -0x48(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0x48(%rbp),%edi
mov    -0xe0(%rbp),%esi
call   10f0 <setregid@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    1840 <main+0x610>
mov    0x27fe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x11c(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x118(%rbp)
mov    -0xe0(%rbp),%eax
mov    %eax,-0x114(%rbp)
mov    0x27d2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x110(%rbp)
mov    0x27c3(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x11c(%rbp),%edi
mov    -0x118(%rbp),%edx
mov    -0x114(%rbp),%ecx
mov    -0x110(%rbp),%r8d
mov    %rax,%r9
lea    0x94e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   1140 <exit@plt>
cmpl   $0x0,-0x40(%rbp)
jl     1881 <main+0x651>
mov    -0x40(%rbp),%edi
lea    -0xd0(%rbp),%rsi
call   1060 <setgroups@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    187c <main+0x64c>
lea    0x93b(%rip),%rdi
call   1100 <perror@plt>
mov    $0xffffffff,%edi
call   1140 <exit@plt>
jmp    1881 <main+0x651>
cmpl   $0x0,-0xd4(%rbp)
jne    1897 <main+0x667>
mov    -0x44(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    -0x44(%rbp),%edi
mov    -0xdc(%rbp),%esi
call   10e0 <setreuid@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    1927 <main+0x6f7>
mov    0x2717(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x12c(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x128(%rbp)
mov    -0xdc(%rbp),%eax
mov    %eax,-0x124(%rbp)
mov    0x26eb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x120(%rbp)
mov    0x26dc(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x12c(%rbp),%edi
mov    -0x128(%rbp),%edx
mov    -0x124(%rbp),%ecx
mov    -0x120(%rbp),%r8d
mov    %rax,%r9
lea    0x8af(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   1140 <exit@plt>
mov    0x26a2(%rip),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0xdc(%rbp),%r8d
mov    -0xe0(%rbp),%r9d
lea    0x8a5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1995 <main+0x765>
mov    0x2664(%rip),%rax
mov    (%rax),%edi
movslq -0x34(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%edx
lea    0x8a2(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1959 <main+0x729>
mov    0x2634(%rip),%rax
mov    (%rax),%edi
lea    0x7d6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    0x2620(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
jge    19fb <main+0x7cb>
mov    0x25ff(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0x840(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    19b3 <main+0x783>
mov    0x25ce(%rip),%rax
mov    (%rax),%edi
lea    0x770(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x25b7(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1120 <execvp@plt>
mov    0x2599(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x13c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x138(%rbp)
mov    0x2574(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x130(%rbp)
mov    0x2565(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x13c(%rbp),%edi
mov    -0x138(%rbp),%rdx
mov    -0x130(%rbp),%ecx
mov    %rax,%r8
lea    0x7a5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   1140 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
mov    (%rsi),%rax
mov    %rax,0x18(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
cmp    $0x1,%edi
jne    1298 <main+0x78>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
mov    $0xffffffff,%ebx
lea    0xd5c(%rip),%r14
mov    0x2d4d(%rip),%r13
movl   $0x0,0x2c(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x28(%rsp)
movl   $0x0,0x24(%rsp)
movl   $0x0,0x10(%rsp)
xor    %r12d,%r12d
movl   $0x0,0x14(%rsp)
mov    %ebp,0x8(%rsp)
jmp    1300 <main+0xe0>
cmp    $0xffffffff,%eax
je     157a <main+0x35a>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
nop
mov    %ebp,%edi
mov    %r15,%rsi
lea    0xdc8(%rip),%rdx
call   1100 <getopt@plt>
lea    -0x47(%rax),%ecx
cmp    $0x2f,%ecx
ja     12ec <main+0xcc>
movslq (%r14,%rcx,4),%rax
add    %r14,%rax
jmp    *%rax
mov    0x0(%r13),%rax
xor    %ebx,%ebx
test   %rax,%rax
je     1300 <main+0xe0>
movsbl (%rax),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1300 <main+0xe0>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
lea    0xdc1(%rip),%rsi
call   10c0 <strsep@plt>
test   %rax,%rax
je     1388 <main+0x168>
mov    %rax,%rbp
mov    %rax,%rdi
call   1120 <atoi@plt>
lea    0xda7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbp,%rdi
call   1120 <atoi@plt>
mov    %eax,0x30(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1340 <main+0x120>
mov    $0x20,%ebx
mov    0x8(%rsp),%ebp
jmp    1300 <main+0xe0>
mov    0x0(%r13),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    0x0(%r13),%rdi
test   %eax,%eax
je     143d <main+0x21d>
call   1120 <atoi@plt>
jmp    1473 <main+0x253>
mov    0x0(%r13),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    0x0(%r13),%rdi
test   %eax,%eax
je     149c <main+0x27c>
call   1120 <atoi@plt>
mov    %eax,0xc(%rsp)
movl   $0x1,0x14(%rsp)
jmp    1300 <main+0xe0>
mov    0x0(%r13),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    0x0(%r13),%rdi
test   %eax,%eax
je     14e6 <main+0x2c6>
call   1120 <atoi@plt>
mov    %eax,0x10(%rsp)
movl   $0x1,0x28(%rsp)
jmp    1300 <main+0xe0>
mov    0x0(%r13),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    0x0(%r13),%rdi
test   %eax,%eax
je     1530 <main+0x310>
call   1120 <atoi@plt>
mov    %eax,0x24(%rsp)
movl   $0x1,0x20(%rsp)
jmp    1300 <main+0xe0>
call   1070 <getpwnam@plt>
mov    %rax,%r12
test   %rax,%rax
jne    146f <main+0x24f>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xc84(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
mov    (%r12),%eax
mov    0x14(%rsp),%ecx
xor    %edx,%edx
test   %ecx,%ecx
setne  %dl
mov    0xc(%rsp),%ecx
mov    %eax,0x2c(%rsp)
cmove  %eax,%ecx
mov    %ecx,0xc(%rsp)
mov    $0x1,%r12d
mov    %edx,0x14(%rsp)
jmp    1300 <main+0xe0>
call   1090 <getgrnam@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    14ce <main+0x2ae>
mov    0x2b20(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xc39(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
mov    0x0(%rbp),%eax
mov    %eax,0xc(%rsp)
movl   $0x1,0x14(%rsp)
mov    0x8(%rsp),%ebp
jmp    1300 <main+0xe0>
call   1090 <getgrnam@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1518 <main+0x2f8>
mov    0x2ad6(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xbef(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x10(%rsp)
movl   $0x1,0x28(%rsp)
mov    0x8(%rsp),%ebp
jmp    1300 <main+0xe0>
call   1070 <getpwnam@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1562 <main+0x342>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xb91(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x24(%rsp)
movl   $0x1,0x20(%rsp)
mov    0x8(%rsp),%ebp
jmp    1300 <main+0xe0>
test   %r12d,%r12d
mov    0x2a4c(%rip),%r13
jne    15a2 <main+0x382>
mov    0x0(%r13),%edi
lea    0xb92(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
mov    0x2a37(%rip),%r14
mov    (%r14),%eax
cmp    %ebp,%eax
jne    15cf <main+0x3af>
mov    0x0(%r13),%edi
lea    0xb82(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1060 <Usage_and_abort@plt>
mov    (%r14),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
lea    0x8(,%rcx,8),%edi
call   10a0 <malloc@plt>
test   %rax,%rax
jne    1613 <main+0x3f3>
mov    0x0(%r13),%ebx
mov    0x29d9(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
lea    0xb5e(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
mov    %rax,%r12
mov    (%r14),%r10d
mov    %r10d,%esi
cmp    %ebp,%r10d
jge    17c1 <main+0x5a1>
movslq %r10d,%r8
movslq %ebp,%rcx
mov    %rcx,%r9
sub    %r8,%r9
mov    %r8,%rdx
cmp    $0x4,%r9
jb     1739 <main+0x519>
lea    (%r15,%rcx,8),%rax
cmp    %rax,%r12
jae    165b <main+0x43b>
lea    (%r12,%r9,8),%rax
lea    (%r15,%r8,8),%rsi
mov    %r8,%rdx
cmp    %rax,%rsi
jb     1739 <main+0x519>
mov    %r9,%rdx
and    $0xfffffffffffffffc,%rdx
lea    -0x4(%rdx),%rax
mov    %rax,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%r11d
and    $0x3,%r11d
cmp    $0xc,%rax
jae    1682 <main+0x462>
xor    %eax,%eax
jmp    16f0 <main+0x4d0>
and    $0xfffffffffffffffc,%rsi
lea    (%r15,%r8,8),%rdi
add    $0x70,%rdi
xor    %eax,%eax
movups -0x70(%rdi,%rax,8),%xmm0
movups -0x60(%rdi,%rax,8),%xmm1
movups %xmm0,(%r12,%rax,8)
movups %xmm1,0x10(%r12,%rax,8)
movups -0x50(%rdi,%rax,8),%xmm0
movups -0x40(%rdi,%rax,8),%xmm1
movups %xmm0,0x20(%r12,%rax,8)
movups %xmm1,0x30(%r12,%rax,8)
movups -0x30(%rdi,%rax,8),%xmm0
movups -0x20(%rdi,%rax,8),%xmm1
movups %xmm0,0x40(%r12,%rax,8)
movups %xmm1,0x50(%r12,%rax,8)
movups -0x10(%rdi,%rax,8),%xmm0
movups (%rdi,%rax,8),%xmm1
movups %xmm0,0x60(%r12,%rax,8)
movups %xmm1,0x70(%r12,%rax,8)
add    $0x10,%rax
add    $0xfffffffffffffffc,%rsi
jne    1690 <main+0x470>
test   %r11,%r11
je     172b <main+0x50b>
lea    (%r12,%rax,8),%rsi
add    $0x10,%rsi
add    %r8,%rax
lea    (%r15,%rax,8),%rax
add    $0x10,%rax
shl    $0x5,%r11
xor    %edi,%edi
xchg   %ax,%ax
movups -0x10(%rax,%rdi,1),%xmm0
movups (%rax,%rdi,1),%xmm1
movups %xmm0,-0x10(%rsi,%rdi,1)
movups %xmm1,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r11
jne    1710 <main+0x4f0>
mov    %ebp,%esi
cmp    %rdx,%r9
je     17c1 <main+0x5a1>
add    %r8,%rdx
mov    %ebp,%esi
sub    %edx,%esi
mov    %rdx,%rax
not    %rax
add    %rcx,%rax
and    $0x3,%rsi
je     1772 <main+0x552>
lea    0x0(,%r8,8),%rbp
mov    %r12,%rdi
sub    %rbp,%rdi
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rdx,8),%rbp
mov    %rbp,(%rdi,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rsi
jne    1760 <main+0x540>
mov    0x8(%rsp),%edi
mov    %edi,%esi
cmp    $0x3,%rax
jb     17c1 <main+0x5a1>
mov    $0x3,%eax
sub    %r8,%rax
lea    (%r12,%rax,8),%rax
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rdx,8),%rsi
mov    %rsi,-0x18(%rax,%rdx,8)
mov    0x8(%r15,%rdx,8),%rsi
mov    %rsi,-0x10(%rax,%rdx,8)
mov    0x10(%r15,%rdx,8),%rsi
mov    %rsi,-0x8(%rax,%rdx,8)
mov    0x18(%r15,%rdx,8),%rsi
mov    %rsi,(%rax,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%rcx
jne    1790 <main+0x570>
mov    %edi,%esi
sub    %r10d,%esi
movslq %esi,%rax
movq   $0x0,(%r12,%rax,8)
cmpl   $0x0,0x28(%rsp)
mov    0xc(%rsp),%r15d
mov    0x10(%rsp),%ebp
cmove  %r15d,%ebp
mov    %r15d,%edi
mov    %ebp,%esi
call   10e0 <setregid@plt>
cmp    $0xffffffff,%eax
jne    1815 <main+0x5f5>
mov    0x0(%r13),%r14d
mov    0x27cd(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1140 <strerror@plt>
lea    0x972(%rip),%rsi
mov    %r14d,%edi
mov    %r15d,%edx
mov    %ebp,%ecx
jmp    188b <main+0x66b>
test   %ebx,%ebx
js     1840 <main+0x620>
lea    0x30(%rsp),%rsi
mov    %ebx,%edi
call   1050 <setgroups@plt>
cmp    $0xffffffff,%eax
jne    1840 <main+0x620>
lea    0x977(%rip),%rdi
call   10f0 <perror@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
mov    %ebp,0x10(%rsp)
cmpl   $0x0,0x20(%rsp)
mov    0x2c(%rsp),%ebp
mov    0x24(%rsp),%r15d
cmove  %ebp,%r15d
mov    %ebp,%edi
mov    %r15d,%esi
call   10d0 <setreuid@plt>
mov    0x0(%r13),%edi
cmp    $0xffffffff,%eax
jne    18a2 <main+0x682>
mov    0x2758(%rip),%rax
mov    (%rax),%ebx
mov    %edi,%r14d
mov    %ebx,%edi
call   1140 <strerror@plt>
lea    0x942(%rip),%rsi
mov    %r14d,%edi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %ebx,%r8d
mov    %rax,%r9
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
lea    0x947(%rip),%rsi
mov    %ebp,%edx
mov    0xc(%rsp),%ecx
mov    %r15d,%r8d
mov    0x10(%rsp),%r9d
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %ebx,%ebx
jle    18eb <main+0x6cb>
mov    %ebx,%ebx
lea    0x957(%rip),%r15
xor    %ebp,%ebp
nopl   (%rax)
mov    0x0(%r13),%edi
mov    0x30(%rsp,%rbp,4),%edx
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    18d0 <main+0x6b0>
mov    0x0(%r13),%edi
lea    0x885(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x8(%rsp),%eax
cmp    %eax,(%r14)
jge    1944 <main+0x724>
lea    0x919(%rip),%r15
movslq %eax,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13),%edi
mov    (%r12,%rbp,8),%rdx
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbp
movslq (%r14),%rax
mov    %rbx,%rcx
sub    %rax,%rcx
cmp    %rcx,%rbp
jl     1920 <main+0x700>
mov    0x0(%r13),%edi
lea    0x82c(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x0(%r13),%edi
call   10b0 <fflush@plt>
mov    (%r12),%rdi
mov    %r12,%rsi
call   1110 <execvp@plt>
mov    0x0(%r13),%ebx
mov    (%r12),%r14
mov    0x264e(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1140 <strerror@plt>
lea    0x8a2(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %ebp,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.passwd = type { i32 }
%struct.group = type { i32 }
@stderr = global i32 0
@.str = [20 x i8] c"No parameter count\0A\00"
@.str.1 = [14 x i8] c"+u:g:v:j:hG::\00"
@optarg = global i8* null
@.str.2 = [20 x i8] c"parameter '%s' bad\0A\00"
@.str.3 = [21 x i8] c"getgrname %s failed\0A\00"
@.str.4 = [2 x i8] c",\00"
@.str.5 = [22 x i8] c"adding supp group %d\0A\00"
@.str.6 = [26 x i8] c"Must specify uid to run.\0A\00"
@optind = global i32 0
@.str.7 = [30 x i8] c"Must specify command to run.\0A\00"
@.str.8 = [34 x i8] c"Error in allocating memory. (%s)\0A\00"
@errno = global i32 0
@.str.9 = [43 x i8] c"Cannot change gid to %d/%d, errno=%d (%s)\0A\00"
@.str.10 = [29 x i8] c"setting supplementary groups\00"
@.str.11 = [43 x i8] c"Cannot change uid to %d/%d, errno=%d (%s)\0A\00"
@.str.12 = [50 x i8] c"running as uid/gid/euid/egid %d/%d/%d/%d, groups:\00"
@.str.13 = [4 x i8] c" %d\00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [6 x i8] c" [%s]\00"
@.str.16 = [34 x i8] c"execvp fails running %s (%d): %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%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 [32 x i32]
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca %struct.passwd*
%23 = alloca %struct.group*
%24 = alloca %struct.passwd*
%25 = alloca %struct.group*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
store i8* %28, i8** %7
store i32 0, i32* %12
store i32 0, i32* %13
store i32 -1, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
%29 = bitcast [32 x i32]* %17 to i8*
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %37
32: ; preds = %2
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%35 = load i8*, i8** %7
%36 = call i32 @Usage_and_abort(i8* %35)
br label %37
37: ; preds = %32, %2
br label %38
38: ; preds = %183, %37
%39 = load i32, i32* %4
%40 = load i8**, i8*** %5
%41 = call i32 @getopt(i32 %39, i8** %40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 %41, i32* %10
%42 = icmp ne i32 %41, -1
br i1 %42, label %43, label %184
43: ; preds = %38
%44 = load i32, i32* %10
switch i32 %44, label %179 [
i32 117, label %45
i32 103, label %75
i32 118, label %100
i32 106, label %125
i32 71, label %150
i32 104, label %180
]
45: ; preds = %43
%46 = load i8*, i8** @optarg
%47 = getelementptr inbounds i8, i8* %46, i64 0
%48 = load i8, i8* %47
%49 = call i32 @isdigit(i8 signext %48)
%50 = icmp ne i32 %49, 0
br i1 %50, label %66, label %51
51: ; preds = %45
%52 = load i8*, i8** @optarg
%53 = call %struct.passwd* @getpwnam(i8* %52)
store %struct.passwd* %53, %struct.passwd** %22
%54 = load %struct.passwd*, %struct.passwd** %22
%55 = icmp eq %struct.passwd* %54, null
br i1 %55, label %56, label %62
56: ; preds = %51
%57 = load i32, i32* @stderr
%58 = load i8*, i8** @optarg
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %58)
%60 = load i8*, i8** %7
%61 = call i32 @Usage_and_abort(i8* %60)
br label %62
62: ; preds = %56, %51
%63 = load %struct.passwd*, %struct.passwd** %22
%64 = getelementptr inbounds %struct.passwd, %struct.passwd* %63, i32 0, i32 0
%65 = load i32, i32* %64
store i32 %65, i32* %15
br label %69
66: ; preds = %45
%67 = load i8*, i8** @optarg
%68 = call i32 @atoi(i8* %67)
store i32 %68, i32* %15
br label %69
69: ; preds = %66, %62
store i32 1, i32* %13
%70 = load i32, i32* %12
%71 = icmp ne i32 %70, 0
br i1 %71, label %74, label %72
72: ; preds = %69
%73 = load i32, i32* %15
store i32 %73, i32* %16
br label %74
74: ; preds = %72, %69
br label %183
75: ; preds = %43
%76 = load i8*, i8** @optarg
%77 = getelementptr inbounds i8, i8* %76, i64 0
%78 = load i8, i8* %77
%79 = call i32 @isdigit(i8 signext %78)
%80 = icmp ne i32 %79, 0
br i1 %80, label %96, label %81
81: ; preds = %75
%82 = load i8*, i8** @optarg
%83 = call %struct.group* @getgrnam(i8* %82)
store %struct.group* %83, %struct.group** %23
%84 = load %struct.group*, %struct.group** %23
%85 = icmp eq %struct.group* %84, null
br i1 %85, label %86, label %92
86: ; preds = %81
%87 = load i32, i32* @stderr
%88 = load i8*, i8** @optarg
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %88)
%90 = load i8*, i8** %7
%91 = call i32 @Usage_and_abort(i8* %90)
br label %92
92: ; preds = %86, %81
%93 = load %struct.group*, %struct.group** %23
%94 = getelementptr inbounds %struct.group, %struct.group* %93, i32 0, i32 0
%95 = load i32, i32* %94
store i32 %95, i32* %16
br label %99
96: ; preds = %75
%97 = load i8*, i8** @optarg
%98 = call i32 @atoi(i8* %97)
store i32 %98, i32* %16
br label %99
99: ; preds = %96, %92
store i32 1, i32* %12
br label %183
100: ; preds = %43
%101 = load i8*, i8** @optarg
%102 = getelementptr inbounds i8, i8* %101, i64 0
%103 = load i8, i8* %102
%104 = call i32 @isdigit(i8 signext %103)
%105 = icmp ne i32 %104, 0
br i1 %105, label %121, label %106
106: ; preds = %100
%107 = load i8*, i8** @optarg
%108 = call %struct.passwd* @getpwnam(i8* %107)
store %struct.passwd* %108, %struct.passwd** %24
%109 = load %struct.passwd*, %struct.passwd** %24
%110 = icmp eq %struct.passwd* %109, null
br i1 %110, label %111, label %117
111: ; preds = %106
%112 = load i32, i32* @stderr
%113 = load i8*, i8** @optarg
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %113)
%115 = load i8*, i8** %7
%116 = call i32 @Usage_and_abort(i8* %115)
br label %117
117: ; preds = %111, %106
%118 = load %struct.passwd*, %struct.passwd** %24
%119 = getelementptr inbounds %struct.passwd, %struct.passwd* %118, i32 0, i32 0
%120 = load i32, i32* %119
store i32 %120, i32* %20
br label %124
121: ; preds = %100
%122 = load i8*, i8** @optarg
%123 = call i32 @atoi(i8* %122)
store i32 %123, i32* %20
br label %124
124: ; preds = %121, %117
store i32 1, i32* %18
br label %183
125: ; preds = %43
%126 = load i8*, i8** @optarg
%127 = getelementptr inbounds i8, i8* %126, i64 0
%128 = load i8, i8* %127
%129 = call i32 @isdigit(i8 signext %128)
%130 = icmp ne i32 %129, 0
br i1 %130, label %146, label %131
131: ; preds = %125
%132 = load i8*, i8** @optarg
%133 = call %struct.group* @getgrnam(i8* %132)
store %struct.group* %133, %struct.group** %25
%134 = load %struct.group*, %struct.group** %25
%135 = icmp eq %struct.group* %134, null
br i1 %135, label %136, label %142
136: ; preds = %131
%137 = load i32, i32* @stderr
%138 = load i8*, i8** @optarg
%139 = call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %138)
%140 = load i8*, i8** %7
%141 = call i32 @Usage_and_abort(i8* %140)
br label %142
142: ; preds = %136, %131
%143 = load %struct.group*, %struct.group** %25
%144 = getelementptr inbounds %struct.group, %struct.group* %143, i32 0, i32 0
%145 = load i32, i32* %144
store i32 %145, i32* %21
br label %149
146: ; preds = %125
%147 = load i8*, i8** @optarg
%148 = call i32 @atoi(i8* %147)
store i32 %148, i32* %21
br label %149
149: ; preds = %146, %142
store i32 1, i32* %19
br label %183
150: ; preds = %43
store i32 0, i32* %14
%151 = load i8*, i8** @optarg
%152 = icmp eq i8* %151, null
br i1 %152, label %159, label %153
153: ; preds = %150
%154 = load i8*, i8** @optarg
%155 = getelementptr inbounds i8, i8* %154, i64 0
%156 = load i8, i8* %155
%157 = call i32 @isdigit(i8 signext %156)
%158 = icmp ne i32 %157, 0
br i1 %158, label %160, label %159
159: ; preds = %153, %150
br label %183
160: ; preds = %153
br label %161
161: ; preds = %177, %160
%162 = call i8* @strsep(i8** @optarg, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8* %162, i8** %8
%163 = icmp ne i8* %162, null
br i1 %163, label %164, label %178
164: ; preds = %161
%165 = load i8*, i8** %8
%166 = call i32 @atoi(i8* %165)
%167 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %166)
%168 = load i8*, i8** %8
%169 = call i32 @atoi(i8* %168)
%170 = load i32, i32* %14
%171 = add nsw i32 %170, 1
store i32 %171, i32* %14
%172 = sext i32 %170 to i64
%173 = getelementptr inbounds [32 x i32], [32 x i32]* %17, i64 0, i64 %172
store i32 %169, i32* %173
%174 = load i32, i32* %14
%175 = icmp sge i32 %174, 32
br i1 %175, label %176, label %177
176: ; preds = %164
br label %178
177: ; preds = %164
br label %161
178: ; preds = %176, %161
br label %183
179: ; preds = %43
br label %180
180: ; preds = %43, %179
%181 = load i8*, i8** %7
%182 = call i32 @Usage_and_abort(i8* %181)
br label %183
183: ; preds = %180, %178, %159, %149, %124, %99, %74
br label %38
184: ; preds = %38
%185 = load i32, i32* %13
%186 = icmp ne i32 %185, 0
br i1 %186, label %192, label %187
187: ; preds = %184
%188 = load i32, i32* @stderr
%189 = call i32 (i32, i8*, ...) @fprintf(i32 %188, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%190 = load i8*, i8** %7
%191 = call i32 @Usage_and_abort(i8* %190)
br label %192
192: ; preds = %187, %184
%193 = load i32, i32* @optind
%194 = load i32, i32* %4
%195 = icmp eq i32 %193, %194
br i1 %195, label %196, label %201
196: ; preds = %192
%197 = load i32, i32* @stderr
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %197, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%199 = load i8*, i8** %7
%200 = call i32 @Usage_and_abort(i8* %199)
br label %201
201: ; preds = %196, %192
%202 = load i32, i32* %4
%203 = add nsw i32 %202, 1
%204 = load i32, i32* @optind
%205 = sub nsw i32 %203, %204
%206 = sext i32 %205 to i64
%207 = mul i64 8, %206
%208 = trunc i64 %207 to i32
%209 = call i64 @malloc(i32 %208)
%210 = inttoptr i64 %209 to i8**
store i8** %210, i8*** %6
%211 = load i8**, i8*** %6
%212 = icmp eq i8** %211, null
br i1 %212, label %213, label %219
213: ; preds = %201
%214 = load i32, i32* @stderr
%215 = load i32, i32* @errno
%216 = call i8* @strerror(i32 %215)
%217 = call i32 (i32, i8*, ...) @fprintf(i32 %214, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %216)
%218 = call i32 @exit(i32 -1)
unreachable
219: ; preds = %201
%220 = load i32, i32* @optind
store i32 %220, i32* %11
br label %221
221: ; preds = %237, %219
%222 = load i32, i32* %11
%223 = load i32, i32* %4
%224 = icmp slt i32 %222, %223
br i1 %224, label %225, label %240
225: ; preds = %221
%226 = load i8**, i8*** %5
%227 = load i32, i32* %11
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds i8*, i8** %226, i64 %228
%230 = load i8*, i8** %229
%231 = load i8**, i8*** %6
%232 = load i32, i32* %11
%233 = load i32, i32* @optind
%234 = sub nsw i32 %232, %233
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds i8*, i8** %231, i64 %235
store i8* %230, i8** %236
br label %237
237: ; preds = %225
%238 = load i32, i32* %11
%239 = add nsw i32 %238, 1
store i32 %239, i32* %11
br label %221
240: ; preds = %221
%241 = load i8**, i8*** %6
%242 = load i32, i32* %11
%243 = load i32, i32* @optind
%244 = sub nsw i32 %242, %243
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds i8*, i8** %241, i64 %245
store i8* null, i8** %246
%247 = load i32, i32* %19
%248 = icmp ne i32 %247, 0
br i1 %248, label %251, label %249
249: ; preds = %240
%250 = load i32, i32* %16
store i32 %250, i32* %21
br label %251
251: ; preds = %249, %240
%252 = load i32, i32* %16
%253 = load i32, i32* %21
%254 = call i32 @setregid(i32 %252, i32 %253)
store i32 %254, i32* %9
%255 = load i32, i32* %9
%256 = icmp eq i32 %255, -1
br i1 %256, label %257, label %266
257: ; preds = %251
%258 = load i32, i32* @stderr
%259 = load i32, i32* %16
%260 = load i32, i32* %21
%261 = load i32, i32* @errno
%262 = load i32, i32* @errno
%263 = call i8* @strerror(i32 %262)
%264 = call i32 (i32, i8*, ...) @fprintf(i32 %258, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %259, i32 %260, i32 %261, i8* %263)
%265 = call i32 @exit(i32 -1)
unreachable
266: ; preds = %251
%267 = load i32, i32* %14
%268 = icmp sge i32 %267, 0
br i1 %268, label %269, label %279
269: ; preds = %266
%270 = load i32, i32* %14
%271 = getelementptr inbounds [32 x i32], [32 x i32]* %17, i64 0, i64 0
%272 = call i32 @setgroups(i32 %270, i32* %271)
store i32 %272, i32* %9
%273 = load i32, i32* %9
%274 = icmp eq i32 %273, -1
br i1 %274, label %275, label %278
275: ; preds = %269
%276 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0))
%277 = call i32 @exit(i32 -1)
unreachable
278: ; preds = %269
br label %279
279: ; preds = %278, %266
%280 = load i32, i32* %18
%281 = icmp ne i32 %280, 0
br i1 %281, label %284, label %282
282: ; preds = %279
%283 = load i32, i32* %15
store i32 %283, i32* %20
br label %284
284: ; preds = %282, %279
%285 = load i32, i32* %15
%286 = load i32, i32* %20
%287 = call i32 @setreuid(i32 %285, i32 %286)
store i32 %287, i32* %9
%288 = load i32, i32* %9
%289 = icmp eq i32 %288, -1
br i1 %289, label %290, label %299
290: ; preds = %284
%291 = load i32, i32* @stderr
%292 = load i32, i32* %15
%293 = load i32, i32* %20
%294 = load i32, i32* @errno
%295 = load i32, i32* @errno
%296 = call i8* @strerror(i32 %295)
%297 = call i32 (i32, i8*, ...) @fprintf(i32 %291, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 %292, i32 %293, i32 %294, i8* %296)
%298 = call i32 @exit(i32 -1)
unreachable
299: ; preds = %284
%300 = load i32, i32* @stderr
%301 = load i32, i32* %15
%302 = load i32, i32* %16
%303 = load i32, i32* %20
%304 = load i32, i32* %21
%305 = call i32 (i32, i8*, ...) @fprintf(i32 %300, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), i32 %301, i32 %302, i32 %303, i32 %304)
store i32 0, i32* %11
br label %306
306: ; preds = %317, %299
%307 = load i32, i32* %11
%308 = load i32, i32* %14
%309 = icmp slt i32 %307, %308
br i1 %309, label %310, label %320
310: ; preds = %306
%311 = load i32, i32* @stderr
%312 = load i32, i32* %11
%313 = sext i32 %312 to i64
%314 = getelementptr inbounds [32 x i32], [32 x i32]* %17, i64 0, i64 %313
%315 = load i32, i32* %314
%316 = call i32 (i32, i8*, ...) @fprintf(i32 %311, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 %315)
br label %317
317: ; preds = %310
%318 = load i32, i32* %11
%319 = add nsw i32 %318, 1
store i32 %319, i32* %11
br label %306
320: ; preds = %306
%321 = load i32, i32* @stderr
%322 = call i32 (i32, i8*, ...) @fprintf(i32 %321, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %11
br label %323
323: ; preds = %337, %320
%324 = load i32, i32* %11
%325 = load i32, i32* %4
%326 = load i32, i32* @optind
%327 = sub nsw i32 %325, %326
%328 = icmp slt i32 %324, %327
br i1 %328, label %329, label %340
329: ; preds = %323
%330 = load i32, i32* @stderr
%331 = load i8**, i8*** %6
%332 = load i32, i32* %11
%333 = sext i32 %332 to i64
%334 = getelementptr inbounds i8*, i8** %331, i64 %333
%335 = load i8*, i8** %334
%336 = call i32 (i32, i8*, ...) @fprintf(i32 %330, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* %335)
br label %337
337: ; preds = %329
%338 = load i32, i32* %11
%339 = add nsw i32 %338, 1
store i32 %339, i32* %11
br label %323
340: ; preds = %323
%341 = load i32, i32* @stderr
%342 = call i32 (i32, i8*, ...) @fprintf(i32 %341, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%343 = load i32, i32* @stderr
%344 = call i32 @fflush(i32 %343)
%345 = load i8**, i8*** %6
%346 = getelementptr inbounds i8*, i8** %345, i64 0
%347 = load i8*, i8** %346
%348 = load i8**, i8*** %6
%349 = call i32 @execvp(i8* %347, i8** %348)
%350 = load i32, i32* @stderr
%351 = load i8**, i8*** %6
%352 = getelementptr inbounds i8*, i8** %351, i64 0
%353 = load i8*, i8** %352
%354 = load i32, i32* @errno
%355 = load i32, i32* @errno
%356 = call i8* @strerror(i32 %355)
%357 = call i32 (i32, i8*, ...) @fprintf(i32 %350, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i8* %353, i32 %354, i8* %356)
%358 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
%struct.group = type { i32 }
@stderr = global i32 0
@.str = [20 x i8] c"No parameter count\0A\00"
@.str.1 = [14 x i8] c"+u:g:v:j:hG::\00"
@optarg = global i8* null
@.str.2 = [20 x i8] c"parameter '%s' bad\0A\00"
@.str.3 = [21 x i8] c"getgrname %s failed\0A\00"
@.str.4 = [2 x i8] c",\00"
@.str.5 = [22 x i8] c"adding supp group %d\0A\00"
@.str.6 = [26 x i8] c"Must specify uid to run.\0A\00"
@optind = global i32 0
@.str.7 = [30 x i8] c"Must specify command to run.\0A\00"
@.str.8 = [34 x i8] c"Error in allocating memory. (%s)\0A\00"
@errno = global i32 0
@.str.9 = [43 x i8] c"Cannot change gid to %d/%d, errno=%d (%s)\0A\00"
@.str.10 = [29 x i8] c"setting supplementary groups\00"
@.str.11 = [43 x i8] c"Cannot change uid to %d/%d, errno=%d (%s)\0A\00"
@.str.12 = [50 x i8] c"running as uid/gid/euid/egid %d/%d/%d/%d, groups:\00"
@.str.13 = [4 x i8] c" %d\00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [6 x i8] c" [%s]\00"
@.str.16 = [34 x i8] c"execvp fails running %s (%d): %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [32 x i32]
%4 = load i8*, i8** %1
%5 = bitcast [32 x i32]* %3 to i8*
%6 = icmp eq i32 %0, 1
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @Usage_and_abort(i8* %4)
br label %11
11: ; preds = %7, %2
br label %12
12: ; preds = %127, %11
%13 = phi i32 [ -1, %11 ], [ %128, %127 ]
%14 = phi i32 [ 0, %11 ], [ %129, %127 ]
%15 = phi i32 [ 0, %11 ], [ %130, %127 ]
%16 = phi i32 [ 0, %11 ], [ %131, %127 ]
%17 = phi i32 [ 0, %11 ], [ %132, %127 ]
%18 = phi i32 [ 0, %11 ], [ %133, %127 ]
%19 = phi i32 [ 0, %11 ], [ %134, %127 ]
%20 = phi i32 [ 0, %11 ], [ %135, %127 ]
%21 = phi i32 [ 0, %11 ], [ %136, %127 ]
%22 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
switch i32 %22, label %123 [
i32 -1, label %137
i32 117, label %23
i32 103, label %48
i32 118, label %67
i32 106, label %86
i32 71, label %105
]
23: ; preds = %12
%24 = load i8*, i8** @optarg
%25 = load i8, i8* %24
%26 = tail call i32 @isdigit(i8 signext %25)
%27 = icmp eq i32 %26, 0
%28 = load i8*, i8** @optarg
br i1 %27, label %29, label %40
29: ; preds = %23
%30 = tail call %struct.passwd* @getpwnam(i8* %28)
%31 = icmp eq %struct.passwd* %30, null
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = load i8*, i8** @optarg
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = tail call i32 @Usage_and_abort(i8* %4)
br label %37
37: ; preds = %32, %29
%38 = getelementptr inbounds %struct.passwd, %struct.passwd* %30, i64 0, i32 0
%39 = load i32, i32* %38
br label %42
40: ; preds = %23
%41 = tail call i32 @atoi(i8* %28)
br label %42
42: ; preds = %40, %37
%43 = phi i32 [ %41, %40 ], [ %39, %37 ]
%44 = icmp eq i32 %21, 0
%45 = select i1 %44, i32 %43, i32 %15
%46 = xor i1 %44, true
%47 = zext i1 %46 to i32
br label %127
48: ; preds = %12
%49 = load i8*, i8** @optarg
%50 = load i8, i8* %49
%51 = tail call i32 @isdigit(i8 signext %50)
%52 = icmp eq i32 %51, 0
%53 = load i8*, i8** @optarg
br i1 %52, label %54, label %65
54: ; preds = %48
%55 = tail call %struct.group* @getgrnam(i8* %53)
%56 = icmp eq %struct.group* %55, null
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = load i8*, i8** @optarg
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %59)
%61 = tail call i32 @Usage_and_abort(i8* %4)
br label %62
62: ; preds = %57, %54
%63 = getelementptr inbounds %struct.group, %struct.group* %55, i64 0, i32 0
%64 = load i32, i32* %63
br label %127
65: ; preds = %48
%66 = tail call i32 @atoi(i8* %53)
br label %127
67: ; preds = %12
%68 = load i8*, i8** @optarg
%69 = load i8, i8* %68
%70 = tail call i32 @isdigit(i8 signext %69)
%71 = icmp eq i32 %70, 0
%72 = load i8*, i8** @optarg
br i1 %71, label %73, label %84
73: ; preds = %67
%74 = tail call %struct.passwd* @getpwnam(i8* %72)
%75 = icmp eq %struct.passwd* %74, null
br i1 %75, label %76, label %81
76: ; preds = %73
%77 = load i32, i32* @stderr
%78 = load i8*, i8** @optarg
%79 = tail call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %78)
%80 = tail call i32 @Usage_and_abort(i8* %4)
br label %81
81: ; preds = %76, %73
%82 = getelementptr inbounds %struct.passwd, %struct.passwd* %74, i64 0, i32 0
%83 = load i32, i32* %82
br label %127
84: ; preds = %67
%85 = tail call i32 @atoi(i8* %72)
br label %127
86: ; preds = %12
%87 = load i8*, i8** @optarg
%88 = load i8, i8* %87
%89 = tail call i32 @isdigit(i8 signext %88)
%90 = icmp eq i32 %89, 0
%91 = load i8*, i8** @optarg
br i1 %90, label %92, label %103
92: ; preds = %86
%93 = tail call %struct.group* @getgrnam(i8* %91)
%94 = icmp eq %struct.group* %93, null
br i1 %94, label %95, label %100
95: ; preds = %92
%96 = load i32, i32* @stderr
%97 = load i8*, i8** @optarg
%98 = tail call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %97)
%99 = tail call i32 @Usage_and_abort(i8* %4)
br label %100
100: ; preds = %95, %92
%101 = getelementptr inbounds %struct.group, %struct.group* %93, i64 0, i32 0
%102 = load i32, i32* %101
br label %127
103: ; preds = %86
%104 = tail call i32 @atoi(i8* %91)
br label %127
105: ; preds = %12
%106 = load i8*, i8** @optarg
%107 = icmp eq i8* %106, null
br i1 %107, label %127, label %108
108: ; preds = %105
%109 = load i8, i8* %106
%110 = tail call i32 @isdigit(i8 signext %109)
%111 = icmp eq i32 %110, 0
br i1 %111, label %127, label %112
112: ; preds = %108, %116
%113 = phi i64 [ %120, %116 ], [ 0, %108 ]
%114 = tail call i8* @strsep(i8** @optarg, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%115 = icmp eq i8* %114, null
br i1 %115, label %125, label %116
116: ; preds = %112
%117 = tail call i32 @atoi(i8* %114)
%118 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %117)
%119 = tail call i32 @atoi(i8* %114)
%120 = add nuw nsw i64 %113, 1
%121 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %113
store i32 %119, i32* %121
%122 = icmp eq i64 %120, 32
br i1 %122, label %127, label %112
123: ; preds = %12
%124 = tail call i32 @Usage_and_abort(i8* %4)
br label %127
125: ; preds = %112
%126 = trunc i64 %113 to i32
br label %127
127: ; preds = %116, %125, %42, %100, %103, %81, %84, %62, %65, %105, %108, %123
%128 = phi i32 [ %13, %123 ], [ 0, %105 ], [ 0, %108 ], [ %13, %42 ], [ %13, %65 ], [ %13, %62 ], [ %13, %84 ], [ %13, %81 ], [ %13, %103 ], [ %13, %100 ], [ %126, %125 ], [ 32, %116 ]
%129 = phi i32 [ %14, %123 ], [ %14, %105 ], [ %14, %108 ], [ %43, %42 ], [ %14, %65 ], [ %14, %62 ], [ %14, %84 ], [ %14, %81 ], [ %14, %103 ], [ %14, %100 ], [ %14, %125 ], [ %14, %116 ]
%130 = phi i32 [ %15, %123 ], [ %15, %105 ], [ %15, %108 ], [ %45, %42 ], [ %66, %65 ], [ %64, %62 ], [ %15, %84 ], [ %15, %81 ], [ %15, %103 ], [ %15, %100 ], [ %15, %125 ], [ %15, %116 ]
%131 = phi i32 [ %16, %123 ], [ %16, %105 ], [ %16, %108 ], [ %16, %42 ], [ %16, %65 ], [ %16, %62 ], [ 1, %84 ], [ 1, %81 ], [ %16, %103 ], [ %16, %100 ], [ %16, %125 ], [ %16, %116 ]
%132 = phi i32 [ %17, %123 ], [ %17, %105 ], [ %17, %108 ], [ %17, %42 ], [ %17, %65 ], [ %17, %62 ], [ %17, %84 ], [ %17, %81 ], [ 1, %103 ], [ 1, %100 ], [ %17, %125 ], [ %17, %116 ]
%133 = phi i32 [ %18, %123 ], [ %18, %105 ], [ %18, %108 ], [ %18, %42 ], [ %18, %65 ], [ %18, %62 ], [ %85, %84 ], [ %83, %81 ], [ %18, %103 ], [ %18, %100 ], [ %18, %125 ], [ %18, %116 ]
%134 = phi i32 [ %19, %123 ], [ %19, %105 ], [ %19, %108 ], [ %19, %42 ], [ %19, %65 ], [ %19, %62 ], [ %19, %84 ], [ %19, %81 ], [ %104, %103 ], [ %102, %100 ], [ %19, %125 ], [ %19, %116 ]
%135 = phi i32 [ %20, %123 ], [ %20, %105 ], [ %20, %108 ], [ 1, %42 ], [ %20, %65 ], [ %20, %62 ], [ %20, %84 ], [ %20, %81 ], [ %20, %103 ], [ %20, %100 ], [ %20, %125 ], [ %20, %116 ]
%136 = phi i32 [ %21, %123 ], [ %21, %105 ], [ %21, %108 ], [ %47, %42 ], [ 1, %65 ], [ 1, %62 ], [ %21, %84 ], [ %21, %81 ], [ %21, %103 ], [ %21, %100 ], [ %21, %125 ], [ %21, %116 ]
br label %12
137: ; preds = %12
%138 = icmp eq i32 %20, 0
br i1 %138, label %139, label %143
139: ; preds = %137
%140 = load i32, i32* @stderr
%141 = tail call i32 (i32, i8*, ...) @fprintf(i32 %140, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%142 = tail call i32 @Usage_and_abort(i8* %4)
br label %143
143: ; preds = %139, %137
%144 = load i32, i32* @optind
%145 = icmp eq i32 %144, %0
br i1 %145, label %146, label %151
146: ; preds = %143
%147 = load i32, i32* @stderr
%148 = tail call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%149 = tail call i32 @Usage_and_abort(i8* %4)
%150 = load i32, i32* @optind
br label %151
151: ; preds = %146, %143
%152 = phi i32 [ %150, %146 ], [ %144, %143 ]
%153 = add nsw i32 %0, 1
%154 = sub i32 %153, %152
%155 = shl i32 %154, 3
%156 = tail call i64 @malloc(i32 %155)
%157 = inttoptr i64 %156 to i8**
%158 = inttoptr i64 %156 to i8*
%159 = icmp eq i64 %156, 0
br i1 %159, label %160, label %166
160: ; preds = %151
%161 = load i32, i32* @stderr
%162 = load i32, i32* @errno
%163 = tail call i8* @strerror(i32 %162)
%164 = tail call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %163)
%165 = tail call i32 @exit(i32 -1)
unreachable
166: ; preds = %151
%167 = load i32, i32* @optind
%168 = icmp slt i32 %167, %0
br i1 %168, label %169, label %311
169: ; preds = %166
%170 = sext i32 %167 to i64
%171 = sext i32 %0 to i64
%172 = sub nsw i64 %171, %170
%173 = icmp ult i64 %172, 4
br i1 %173, label %268, label %174
174: ; preds = %169
%175 = sub nsw i64 %171, %170
%176 = getelementptr i8*, i8** %157, i64 %175
%177 = getelementptr i8*, i8** %1, i64 %170
%178 = getelementptr i8*, i8** %1, i64 %171
%179 = bitcast i8** %178 to i8*
%180 = icmp ult i8* %158, %179
%181 = icmp ult i8** %177, %176
%182 = and i1 %180, %181
br i1 %182, label %268, label %183
183: ; preds = %174
%184 = and i64 %172, -4
%185 = add nsw i64 %184, %170
%186 = add nsw i64 %184, -4
%187 = lshr exact i64 %186, 2
%188 = add nuw nsw i64 %187, 1
%189 = and i64 %188, 3
%190 = icmp ult i64 %186, 12
br i1 %190, label %246, label %191
191: ; preds = %183
%192 = and i64 %188, 9223372036854775804
br label %193
193: ; preds = %193, %191
%194 = phi i64 [ 0, %191 ], [ %243, %193 ]
%195 = phi i64 [ 0, %191 ], [ %244, %193 ]
%196 = add i64 %194, %170
%197 = getelementptr inbounds i8*, i8** %1, i64 %196
%198 = bitcast i8** %197 to <2 x i8*>*
%199 = load <2 x i8*>, <2 x i8*>* %198
%200 = getelementptr inbounds i8*, i8** %197, i64 2
%201 = bitcast i8** %200 to <2 x i8*>*
%202 = load <2 x i8*>, <2 x i8*>* %201
%203 = getelementptr inbounds i8*, i8** %157, i64 %194
%204 = bitcast i8** %203 to <2 x i8*>*
store <2 x i8*> %199, <2 x i8*>* %204
%205 = getelementptr inbounds i8*, i8** %203, i64 2
%206 = bitcast i8** %205 to <2 x i8*>*
store <2 x i8*> %202, <2 x i8*>* %206
%207 = or i64 %194, 4
%208 = add i64 %207, %170
%209 = getelementptr inbounds i8*, i8** %1, i64 %208
%210 = bitcast i8** %209 to <2 x i8*>*
%211 = load <2 x i8*>, <2 x i8*>* %210
%212 = getelementptr inbounds i8*, i8** %209, i64 2
%213 = bitcast i8** %212 to <2 x i8*>*
%214 = load <2 x i8*>, <2 x i8*>* %213
%215 = getelementptr inbounds i8*, i8** %157, i64 %207
%216 = bitcast i8** %215 to <2 x i8*>*
store <2 x i8*> %211, <2 x i8*>* %216
%217 = getelementptr inbounds i8*, i8** %215, i64 2
%218 = bitcast i8** %217 to <2 x i8*>*
store <2 x i8*> %214, <2 x i8*>* %218
%219 = or i64 %194, 8
%220 = add i64 %219, %170
%221 = getelementptr inbounds i8*, i8** %1, i64 %220
%222 = bitcast i8** %221 to <2 x i8*>*
%223 = load <2 x i8*>, <2 x i8*>* %222
%224 = getelementptr inbounds i8*, i8** %221, i64 2
%225 = bitcast i8** %224 to <2 x i8*>*
%226 = load <2 x i8*>, <2 x i8*>* %225
%227 = getelementptr inbounds i8*, i8** %157, i64 %219
%228 = bitcast i8** %227 to <2 x i8*>*
store <2 x i8*> %223, <2 x i8*>* %228
%229 = getelementptr inbounds i8*, i8** %227, i64 2
%230 = bitcast i8** %229 to <2 x i8*>*
store <2 x i8*> %226, <2 x i8*>* %230
%231 = or i64 %194, 12
%232 = add i64 %231, %170
%233 = getelementptr inbounds i8*, i8** %1, i64 %232
%234 = bitcast i8** %233 to <2 x i8*>*
%235 = load <2 x i8*>, <2 x i8*>* %234
%236 = getelementptr inbounds i8*, i8** %233, i64 2
%237 = bitcast i8** %236 to <2 x i8*>*
%238 = load <2 x i8*>, <2 x i8*>* %237
%239 = getelementptr inbounds i8*, i8** %157, i64 %231
%240 = bitcast i8** %239 to <2 x i8*>*
store <2 x i8*> %235, <2 x i8*>* %240
%241 = getelementptr inbounds i8*, i8** %239, i64 2
%242 = bitcast i8** %241 to <2 x i8*>*
store <2 x i8*> %238, <2 x i8*>* %242
%243 = add nuw i64 %194, 16
%244 = add nuw i64 %195, 4
%245 = icmp eq i64 %244, %192
br i1 %245, label %246, label %193
246: ; preds = %193, %183
%247 = phi i64 [ 0, %183 ], [ %243, %193 ]
%248 = icmp eq i64 %189, 0
br i1 %248, label %266, label %249
249: ; preds = %246, %249
%250 = phi i64 [ %263, %249 ], [ %247, %246 ]
%251 = phi i64 [ %264, %249 ], [ 0, %246 ]
%252 = add i64 %250, %170
%253 = getelementptr inbounds i8*, i8** %1, i64 %252
%254 = bitcast i8** %253 to <2 x i8*>*
%255 = load <2 x i8*>, <2 x i8*>* %254
%256 = getelementptr inbounds i8*, i8** %253, i64 2
%257 = bitcast i8** %256 to <2 x i8*>*
%258 = load <2 x i8*>, <2 x i8*>* %257
%259 = getelementptr inbounds i8*, i8** %157, i64 %250
%260 = bitcast i8** %259 to <2 x i8*>*
store <2 x i8*> %255, <2 x i8*>* %260
%261 = getelementptr inbounds i8*, i8** %259, i64 2
%262 = bitcast i8** %261 to <2 x i8*>*
store <2 x i8*> %258, <2 x i8*>* %262
%263 = add nuw i64 %250, 4
%264 = add i64 %251, 1
%265 = icmp eq i64 %264, %189
br i1 %265, label %266, label %249
266: ; preds = %249, %246
%267 = icmp eq i64 %172, %184
br i1 %267, label %311, label %268
268: ; preds = %174, %169, %266
%269 = phi i64 [ %170, %174 ], [ %170, %169 ], [ %185, %266 ]
%270 = sub nsw i64 %171, %269
%271 = xor i64 %269, -1
%272 = add nsw i64 %271, %171
%273 = and i64 %270, 3
%274 = icmp eq i64 %273, 0
br i1 %274, label %285, label %275
275: ; preds = %268, %275
%276 = phi i64 [ %282, %275 ], [ %269, %268 ]
%277 = phi i64 [ %283, %275 ], [ 0, %268 ]
%278 = getelementptr inbounds i8*, i8** %1, i64 %276
%279 = load i8*, i8** %278
%280 = sub nsw i64 %276, %170
%281 = getelementptr inbounds i8*, i8** %157, i64 %280
store i8* %279, i8** %281
%282 = add nsw i64 %276, 1
%283 = add i64 %277, 1
%284 = icmp eq i64 %283, %273
br i1 %284, label %285, label %275
285: ; preds = %275, %268
%286 = phi i64 [ %269, %268 ], [ %282, %275 ]
%287 = icmp ult i64 %272, 3
br i1 %287, label %311, label %288
288: ; preds = %285, %288
%289 = phi i64 [ %309, %288 ], [ %286, %285 ]
%290 = getelementptr inbounds i8*, i8** %1, i64 %289
%291 = load i8*, i8** %290
%292 = sub nsw i64 %289, %170
%293 = getelementptr inbounds i8*, i8** %157, i64 %292
store i8* %291, i8** %293
%294 = add nsw i64 %289, 1
%295 = getelementptr inbounds i8*, i8** %1, i64 %294
%296 = load i8*, i8** %295
%297 = sub nsw i64 %294, %170
%298 = getelementptr inbounds i8*, i8** %157, i64 %297
store i8* %296, i8** %298
%299 = add nsw i64 %289, 2
%300 = getelementptr inbounds i8*, i8** %1, i64 %299
%301 = load i8*, i8** %300
%302 = sub nsw i64 %299, %170
%303 = getelementptr inbounds i8*, i8** %157, i64 %302
store i8* %301, i8** %303
%304 = add nsw i64 %289, 3
%305 = getelementptr inbounds i8*, i8** %1, i64 %304
%306 = load i8*, i8** %305
%307 = sub nsw i64 %304, %170
%308 = getelementptr inbounds i8*, i8** %157, i64 %307
store i8* %306, i8** %308
%309 = add nsw i64 %289, 4
%310 = icmp eq i64 %309, %171
br i1 %310, label %311, label %288
311: ; preds = %285, %288, %266, %166
%312 = phi i32 [ %167, %166 ], [ %0, %266 ], [ %0, %288 ], [ %0, %285 ]
%313 = sub nsw i32 %312, %167
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds i8*, i8** %157, i64 %314
store i8* null, i8** %315
%316 = icmp eq i32 %17, 0
%317 = select i1 %316, i32 %15, i32 %19
%318 = tail call i32 @setregid(i32 %15, i32 %317)
%319 = icmp eq i32 %318, -1
br i1 %319, label %320, label %326
320: ; preds = %311
%321 = load i32, i32* @stderr
%322 = load i32, i32* @errno
%323 = tail call i8* @strerror(i32 %322)
%324 = tail call i32 (i32, i8*, ...) @fprintf(i32 %321, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i32 %15, i32 %317, i32 %322, i8* %323)
%325 = tail call i32 @exit(i32 -1)
unreachable
326: ; preds = %311
%327 = icmp sgt i32 %13, -1
br i1 %327, label %328, label %335
328: ; preds = %326
%329 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%330 = call i32 @setgroups(i32 %13, i32* %329)
%331 = icmp eq i32 %330, -1
br i1 %331, label %332, label %335
332: ; preds = %328
%333 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0))
%334 = call i32 @exit(i32 -1)
unreachable
335: ; preds = %328, %326
%336 = icmp eq i32 %16, 0
%337 = select i1 %336, i32 %14, i32 %18
%338 = call i32 @setreuid(i32 %14, i32 %337)
%339 = icmp eq i32 %338, -1
%340 = load i32, i32* @stderr
br i1 %339, label %341, label %346
341: ; preds = %335
%342 = load i32, i32* @errno
%343 = call i8* @strerror(i32 %342)
%344 = call i32 (i32, i8*, ...) @fprintf(i32 %340, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 %14, i32 %337, i32 %342, i8* %343)
%345 = call i32 @exit(i32 -1)
unreachable
346: ; preds = %335
%347 = call i32 (i32, i8*, ...) @fprintf(i32 %340, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), i32 %14, i32 %15, i32 %337, i32 %317)
%348 = icmp sgt i32 %13, 0
br i1 %348, label %349, label %359
349: ; preds = %346
%350 = zext i32 %13 to i64
br label %351
351: ; preds = %349, %351
%352 = phi i64 [ 0, %349 ], [ %357, %351 ]
%353 = load i32, i32* @stderr
%354 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %352
%355 = load i32, i32* %354
%356 = call i32 (i32, i8*, ...) @fprintf(i32 %353, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 %355)
%357 = add nuw nsw i64 %352, 1
%358 = icmp eq i64 %357, %350
br i1 %358, label %359, label %351
359: ; preds = %351, %346
%360 = load i32, i32* @stderr
%361 = call i32 (i32, i8*, ...) @fprintf(i32 %360, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%362 = load i32, i32* @optind
%363 = icmp slt i32 %362, %0
br i1 %363, label %364, label %375
364: ; preds = %359, %364
%365 = phi i64 [ %370, %364 ], [ 0, %359 ]
%366 = load i32, i32* @stderr
%367 = getelementptr inbounds i8*, i8** %157, i64 %365
%368 = load i8*, i8** %367
%369 = call i32 (i32, i8*, ...) @fprintf(i32 %366, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* %368)
%370 = add nuw nsw i64 %365, 1
%371 = load i32, i32* @optind
%372 = sub nsw i32 %0, %371
%373 = sext i32 %372 to i64
%374 = icmp slt i64 %370, %373
br i1 %374, label %364, label %375
375: ; preds = %364, %359
%376 = load i32, i32* @stderr
%377 = call i32 (i32, i8*, ...) @fprintf(i32 %376, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%378 = load i32, i32* @stderr
%379 = call i32 @fflush(i32 %378)
%380 = load i8*, i8** %157
%381 = call i32 @execvp(i8* %380, i8** %157)
%382 = load i32, i32* @stderr
%383 = load i8*, i8** %157
%384 = load i32, i32* @errno
%385 = call i8* @strerror(i32 %384)
%386 = call i32 (i32, i8*, ...) @fprintf(i32 %382, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i8* %383, i32 %384, i8* %385)
%387 = call i32 @exit(i32 -1)
unreachable
}