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

/* Forward declarations */

/* Type definitions */
struct passwd {
  int /*<<< orphan*/ pw_uid;
  int /*<<< orphan*/ pw_gid;
};
struct group {
  char **gr_mem;
  int /*<<< orphan*/ gr_gid;
};
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int NGROUPS_MAX;
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ die2(char *, char *);
int /*<<< orphan*/ execvp(char *, char **);
struct group *getgrent();
int getopt(int, char **, char *);
struct passwd *getpwnam(char *);
int /*<<< orphan*/ help(int);
int optind;
scalar_t__ setgid(int /*<<< orphan*/);
int /*<<< orphan*/ setgrent();
scalar_t__ setgroups(int, int /*<<< orphan*/ *);
scalar_t__ setuid(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ version();
int main(int argc, char **argv) {
  struct passwd *p;
  int use_supp = 0;
  while (1) {
    int c = getopt(argc, argv, "+V?hs");
    if (c == -1)
      break;
    switch (c) {
    case 's':
      use_supp = 1;
      break;
    case 'V':
      version();
    case 'h':
    case '?':
      help(0);
    default:
      help(1);
    }
  }
  if ((argc - optind) < 2)
    help(1);
  p = getpwnam(argv[optind]);
  if (!p)
    die("no such account");
  if (setgid(p->pw_gid) < 0)
    die("unable to setgid");
  if (use_supp) {
    gid_t groups[NGROUPS_MAX];
    size_t n = 0;
    setgrent();
    while (1) {
      char **p;
      struct group *g = getgrent();
      if (g == NULL)
        break;
      for (p = g->gr_mem; *p != NULL; p++) {
        if (strcmp(*p, argv[optind]) == 0) {
          if (n >= NGROUPS_MAX)
            die("too many groups");
          groups[n++] = g->gr_gid;
        }
      }
    }
    if (setgroups(n, groups) < 0)
      die("unable to setgroups");
  } else {
    if (setgroups(1, &p->pw_gid) < 0)
      die("unable to setgroups");
  }
  if (setuid(p->pw_uid) < 0)
    die("unable to setuid");
  ++optind;
  execvp(argv[optind], &argv[optind]);
  die2(argv[optind], "unable to exec");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe05(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1212 <main+0x42>
jmp    1282 <main+0xb2>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4c(%rbp)
sub    $0x3f,%eax
je     126c <main+0x9c>
jmp    1226 <main+0x56>
mov    -0x4c(%rbp),%eax
sub    $0x56,%eax
je     1265 <main+0x95>
jmp    1237 <main+0x67>
mov    -0x4c(%rbp),%eax
sub    $0x68,%eax
je     126c <main+0x9c>
jmp    1248 <main+0x78>
mov    -0x4c(%rbp),%eax
sub    $0x73,%eax
jne    1273 <main+0xa3>
jmp    1259 <main+0x89>
movl   $0x1,-0x1c(%rbp)
jmp    127d <main+0xad>
mov    $0x0,%al
call   1090 <version@plt>
xor    %edi,%edi
call   10d0 <help@plt>
mov    $0x1,%edi
call   10d0 <help@plt>
jmp    11ed <main+0x1d>
mov    -0x8(%rbp),%eax
mov    0x2d5c(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x2,%eax
jge    12a1 <main+0xd1>
mov    $0x1,%edi
call   10d0 <help@plt>
mov    -0x10(%rbp),%rax
mov    0x2d3c(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <getpwnam@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12d3 <main+0x103>
lea    0xd38(%rip),%rdi
call   10b0 <die@plt>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edi
call   10a0 <setgid@plt>
cmp    $0x0,%rax
jge    12f5 <main+0x125>
lea    0xd26(%rip),%rdi
call   10b0 <die@plt>
cmpl   $0x0,-0x1c(%rbp)
je     1428 <main+0x258>
mov    0x2cda(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    $0x0,%al
call   1040 <setgrent@plt>
jmp    1340 <main+0x170>
mov    $0x0,%al
call   1030 <getgrent@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    135b <main+0x18b>
jmp    13f7 <main+0x227>
mov    -0x48(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmpq   $0x0,(%rax)
je     13f2 <main+0x222>
mov    -0x40(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x2c62(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13dc <main+0x20c>
mov    -0x38(%rbp),%rax
mov    0x2c39(%rip),%rcx
movslq (%rcx),%rcx
cmp    %rcx,%rax
jb     13bf <main+0x1ef>
lea    0xc6d(%rip),%rdi
call   10b0 <die@plt>
mov    -0x58(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    0x8(%rcx),%edx
mov    -0x38(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x38(%rbp)
mov    %edx,(%rax,%rcx,4)
jmp    13e1 <main+0x211>
mov    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
jmp    1366 <main+0x196>
jmp    133b <main+0x16b>
mov    -0x58(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    %eax,%edi
call   1060 <setgroups@plt>
cmp    $0x0,%rax
jge    141c <main+0x24c>
lea    0xc20(%rip),%rdi
call   10b0 <die@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
jmp    1455 <main+0x285>
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
mov    $0x1,%edi
call   1060 <setgroups@plt>
cmp    $0x0,%rax
jge    1450 <main+0x280>
lea    0xbec(%rip),%rdi
call   10b0 <die@plt>
jmp    1455 <main+0x285>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   10f0 <setuid@plt>
cmp    $0x0,%rax
jge    1476 <main+0x2a6>
lea    0xbda(%rip),%rdi
call   10b0 <die@plt>
mov    0x2b6b(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2b5f(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x2b52(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2b40(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   10e0 <execvp@plt>
mov    -0x10(%rbp),%rax
mov    0x2b26(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xb8c(%rip),%rsi
call   1050 <die2@plt>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
mov    %edi,%ebx
mov    $0x1,%r15b
lea    0xe10(%rip),%r14
jmp    1218 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1090 <version@plt>
xor    %edi,%edi
call   10d0 <help@plt>
mov    $0x1,%edi
call   10d0 <help@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   10c0 <getopt@plt>
cmp    $0x55,%eax
jle    1240 <main+0x70>
cmp    $0x56,%eax
je     1200 <main+0x30>
cmp    $0x68,%eax
je     1207 <main+0x37>
cmp    $0x73,%eax
jne    120e <main+0x3e>
xor    %r15d,%r15d
jmp    1218 <main+0x48>
xchg   %ax,%ax
cmp    $0x3f,%eax
je     1207 <main+0x37>
cmp    $0xffffffff,%eax
jne    120e <main+0x3e>
mov    0x2d97(%rip),%rax
mov    (%rax),%eax
sub    %eax,%ebx
cmp    $0x1,%ebx
jg     126d <main+0x9d>
mov    $0x1,%edi
call   10d0 <help@plt>
mov    0x2d7d(%rip),%rax
mov    (%rax),%eax
cltq
mov    (%r12,%rax,8),%rdi
call   1080 <getpwnam@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    128c <main+0xbc>
lea    0xd7f(%rip),%rdi
call   10b0 <die@plt>
mov    0x4(%rbx),%edi
call   10a0 <setgid@plt>
test   %rax,%rax
js     12ca <main+0xfa>
test   $0x1,%r15b
je     12dc <main+0x10c>
mov    %rbx,%rsi
add    $0x4,%rsi
mov    $0x1,%edi
call   1060 <setgroups@plt>
test   %rax,%rax
jns    13d1 <main+0x201>
lea    0xd77(%rip),%rdi
call   10b0 <die@plt>
jmp    13d1 <main+0x201>
lea    0xd45(%rip),%rdi
call   10b0 <die@plt>
test   $0x1,%r15b
jne    129f <main+0xcf>
mov    %rbx,-0x38(%rbp)
mov    %rsp,-0x30(%rbp)
mov    0x2cf5(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <setgrent@plt>
xor    %eax,%eax
call   1030 <getgrent@plt>
test   %rax,%rax
je     13ae <main+0x1de>
mov    %rax,%r14
xor    %ebx,%ebx
jmp    133f <main+0x16f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getgrent@plt>
mov    %rax,%r14
test   %rax,%rax
je     13ae <main+0x1de>
mov    (%r14),%r13
mov    0x0(%r13),%rdi
test   %rdi,%rdi
je     1330 <main+0x160>
add    $0x8,%r13
jmp    1379 <main+0x1a9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%r14),%eax
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
mov    0x0(%r13),%rdi
add    $0x8,%r13
test   %rdi,%rdi
je     1330 <main+0x160>
mov    0x2c68(%rip),%rax
movslq (%rax),%rax
mov    (%r12,%rax,8),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    136c <main+0x19c>
mov    0x2c48(%rip),%rax
movslq (%rax),%rax
cmp    %rax,%rbx
jb     1360 <main+0x190>
lea    0xc80(%rip),%rdi
call   10b0 <die@plt>
jmp    1360 <main+0x190>
mov    %ebx,%edi
mov    %r15,%rsi
call   1060 <setgroups@plt>
test   %rax,%rax
jns    13c9 <main+0x1f9>
lea    0xc73(%rip),%rdi
call   10b0 <die@plt>
mov    -0x30(%rbp),%rsp
mov    -0x38(%rbp),%rbx
mov    (%rbx),%edi
call   10f0 <setuid@plt>
test   %rax,%rax
jns    13e9 <main+0x219>
lea    0xc67(%rip),%rdi
call   10b0 <die@plt>
mov    0x2bf8(%rip),%rbx
movslq (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rbx)
lea    (%r12,%rax,8),%rsi
add    $0x8,%rsi
mov    0x8(%r12,%rax,8),%rdi
call   10e0 <execvp@plt>
movslq (%rbx),%rax
mov    (%r12,%rax,8),%rdi
lea    0xc43(%rip),%rsi
call   1050 <die2@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i32, i32 }
%struct.group = type { i8**, i32 }
@.str = [6 x i8] c"+V?hs\00"
@optind = global i32 0
@.str.1 = [16 x i8] c"no such account\00"
@.str.2 = [17 x i8] c"unable to setgid\00"
@NGROUPS_MAX = global i32 0
@.str.3 = [16 x i8] c"too many groups\00"
@.str.4 = [20 x i8] c"unable to setgroups\00"
@.str.5 = [17 x i8] c"unable to setuid\00"
@.str.6 = [15 x i8] c"unable to exec\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.passwd*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i8**
%13 = alloca %struct.group*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %14
14: ; preds = %2, %30
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @getopt(i32 %15, i8** %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %21
20: ; preds = %14
br label %31
21: ; preds = %14
%22 = load i32, i32* %8
switch i32 %22, label %28 [
i32 115, label %23
i32 86, label %24
i32 104, label %26
i32 63, label %26
]
23: ; preds = %21
store i32 1, i32* %7
br label %30
24: ; preds = %21
%25 = call i32 (...) @version()
br label %26
26: ; preds = %21, %21, %24
%27 = call i32 @help(i32 0)
br label %28
28: ; preds = %21, %26
%29 = call i32 @help(i32 1)
br label %30
30: ; preds = %28, %23
br label %14
31: ; preds = %20
%32 = load i32, i32* %4
%33 = load i32, i32* @optind
%34 = sub nsw i32 %32, %33
%35 = icmp slt i32 %34, 2
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @help(i32 1)
br label %38
38: ; preds = %36, %31
%39 = load i8**, i8*** %5
%40 = load i32, i32* @optind
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call %struct.passwd* @getpwnam(i8* %43)
store %struct.passwd* %44, %struct.passwd** %6
%45 = load %struct.passwd*, %struct.passwd** %6
%46 = icmp ne %struct.passwd* %45, null
br i1 %46, label %49, label %47
47: ; preds = %38
%48 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %49
49: ; preds = %47, %38
%50 = load %struct.passwd*, %struct.passwd** %6
%51 = getelementptr inbounds %struct.passwd, %struct.passwd* %50, i32 0, i32 1
%52 = load i32, i32* %51
%53 = call i64 @setgid(i32 %52)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %49
%56 = call i32 @die(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %57
57: ; preds = %55, %49
%58 = load i32, i32* %7
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %118
60: ; preds = %57
%61 = load i32, i32* @NGROUPS_MAX
%62 = zext i32 %61 to i64
%63 = call i8* @llvm.stacksave()
store i8* %63, i8** %9
%64 = alloca i32, i64 %62
store i64 %62, i64* %10
store i64 0, i64* %11
%65 = call i32 (...) @setgrent()
br label %66
66: ; preds = %108, %60
br label %67
67: ; preds = %66
%68 = call %struct.group* (...) @getgrent()
store %struct.group* %68, %struct.group** %13
%69 = load %struct.group*, %struct.group** %13
%70 = icmp eq %struct.group* %69, null
br i1 %70, label %71, label %72
71: ; preds = %67
br label %109
72: ; preds = %67
%73 = load %struct.group*, %struct.group** %13
%74 = getelementptr inbounds %struct.group, %struct.group* %73, i32 0, i32 0
%75 = load i8**, i8*** %74
store i8** %75, i8*** %12
br label %76
76: ; preds = %105, %72
%77 = load i8**, i8*** %12
%78 = load i8*, i8** %77
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %108
80: ; preds = %76
%81 = load i8**, i8*** %12
%82 = load i8*, i8** %81
%83 = load i8**, i8*** %5
%84 = load i32, i32* @optind
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %83, i64 %85
%87 = load i8*, i8** %86
%88 = call i64 @strcmp(i8* %82, i8* %87)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %104
90: ; preds = %80
%91 = load i64, i64* %11
%92 = load i32, i32* @NGROUPS_MAX
%93 = sext i32 %92 to i64
%94 = icmp uge i64 %91, %93
br i1 %94, label %95, label %97
95: ; preds = %90
%96 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %97
97: ; preds = %95, %90
%98 = load %struct.group*, %struct.group** %13
%99 = getelementptr inbounds %struct.group, %struct.group* %98, i32 0, i32 1
%100 = load i32, i32* %99
%101 = load i64, i64* %11
%102 = add i64 %101, 1
store i64 %102, i64* %11
%103 = getelementptr inbounds i32, i32* %64, i64 %101
store i32 %100, i32* %103
br label %104
104: ; preds = %97, %80
br label %105
105: ; preds = %104
%106 = load i8**, i8*** %12
%107 = getelementptr inbounds i8*, i8** %106, i32 1
store i8** %107, i8*** %12
br label %76
108: ; preds = %76
br label %66
109: ; preds = %71
%110 = load i64, i64* %11
%111 = trunc i64 %110 to i32
%112 = call i64 @setgroups(i32 %111, i32* %64)
%113 = icmp slt i64 %112, 0
br i1 %113, label %114, label %116
114: ; preds = %109
%115 = call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %116
116: ; preds = %114, %109
%117 = load i8*, i8** %9
br label %126
118: ; preds = %57
%119 = load %struct.passwd*, %struct.passwd** %6
%120 = getelementptr inbounds %struct.passwd, %struct.passwd* %119, i32 0, i32 1
%121 = call i64 @setgroups(i32 1, i32* %120)
%122 = icmp slt i64 %121, 0
br i1 %122, label %123, label %125
123: ; preds = %118
%124 = call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %125
125: ; preds = %123, %118
br label %126
126: ; preds = %125, %116
%127 = load %struct.passwd*, %struct.passwd** %6
%128 = getelementptr inbounds %struct.passwd, %struct.passwd* %127, i32 0, i32 0
%129 = load i32, i32* %128
%130 = call i64 @setuid(i32 %129)
%131 = icmp slt i64 %130, 0
br i1 %131, label %132, label %134
132: ; preds = %126
%133 = call i32 @die(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %134
134: ; preds = %132, %126
%135 = load i32, i32* @optind
%136 = add nsw i32 %135, 1
store i32 %136, i32* @optind
%137 = load i8**, i8*** %5
%138 = load i32, i32* @optind
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8*, i8** %137, i64 %139
%141 = load i8*, i8** %140
%142 = load i8**, i8*** %5
%143 = load i32, i32* @optind
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8*, i8** %142, i64 %144
%146 = call i32 @execvp(i8* %141, i8** %145)
%147 = load i8**, i8*** %5
%148 = load i32, i32* @optind
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8*, i8** %147, i64 %149
%151 = load i8*, i8** %150
%152 = call i32 @die2(i8* %151, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.passwd = type { i32, i32 }
%struct.group = type { i8**, i32 }
@.str = [6 x i8] c"+V?hs\00"
@optind = global i32 0
@.str.1 = [16 x i8] c"no such account\00"
@.str.2 = [17 x i8] c"unable to setgid\00"
@NGROUPS_MAX = global i32 0
@.str.3 = [16 x i8] c"too many groups\00"
@.str.4 = [20 x i8] c"unable to setgroups\00"
@.str.5 = [17 x i8] c"unable to setuid\00"
@.str.6 = [15 x i8] c"unable to exec\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = phi i1 [ true, %2 ], [ false, %5 ]
br label %5
5: ; preds = %3, %11
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %11 [
i32 -1, label %13
i32 115, label %3
i32 86, label %7
i32 104, label %9
i32 63, label %9
]
7: ; preds = %5
%8 = tail call i32 (...) @version()
br label %9
9: ; preds = %5, %5, %7
%10 = tail call i32 @help(i32 0)
br label %11
11: ; preds = %5, %9
%12 = tail call i32 @help(i32 1)
br label %5
13: ; preds = %5
%14 = load i32, i32* @optind
%15 = sub nsw i32 %0, %14
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = tail call i32 @help(i32 1)
%19 = load i32, i32* @optind
br label %20
20: ; preds = %17, %13
%21 = phi i32 [ %19, %17 ], [ %14, %13 ]
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call %struct.passwd* @getpwnam(i8* %24)
%26 = icmp eq %struct.passwd* %25, null
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = tail call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %20
%30 = getelementptr inbounds %struct.passwd, %struct.passwd* %25, i64 0, i32 1
%31 = load i32, i32* %30
%32 = tail call i64 @setgid(i32 %31)
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = tail call i32 @die(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %29
br i1 %4, label %91, label %37
37: ; preds = %36
%38 = load i32, i32* @NGROUPS_MAX
%39 = zext i32 %38 to i64
%40 = tail call i8* @llvm.stacksave()
%41 = alloca i32, i64 %39
%42 = tail call i32 (...) @setgrent()
%43 = tail call %struct.group* (...) @getgrent()
%44 = icmp eq %struct.group* %43, null
br i1 %44, label %83, label %49
45: ; preds = %78, %49
%46 = phi i64 [ %51, %49 ], [ %79, %78 ]
%47 = tail call %struct.group* (...) @getgrent()
%48 = icmp eq %struct.group* %47, null
br i1 %48, label %83, label %49
49: ; preds = %37, %45
%50 = phi %struct.group* [ %47, %45 ], [ %43, %37 ]
%51 = phi i64 [ %46, %45 ], [ 0, %37 ]
%52 = getelementptr inbounds %struct.group, %struct.group* %50, i64 0, i32 0
%53 = load i8**, i8*** %52
%54 = load i8*, i8** %53
%55 = icmp eq i8* %54, null
br i1 %55, label %45, label %56
56: ; preds = %49
%57 = getelementptr inbounds %struct.group, %struct.group* %50, i64 0, i32 1
br label %58
58: ; preds = %56, %78
%59 = phi i8* [ %54, %56 ], [ %81, %78 ]
%60 = phi i8** [ %53, %56 ], [ %80, %78 ]
%61 = phi i64 [ %51, %56 ], [ %79, %78 ]
%62 = load i32, i32* @optind
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %1, i64 %63
%65 = load i8*, i8** %64
%66 = tail call i64 @strcmp(i8* %59, i8* %65)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %78
68: ; preds = %58
%69 = load i32, i32* @NGROUPS_MAX
%70 = sext i32 %69 to i64
%71 = icmp ult i64 %61, %70
br i1 %71, label %74, label %72
72: ; preds = %68
%73 = tail call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %74
74: ; preds = %72, %68
%75 = load i32, i32* %57
%76 = add i64 %61, 1
%77 = getelementptr inbounds i32, i32* %41, i64 %61
store i32 %75, i32* %77
br label %78
78: ; preds = %58, %74
%79 = phi i64 [ %76, %74 ], [ %61, %58 ]
%80 = getelementptr inbounds i8*, i8** %60, i64 1
%81 = load i8*, i8** %80
%82 = icmp eq i8* %81, null
br i1 %82, label %45, label %58
83: ; preds = %45, %37
%84 = phi i64 [ 0, %37 ], [ %46, %45 ]
%85 = trunc i64 %84 to i32
%86 = call i64 @setgroups(i32 %85, i32* %41)
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %83
%89 = call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %90
90: ; preds = %88, %83
br label %96
91: ; preds = %36
%92 = tail call i64 @setgroups(i32 1, i32* %30)
%93 = icmp slt i64 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %91
%95 = tail call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %96
96: ; preds = %91, %94, %90
%97 = getelementptr inbounds %struct.passwd, %struct.passwd* %25, i64 0, i32 0
%98 = load i32, i32* %97
%99 = call i64 @setuid(i32 %98)
%100 = icmp slt i64 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %96
%102 = call i32 @die(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %103
103: ; preds = %101, %96
%104 = load i32, i32* @optind
%105 = add nsw i32 %104, 1
store i32 %105, i32* @optind
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8*, i8** %1, i64 %106
%108 = load i8*, i8** %107
%109 = call i32 @execvp(i8* %108, i8** %107)
%110 = load i32, i32* @optind
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8*, i8** %1, i64 %111
%113 = load i8*, i8** %112
%114 = call i32 @die2(i8* %113, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}