#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;
};
struct option {
  char *member_0;
  int member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};
struct group {
  char *gr_name;
};
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
scalar_t__ errno;
struct group *getgrgid(int /*<<< orphan*/);
int getgroups(int, int /*<<< orphan*/ *);
int getopt_long_only(int, char **, char *, struct option *,
                     int /*<<< orphan*/ *);
struct passwd *getpwnam(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ no_argument;
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_group_list(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int ret, c;
  struct option long_options[3] = {{"help", no_argument, 0, 0},
                                   {"version", no_argument, 0, 1},
                                   {0, 0, 0, 0}};
  while ((c = getopt_long_only(argc, argv, "", long_options, NULL)) != -1) {
    switch (c) {
    case 0:
      printf("usage: groups [options] [usernames]\n");
      return 0;
      break;
    case 1:
      printf("groups v0.1\n");
      return 0;
      break;
    case '?':
      printf("groups --help for more help\n");
      return 0;
      break;
    }
  }
  if (optind == argc) {
    int ret, cnt, i;
    gid_t *group_list = NULL;
    cnt = getgroups(0, group_list);
    if (cnt > 0) {
      group_list = (gid_t *)malloc(sizeof(gid_t) * cnt);
      if (group_list == NULL) {
        perror("malloc:");
        return -1;
      }
    }
    ret = getgroups(cnt, group_list);
    if (ret == -1) {
      perror("getgroups:");
      return -1;
    }
    for (i = cnt - 1; i >= 0; i--) {
      struct group *grp = NULL;
      grp = getgrgid(group_list[i]);
      if (grp != NULL) {
        printf("%s", grp->gr_name);
      } else {
        perror("getgrgid:");
        return -1;
      }
      if (i != 0)
        printf(" ");
    }
    printf("\n");
  } else {
    while (optind < argc) {
      struct passwd *pwd = NULL;
      errno = 0;
      pwd = getpwnam(argv[optind]);
      if (pwd == NULL && errno == 0) {
        printf("groups: no such user: %s\n", argv[optind++]);
        return -1;
      }
      optind++;
      print_group_list(pwd->pw_uid);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe4c(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x50(%rbp)
add    $0x18,%rdi
lea    0xe28(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x1,-0x38(%rbp)
add    $0x18,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1060 <memset@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rcx
lea    0xe21(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1070 <getopt_long_only@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     12c4 <main+0x134>
mov    -0x18(%rbp),%eax
mov    %eax,-0x8c(%rbp)
test   %eax,%eax
je     1271 <main+0xe1>
jmp    1249 <main+0xb9>
mov    -0x8c(%rbp),%eax
sub    $0x1,%eax
je     128b <main+0xfb>
jmp    125d <main+0xcd>
mov    -0x8c(%rbp),%eax
sub    $0x3f,%eax
je     12a5 <main+0x115>
jmp    12bf <main+0x12f>
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x359>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x359>
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x359>
jmp    120b <main+0x7b>
mov    0x2d1d(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    140c <main+0x27c>
movq   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%rsi
xor    %edi,%edi
call   1090 <getgroups@plt>
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x68(%rbp)
jle    1331 <main+0x1a1>
movslq -0x68(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    132c <main+0x19c>
lea    0xd41(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e9 <main+0x359>
jmp    1331 <main+0x1a1>
mov    -0x68(%rbp),%edi
mov    -0x78(%rbp),%rsi
call   1090 <getgroups@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    1362 <main+0x1d2>
lea    0xd13(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e9 <main+0x359>
mov    -0x68(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jl     13f9 <main+0x269>
movq   $0x0,-0x80(%rbp)
mov    -0x78(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <getgrgid@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
je     13b6 <main+0x226>
mov    -0x80(%rbp),%rax
mov    (%rax),%rsi
lea    0xcc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13ce <main+0x23e>
lea    0xcb5(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e9 <main+0x359>
cmpl   $0x0,-0x6c(%rbp)
je     13e6 <main+0x256>
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13eb <main+0x25b>
mov    -0x6c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x6c(%rbp)
jmp    136b <main+0x1db>
lea    0xc3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14e2 <main+0x352>
jmp    1411 <main+0x281>
mov    0x2bd0(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    14dd <main+0x34d>
movq   $0x0,-0x88(%rbp)
mov    0x2ba3(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x2ba1(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <getpwnam@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jne    14b5 <main+0x325>
mov    0x2b69(%rip),%rax
cmpq   $0x0,(%rax)
jne    14b5 <main+0x325>
mov    -0x10(%rbp),%rax
mov    0x2b64(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2b56(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xbdc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e9 <main+0x359>
mov    0x2b2c(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2b20(%rip),%rax
mov    %ecx,(%rax)
mov    -0x88(%rbp),%rax
mov    (%rax),%edi
call   1050 <print_group_list@plt>
jmp    1411 <main+0x281>
jmp    14e2 <main+0x352>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xea1(%rip),%rax
mov    %rax,(%rsp)
mov    0x2e0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
movq   $0x0,0xc(%rsp)
lea    0xe27(%rip),%rcx
mov    %rcx,0x18(%rsp)
mov    %eax,0x20(%rsp)
movabs $0x100000000,%rax
mov    %rax,0x24(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x40(%rsp)
lea    0xe38(%rip),%r14
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1080 <getopt_long_only@plt>
test   %eax,%eax
jg     1240 <main+0xa0>
cmp    $0xffffffff,%eax
je     125a <main+0xba>
test   %eax,%eax
jne    1210 <main+0x70>
jmp    1305 <main+0x165>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x1,%eax
je     130e <main+0x16e>
cmp    $0x3f,%eax
jne    1210 <main+0x70>
lea    0xded(%rip),%rdi
jmp    1315 <main+0x175>
mov    0x2d87(%rip),%rbx
mov    (%rbx),%eax
cmp    %ebp,%eax
jne    132d <main+0x18d>
xor    %edi,%edi
xor    %esi,%esi
call   10a0 <getgroups@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1390 <main+0x1f0>
lea    0x0(,%rbp,4),%edi
call   10b0 <malloc@plt>
test   %rax,%rax
je     13b6 <main+0x216>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %rax,%rsi
call   10a0 <getgroups@plt>
cmp    $0xffffffff,%eax
je     13ad <main+0x20d>
mov    %ebp,%ebp
add    $0xffffffffffffffff,%rbp
lea    0xd65(%rip),%r14
jmp    12d5 <main+0x135>
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbp),%rax
add    $0x1,%rbp
cmp    $0x1,%rbp
mov    %rax,%rbp
jbe    139e <main+0x1fe>
mov    %ebp,%eax
mov    (%rbx,%rax,4),%edi
call   1060 <getgrgid@plt>
test   %rax,%rax
je     13bf <main+0x21f>
mov    (%rax),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebp,%ebp
je     12c0 <main+0x120>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    12c0 <main+0x120>
lea    0xd5e(%rip),%rdi
jmp    1315 <main+0x175>
lea    0xd49(%rip),%rdi
call   1040 <puts@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
cmp    %ebp,%eax
jge    131d <main+0x17d>
mov    0x2c9d(%rip),%r12
jmp    134d <main+0x1ad>
nopl   (%rax)
mov    (%rax),%edi
call   1070 <print_group_list@plt>
mov    (%rbx),%eax
cmp    %ebp,%eax
jge    131d <main+0x17d>
movq   $0x0,(%r12)
cltq
mov    (%r15,%rax,8),%rdi
call   1090 <getpwnam@plt>
movslq (%rbx),%rcx
lea    0x1(%rcx),%esi
mov    (%r12),%rdx
mov    %esi,(%rbx)
test   %rax,%rax
jne    1340 <main+0x1a0>
test   %rdx,%rdx
jne    1340 <main+0x1a0>
mov    (%r15,%rcx,8),%rsi
lea    0xca7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%r14d
jmp    131d <main+0x17d>
mov    %ebp,%edi
xor    %esi,%esi
call   10a0 <getgroups@plt>
cmp    $0xffffffff,%eax
je     13ad <main+0x20d>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    131a <main+0x17a>
lea    0xc5c(%rip),%rdi
jmp    13c6 <main+0x226>
lea    0xc4b(%rip),%rdi
jmp    13c6 <main+0x226>
lea    0xc58(%rip),%rdi
call   10c0 <perror@plt>
mov    $0xffffffff,%r14d
jmp    131d <main+0x17d>

LLVM IR (-O0):
%struct.option = type { i8*, i32, i32, i32 }
%struct.group = type { i8* }
%struct.passwd = type { i32 }
@.str = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [37 x i8] c"usage: groups [options] [usernames]\0A\00"
@.str.4 = [13 x i8] c"groups v0.1\0A\00"
@.str.5 = [29 x i8] c"groups --help for more help\0A\00"
@optind = global i32 0
@.str.6 = [8 x i8] c"malloc:\00"
@.str.7 = [11 x i8] c"getgroups:\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [10 x i8] c"getgrgid:\00"
@.str.10 = [2 x i8] c" \00"
@.str.11 = [2 x i8] c"\0A\00"
@errno = global i64 0
@.str.12 = [26 x i8] c"groups: no such user: %s\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 [3 x %struct.option]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca %struct.group*
%14 = alloca %struct.passwd*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %8, i64 0, i64 0
%16 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 1
%18 = load i32, i32* @no_argument
store i32 %18, i32* %17
%19 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 2
store i32 0, i32* %19
%20 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 3
store i32 0, i32* %20
%21 = getelementptr inbounds %struct.option, %struct.option* %15, i64 1
%22 = getelementptr inbounds %struct.option, %struct.option* %21, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %22
%23 = getelementptr inbounds %struct.option, %struct.option* %21, i32 0, i32 1
%24 = load i32, i32* @no_argument
store i32 %24, i32* %23
%25 = getelementptr inbounds %struct.option, %struct.option* %21, i32 0, i32 2
store i32 0, i32* %25
%26 = getelementptr inbounds %struct.option, %struct.option* %21, i32 0, i32 3
store i32 1, i32* %26
%27 = getelementptr inbounds %struct.option, %struct.option* %21, i64 1
%28 = bitcast %struct.option* %27 to i8*
br label %29
29: ; preds = %43, %2
%30 = load i32, i32* %4
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %8, i64 0, i64 0
%33 = call i32 @getopt_long_only(i32 %30, i8** %31, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %struct.option* %32, i32* null)
store i32 %33, i32* %7
%34 = icmp ne i32 %33, -1
br i1 %34, label %35, label %44
35: ; preds = %29
%36 = load i32, i32* %7
switch i32 %36, label %43 [
i32 0, label %37
i32 1, label %39
i32 63, label %41
]
37: ; preds = %35
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %140
39: ; preds = %35
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %140
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %140
43: ; preds = %35
br label %29
44: ; preds = %29
%45 = load i32, i32* @optind
%46 = load i32, i32* %4
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %106
48: ; preds = %44
store i32* null, i32** %12
%49 = load i32*, i32** %12
%50 = call i32 @getgroups(i32 0, i32* %49)
store i32 %50, i32* %10
%51 = load i32, i32* %10
%52 = icmp sgt i32 %51, 0
br i1 %52, label %53, label %65
53: ; preds = %48
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = mul i64 4, %55
%57 = trunc i64 %56 to i32
%58 = call i64 @malloc(i32 %57)
%59 = inttoptr i64 %58 to i32*
store i32* %59, i32** %12
%60 = load i32*, i32** %12
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %64
62: ; preds = %53
%63 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %140
64: ; preds = %53
br label %65
65: ; preds = %64, %48
%66 = load i32, i32* %10
%67 = load i32*, i32** %12
%68 = call i32 @getgroups(i32 %66, i32* %67)
store i32 %68, i32* %9
%69 = load i32, i32* %9
%70 = icmp eq i32 %69, -1
br i1 %70, label %71, label %73
71: ; preds = %65
%72 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %3
br label %140
73: ; preds = %65
%74 = load i32, i32* %10
%75 = sub nsw i32 %74, 1
store i32 %75, i32* %11
br label %76
76: ; preds = %101, %73
%77 = load i32, i32* %11
%78 = icmp sge i32 %77, 0
br i1 %78, label %79, label %104
79: ; preds = %76
store %struct.group* null, %struct.group** %13
%80 = load i32*, i32** %12
%81 = load i32, i32* %11
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %80, i64 %82
%84 = load i32, i32* %83
%85 = call %struct.group* @getgrgid(i32 %84)
store %struct.group* %85, %struct.group** %13
%86 = load %struct.group*, %struct.group** %13
%87 = icmp ne %struct.group* %86, null
br i1 %87, label %88, label %93
88: ; preds = %79
%89 = load %struct.group*, %struct.group** %13
%90 = getelementptr inbounds %struct.group, %struct.group* %89, i32 0, i32 0
%91 = load i8*, i8** %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %91)
br label %95
93: ; preds = %79
%94 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %3
br label %140
95: ; preds = %88
%96 = load i32, i32* %11
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %95
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %100
100: ; preds = %98, %95
br label %101
101: ; preds = %100
%102 = load i32, i32* %11
%103 = add nsw i32 %102, -1
store i32 %103, i32* %11
br label %76
104: ; preds = %76
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %139
106: ; preds = %44
br label %107
107: ; preds = %131, %106
%108 = load i32, i32* @optind
%109 = load i32, i32* %4
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %138
111: ; preds = %107
store %struct.passwd* null, %struct.passwd** %14
store i64 0, i64* @errno
%112 = load i8**, i8*** %5
%113 = load i32, i32* @optind
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8*, i8** %112, i64 %114
%116 = load i8*, i8** %115
%117 = call %struct.passwd* @getpwnam(i8* %116)
store %struct.passwd* %117, %struct.passwd** %14
%118 = load %struct.passwd*, %struct.passwd** %14
%119 = icmp eq %struct.passwd* %118, null
br i1 %119, label %120, label %131
120: ; preds = %111
%121 = load i64, i64* @errno
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %131
123: ; preds = %120
%124 = load i8**, i8*** %5
%125 = load i32, i32* @optind
%126 = add nsw i32 %125, 1
store i32 %126, i32* @optind
%127 = sext i32 %125 to i64
%128 = getelementptr inbounds i8*, i8** %124, i64 %127
%129 = load i8*, i8** %128
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* %129)
store i32 -1, i32* %3
br label %140
131: ; preds = %120, %111
%132 = load i32, i32* @optind
%133 = add nsw i32 %132, 1
store i32 %133, i32* @optind
%134 = load %struct.passwd*, %struct.passwd** %14
%135 = getelementptr inbounds %struct.passwd, %struct.passwd* %134, i32 0, i32 0
%136 = load i32, i32* %135
%137 = call i32 @print_group_list(i32 %136)
br label %107
138: ; preds = %107
br label %139
139: ; preds = %138, %104
store i32 0, i32* %3
br label %140
140: ; preds = %139, %123, %93, %71, %62, %41, %39, %37
%141 = load i32, i32* %3
ret i32 %141
}

LLVM IR (-O2):
%struct.option = type { i8*, i32, i32, i32 }
%struct.group = type { i8* }
%struct.passwd = type { i32 }
@.str = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [1 x i8] zeroinitializer
@optind = global i32 0
@.str.6 = [8 x i8] c"malloc:\00"
@.str.7 = [11 x i8] c"getgroups:\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [10 x i8] c"getgrgid:\00"
@errno = global i64 0
@.str.12 = [26 x i8] c"groups: no such user: %s\0A\00"
@str = [28 x i8] c"groups --help for more help\00"
@str.13 = [12 x i8] c"groups v0.1\00"
@str.14 = [36 x i8] c"usage: groups [options] [usernames]\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [3 x %struct.option]
%4 = bitcast [3 x %struct.option]* %3 to i8*
%5 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0
%6 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 1
%8 = load i32, i32* @no_argument
store i32 %8, i32* %7
%9 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 2
store i32 0, i32* %9
%10 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 3
store i32 0, i32* %10
%11 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 1
store i32 %8, i32* %12
%13 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 2
store i32 0, i32* %13
%14 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 3
store i32 1, i32* %14
%15 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 2
%16 = bitcast %struct.option* %15 to i8*
br label %17
17: ; preds = %17, %2
%18 = call i32 @getopt_long_only(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %struct.option* %5, i32* null)
switch i32 %18, label %17 [
i32 -1, label %25
i32 0, label %19
i32 1, label %21
i32 63, label %23
]
19: ; preds = %17
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.14, i64 0, i64 0))
br label %95
21: ; preds = %17
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.13, i64 0, i64 0))
br label %95
23: ; preds = %17
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %95
25: ; preds = %17
%26 = load i32, i32* @optind
%27 = icmp eq i32 %26, %0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = icmp slt i32 %26, %0
br i1 %29, label %72, label %95
30: ; preds = %25
%31 = call i32 @getgroups(i32 0, i32* null)
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = shl i32 %31, 2
%35 = call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to i32*
%37 = icmp eq i64 %35, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %95
40: ; preds = %33
%41 = call i32 @getgroups(i32 %31, i32* %36)
%42 = icmp eq i32 %41, -1
br i1 %42, label %48, label %46
43: ; preds = %30
%44 = call i32 @getgroups(i32 %31, i32* null)
%45 = icmp eq i32 %44, -1
br i1 %45, label %48, label %70
46: ; preds = %40
%47 = zext i32 %31 to i64
br label %50
48: ; preds = %43, %40
%49 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %95
50: ; preds = %46, %68
%51 = phi i64 [ %47, %46 ], [ %52, %68 ]
%52 = add nsw i64 %51, -1
%53 = and i64 %52, 4294967295
%54 = getelementptr inbounds i32, i32* %36, i64 %53
%55 = load i32, i32* %54
%56 = call %struct.group* @getgrgid(i32 %55)
%57 = icmp eq %struct.group* %56, null
br i1 %57, label %64, label %58
58: ; preds = %50
%59 = trunc i64 %52 to i32
%60 = getelementptr inbounds %struct.group, %struct.group* %56, i64 0, i32 0
%61 = load i8*, i8** %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %61)
%63 = icmp eq i32 %59, 0
br i1 %63, label %68, label %66
64: ; preds = %50
%65 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %95
66: ; preds = %58
%67 = call i32 @putchar(i32 32)
br label %68
68: ; preds = %58, %66
%69 = icmp ugt i64 %51, 1
br i1 %69, label %50, label %70
70: ; preds = %68, %43
%71 = call i32 @putchar(i32 10)
br label %95
72: ; preds = %28, %89
%73 = phi i32 [ %93, %89 ], [ %26, %28 ]
store i64 0, i64* @errno
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %1, i64 %74
%76 = load i8*, i8** %75
%77 = call %struct.passwd* @getpwnam(i8* %76)
%78 = icmp eq %struct.passwd* %77, null
%79 = load i64, i64* @errno
%80 = icmp eq i64 %79, 0
%81 = select i1 %78, i1 %80, i1 false
%82 = load i32, i32* @optind
%83 = add nsw i32 %82, 1
store i32 %83, i32* @optind
br i1 %81, label %84, label %89
84: ; preds = %72
%85 = sext i32 %82 to i64
%86 = getelementptr inbounds i8*, i8** %1, i64 %85
%87 = load i8*, i8** %86
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* %87)
br label %95
89: ; preds = %72
%90 = getelementptr inbounds %struct.passwd, %struct.passwd* %77, i64 0, i32 0
%91 = load i32, i32* %90
%92 = call i32 @print_group_list(i32 %91)
%93 = load i32, i32* @optind
%94 = icmp slt i32 %93, %0
br i1 %94, label %72, label %95
95: ; preds = %89, %28, %64, %38, %48, %70, %84, %23, %21, %19
%96 = phi i32 [ 0, %23 ], [ 0, %21 ], [ 0, %19 ], [ -1, %84 ], [ 0, %70 ], [ -1, %48 ], [ -1, %38 ], [ -1, %64 ], [ 0, %28 ], [ 0, %89 ]
ret i32 %96
}