#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;
  char *pw_name;
  int pw_gid;
};
struct group {
  char *gr_name;
  char *gr_gid;
  char **gr_mem;
};
typedef int gid_t;

/* Variables and functions */
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ endgrent();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
scalar_t__ getegid();
scalar_t__ geteuid();
scalar_t__ getgid();
struct group *getgrent();
struct group *getgrgid(int);
int getgroups(int, int *);
struct passwd *getpwnam(char *);
struct passwd *getpwuid(int);
scalar_t__ getuid();
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ usage(int, char *);
int main(int argc, char *argv[]) {
  struct passwd *pw;
  struct group *gp;
  int current_user = 0;
  uid_t id;
  int i;
  if (argc > 2)
    usage(1, NULL);
  if (argc == 1) {
    id = getuid();
    current_user = 1;
    if (!(pw = getpwuid(id)))
      usage(1, "Username does not exist");
  } else {
    if (!(pw = getpwnam(argv[1])))
      usage(1, "Username does not exist");
    id = pw->pw_uid;
  }
  printf("uid=%d(%s)", id, pw->pw_name);
  if (gp = getgrgid(pw->pw_gid))
    printf(" gid=%d(%s)", pw->pw_gid, gp->gr_name);
  if (current_user) {
    gid_t *gid_list;
    int gid_size;
    if (getuid() != geteuid()) {
      id = geteuid();
      if (!(pw = getpwuid(id)))
        usage(1, "Username does not exist");
      printf(" euid=%d(%s)", id, pw->pw_name);
    }
    if (getgid() != getegid()) {
      id = getegid();
      if (!(gp = getgrgid(id)))
        usage(1, "Group does not exist");
      printf(" egid=%d(%s)", id, gp->gr_name);
    }
    gid_size = getgroups(0, NULL);
    if (gid_size) {
      gid_list = malloc(gid_size * sizeof(gid_t));
      getgroups(gid_size, gid_list);
      for (i = 0; i < gid_size; i++) {
        if (!(gp = getgrgid(gid_list[i])))
          die("Group does not exist");
        printf("%s%d(%s)", (i == 0) ? " groups=" : ",", gp->gr_gid,
               gp->gr_name);
      }
      free(gid_list);
    }
  } else {
    i = 0;
    while (gp = getgrent()) {
      char *c = *(gp->gr_mem);
      while (c && *c) {
        if (!strncmp(c, pw->pw_name, 16)) {
          printf("%s%d(%s)", (i++ == 0) ? " groups=" : ",", gp->gr_gid,
                 gp->gr_name);
          c = NULL;
        } else {
          c++;
        }
      }
    }
    endgrent();
  }
  printf("\n");
  exit(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,-0x24(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1245 <main+0x35>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1110 <usage@plt>
cmpl   $0x1,-0x8(%rbp)
jne    128c <main+0x7c>
mov    $0x0,%al
call   1080 <getuid@plt>
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x28(%rbp),%edi
call   1070 <getpwuid@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1287 <main+0x77>
mov    $0x1,%edi
lea    0xd7e(%rip),%rsi
call   1110 <usage@plt>
jmp    12c1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <getpwnam@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12b8 <main+0xa8>
mov    $0x1,%edi
lea    0xd4d(%rip),%rsi
call   1110 <usage@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   10a0 <getgrgid@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1310 <main+0x100>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x24(%rbp)
je     14b6 <main+0x2a6>
mov    $0x0,%al
call   1080 <getuid@plt>
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   10b0 <geteuid@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
je     1386 <main+0x176>
mov    $0x0,%al
call   10b0 <geteuid@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
call   1070 <getpwuid@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    136d <main+0x15d>
mov    $0x1,%edi
lea    0xc98(%rip),%rsi
call   1110 <usage@plt>
mov    -0x28(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xca5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x0,%al
call   10d0 <getgid@plt>
mov    %rax,-0x58(%rbp)
mov    $0x0,%al
call   1100 <getegid@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
je     13f1 <main+0x1e1>
mov    $0x0,%al
call   1100 <getegid@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
call   10a0 <getgrgid@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    13d9 <main+0x1c9>
mov    $0x1,%edi
lea    0xc5d(%rip),%rsi
call   1110 <usage@plt>
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
lea    0xc5c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
call   10e0 <getgroups@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     14b1 <main+0x2a1>
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   10e0 <getgroups@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    14a8 <main+0x298>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   10a0 <getgrgid@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1465 <main+0x255>
lea    0xbd1(%rip),%rdi
call   1120 <die@plt>
mov    -0x2c(%rbp),%ecx
lea    0xbf6(%rip),%rsi
lea    0xbe6(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
lea    0xbc0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    142f <main+0x21f>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
jmp    1597 <main+0x387>
movl   $0x0,-0x2c(%rbp)
mov    $0x0,%al
call   1060 <getgrent@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1590 <main+0x380>
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x48(%rbp)
mov    %al,-0x59(%rbp)
je     1501 <main+0x2f1>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    1511 <main+0x301>
jmp    158b <main+0x37b>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x10,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%eax
jne    157a <main+0x36a>
mov    -0x2c(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
lea    0xb23(%rip),%rsi
lea    0xb13(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
lea    0xaed(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movq   $0x0,-0x48(%rbp)
jmp    1586 <main+0x376>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    14e1 <main+0x2d1>
jmp    14bd <main+0x2ad>
mov    $0x0,%al
call   1030 <endgrent@plt>
lea    0xac9(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %edi,%edi
call   1130 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jl     1241 <main+0x21>
mov    $0x1,%edi
xor    %esi,%esi
call   1120 <usage@plt>
jmp    127a <main+0x5a>
cmp    $0x1,%edi
jne    127a <main+0x5a>
xor    %ebp,%ebp
xor    %eax,%eax
call   1090 <getuid@plt>
mov    %rax,%rbx
mov    %ebx,%edi
call   1080 <getpwuid@plt>
test   %rax,%rax
jne    14fa <main+0x2da>
lea    0xd97(%rip),%rsi
mov    $0x1,%edi
call   1120 <usage@plt>
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    12a2 <main+0x82>
mov    0x8(%rbx),%rdi
call   10d0 <getpwnam@plt>
mov    %rax,%r15
test   %rax,%rax
jne    129c <main+0x7c>
lea    0xd6e(%rip),%rsi
mov    $0x1,%edi
call   1120 <usage@plt>
mov    (%r15),%ebx
mov    $0x1,%bpl
mov    0x8(%r15),%rdx
lea    0xd79(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x10(%r15),%edi
call   10b0 <getgrgid@plt>
test   %rax,%rax
je     12d9 <main+0xb9>
mov    0x10(%r15),%esi
mov    (%rax),%rdx
lea    0xd46(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
xor    %eax,%eax
test   %bpl,%bpl
je     12fa <main+0xda>
call   1070 <getgrent@plt>
test   %rax,%rax
jne    144e <main+0x22e>
xor    %eax,%eax
call   1030 <endgrent@plt>
jmp    14e9 <main+0x2c9>
call   1090 <getuid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   10c0 <geteuid@plt>
cmp    %rax,%rbx
je     134e <main+0x12e>
xor    %eax,%eax
call   10c0 <geteuid@plt>
mov    %rax,%r14
mov    %r14d,%edi
call   1080 <getpwuid@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1339 <main+0x119>
lea    0xcd1(%rip),%rsi
mov    $0x1,%edi
call   1120 <usage@plt>
mov    0x8(%rbx),%rdx
lea    0xce0(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
xor    %eax,%eax
call   10e0 <getgid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1110 <getegid@plt>
cmp    %rax,%rbx
je     13a3 <main+0x183>
xor    %eax,%eax
call   1110 <getegid@plt>
mov    %rax,%r14
mov    %r14d,%edi
call   10b0 <getgrgid@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    138f <main+0x16f>
lea    0xcac(%rip),%rsi
mov    $0x1,%edi
call   1120 <usage@plt>
mov    (%rbx),%rdx
lea    0xcad(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10f0 <getgroups@plt>
test   %eax,%eax
je     14e9 <main+0x2c9>
mov    %eax,%r14d
lea    0x0(,%r14,4),%edi
call   1100 <malloc@plt>
mov    %rax,%r12
mov    %r14d,%edi
mov    %rax,%rsi
call   10f0 <getgroups@plt>
test   %r14d,%r14d
jle    14e1 <main+0x2c1>
mov    %r14d,%ebp
lea    0xc80(%rip),%r14
lea    0xc67(%rip),%r15
xor    %r13d,%r13d
jmp    142f <main+0x20f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %r13,%r13
mov    %r14,%rsi
lea    0xc4f(%rip),%rax
cmove  %rax,%rsi
mov    (%rbx),%rcx
mov    0x8(%rbx),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
je     14e1 <main+0x2c1>
mov    (%r12,%r13,4),%edi
call   10b0 <getgrgid@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1400 <main+0x1e0>
lea    0xbea(%rip),%rdi
call   1130 <die@plt>
jmp    1400 <main+0x1e0>
mov    %rax,%r12
lea    0xc0d(%rip),%rbp
lea    0xbf4(%rip),%r14
xor    %r13d,%r13d
jmp    14a3 <main+0x283>
lea    0x1(%r13),%ebx
test   %r13d,%r13d
mov    %rbp,%rsi
lea    0xbe7(%rip),%rax
cmove  %rax,%rsi
mov    (%r12),%rcx
mov    0x8(%r12),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %ebx,%r13d
nop
xor    %eax,%eax
call   1070 <getgrent@plt>
mov    %rax,%r12
test   %rax,%rax
je     12ee <main+0xce>
mov    0x10(%r12),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
je     1490 <main+0x270>
cmpb   $0x0,(%rbx)
je     1490 <main+0x270>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%r15),%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
call   1060 <strncmp@plt>
test   %eax,%eax
je     1464 <main+0x244>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    14c0 <main+0x2a0>
jmp    1490 <main+0x270>
mov    %r12,%rdi
call   1040 <free@plt>
mov    $0xa,%edi
call   1050 <putchar@plt>
xor    %edi,%edi
call   1140 <exit@plt>
mov    %rax,%r15
jmp    12a2 <main+0x82>

LLVM IR (-O0):
%struct.passwd = type { i32, i8*, i32 }
%struct.group = type { i8*, i8*, i8** }
@.str = [24 x i8] c"Username does not exist\00"
@.str.1 = [11 x i8] c"uid=%d(%s)\00"
@.str.2 = [12 x i8] c" gid=%d(%s)\00"
@.str.3 = [13 x i8] c" euid=%d(%s)\00"
@.str.4 = [21 x i8] c"Group does not exist\00"
@.str.5 = [13 x i8] c" egid=%d(%s)\00"
@.str.6 = [9 x i8] c"%s%d(%s)\00"
@.str.7 = [9 x i8] c" groups=\00"
@.str.8 = [2 x i8] c",\00"
@.str.9 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.passwd*
%7 = alloca %struct.group*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 @usage(i32 1, i8* null)
br label %18
18: ; preds = %16, %2
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = call i64 (...) @getuid()
%23 = trunc i64 %22 to i32
store i32 %23, i32* %9
store i32 1, i32* %8
%24 = load i32, i32* %9
%25 = call %struct.passwd* @getpwuid(i32 %24)
store %struct.passwd* %25, %struct.passwd** %6
%26 = icmp ne %struct.passwd* %25, null
br i1 %26, label %29, label %27
27: ; preds = %21
%28 = call i32 @usage(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %29
29: ; preds = %27, %21
br label %42
30: ; preds = %18
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call %struct.passwd* @getpwnam(i8* %33)
store %struct.passwd* %34, %struct.passwd** %6
%35 = icmp ne %struct.passwd* %34, null
br i1 %35, label %38, label %36
36: ; preds = %30
%37 = call i32 @usage(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %38
38: ; preds = %36, %30
%39 = load %struct.passwd*, %struct.passwd** %6
%40 = getelementptr inbounds %struct.passwd, %struct.passwd* %39, i32 0, i32 0
%41 = load i32, i32* %40
store i32 %41, i32* %9
br label %42
42: ; preds = %38, %29
%43 = load i32, i32* %9
%44 = load %struct.passwd*, %struct.passwd** %6
%45 = getelementptr inbounds %struct.passwd, %struct.passwd* %44, i32 0, i32 1
%46 = load i8*, i8** %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %43, i8* %46)
%48 = load %struct.passwd*, %struct.passwd** %6
%49 = getelementptr inbounds %struct.passwd, %struct.passwd* %48, i32 0, i32 2
%50 = load i32, i32* %49
%51 = call %struct.group* @getgrgid(i32 %50)
store %struct.group* %51, %struct.group** %7
%52 = icmp ne %struct.group* %51, null
br i1 %52, label %53, label %61
53: ; preds = %42
%54 = load %struct.passwd*, %struct.passwd** %6
%55 = getelementptr inbounds %struct.passwd, %struct.passwd* %54, i32 0, i32 2
%56 = load i32, i32* %55
%57 = load %struct.group*, %struct.group** %7
%58 = getelementptr inbounds %struct.group, %struct.group* %57, i32 0, i32 0
%59 = load i8*, i8** %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %56, i8* %59)
br label %61
61: ; preds = %53, %42
%62 = load i32, i32* %8
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %146
64: ; preds = %61
%65 = call i64 (...) @getuid()
%66 = call i64 (...) @geteuid()
%67 = icmp ne i64 %65, %66
br i1 %67, label %68, label %82
68: ; preds = %64
%69 = call i64 (...) @geteuid()
%70 = trunc i64 %69 to i32
store i32 %70, i32* %9
%71 = load i32, i32* %9
%72 = call %struct.passwd* @getpwuid(i32 %71)
store %struct.passwd* %72, %struct.passwd** %6
%73 = icmp ne %struct.passwd* %72, null
br i1 %73, label %76, label %74
74: ; preds = %68
%75 = call i32 @usage(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %76
76: ; preds = %74, %68
%77 = load i32, i32* %9
%78 = load %struct.passwd*, %struct.passwd** %6
%79 = getelementptr inbounds %struct.passwd, %struct.passwd* %78, i32 0, i32 1
%80 = load i8*, i8** %79
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %77, i8* %80)
br label %82
82: ; preds = %76, %64
%83 = call i64 (...) @getgid()
%84 = call i64 (...) @getegid()
%85 = icmp ne i64 %83, %84
br i1 %85, label %86, label %100
86: ; preds = %82
%87 = call i64 (...) @getegid()
%88 = trunc i64 %87 to i32
store i32 %88, i32* %9
%89 = load i32, i32* %9
%90 = call %struct.group* @getgrgid(i32 %89)
store %struct.group* %90, %struct.group** %7
%91 = icmp ne %struct.group* %90, null
br i1 %91, label %94, label %92
92: ; preds = %86
%93 = call i32 @usage(i32 1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %94
94: ; preds = %92, %86
%95 = load i32, i32* %9
%96 = load %struct.group*, %struct.group** %7
%97 = getelementptr inbounds %struct.group, %struct.group* %96, i32 0, i32 0
%98 = load i8*, i8** %97
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %95, i8* %98)
br label %100
100: ; preds = %94, %82
%101 = call i32 @getgroups(i32 0, i32* null)
store i32 %101, i32* %12
%102 = load i32, i32* %12
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %145
104: ; preds = %100
%105 = load i32, i32* %12
%106 = sext i32 %105 to i64
%107 = mul i64 %106, 4
%108 = trunc i64 %107 to i32
%109 = call i32* @malloc(i32 %108)
store i32* %109, i32** %11
%110 = load i32, i32* %12
%111 = load i32*, i32** %11
%112 = call i32 @getgroups(i32 %110, i32* %111)
store i32 0, i32* %10
br label %113
113: ; preds = %139, %104
%114 = load i32, i32* %10
%115 = load i32, i32* %12
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %142
117: ; preds = %113
%118 = load i32*, i32** %11
%119 = load i32, i32* %10
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %118, i64 %120
%122 = load i32, i32* %121
%123 = call %struct.group* @getgrgid(i32 %122)
store %struct.group* %123, %struct.group** %7
%124 = icmp ne %struct.group* %123, null
br i1 %124, label %127, label %125
125: ; preds = %117
%126 = call i32 @die(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %127
127: ; preds = %125, %117
%128 = load i32, i32* %10
%129 = icmp eq i32 %128, 0
%130 = zext i1 %129 to i64
%131 = select i1 %129, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
%132 = load %struct.group*, %struct.group** %7
%133 = getelementptr inbounds %struct.group, %struct.group* %132, i32 0, i32 1
%134 = load i8*, i8** %133
%135 = load %struct.group*, %struct.group** %7
%136 = getelementptr inbounds %struct.group, %struct.group* %135, i32 0, i32 0
%137 = load i8*, i8** %136
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %131, i8* %134, i8* %137)
br label %139
139: ; preds = %127
%140 = load i32, i32* %10
%141 = add nsw i32 %140, 1
store i32 %141, i32* %10
br label %113
142: ; preds = %113
%143 = load i32*, i32** %11
%144 = call i32 @free(i32* %143)
br label %145
145: ; preds = %142, %100
br label %192
146: ; preds = %61
store i32 0, i32* %10
br label %147
147: ; preds = %189, %146
%148 = call %struct.group* (...) @getgrent()
store %struct.group* %148, %struct.group** %7
%149 = icmp ne %struct.group* %148, null
br i1 %149, label %150, label %190
150: ; preds = %147
%151 = load %struct.group*, %struct.group** %7
%152 = getelementptr inbounds %struct.group, %struct.group* %151, i32 0, i32 2
%153 = load i8**, i8*** %152
%154 = load i8*, i8** %153
store i8* %154, i8** %13
br label %155
155: ; preds = %188, %150
%156 = load i8*, i8** %13
%157 = icmp ne i8* %156, null
br i1 %157, label %158, label %163
158: ; preds = %155
%159 = load i8*, i8** %13
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp ne i32 %161, 0
br label %163
163: ; preds = %158, %155
%164 = phi i1 [ false, %155 ], [ %162, %158 ]
br i1 %164, label %165, label %189
165: ; preds = %163
%166 = load i8*, i8** %13
%167 = load %struct.passwd*, %struct.passwd** %6
%168 = getelementptr inbounds %struct.passwd, %struct.passwd* %167, i32 0, i32 1
%169 = load i8*, i8** %168
%170 = call i32 @strncmp(i8* %166, i8* %169, i32 16)
%171 = icmp ne i32 %170, 0
br i1 %171, label %185, label %172
172: ; preds = %165
%173 = load i32, i32* %10
%174 = add nsw i32 %173, 1
store i32 %174, i32* %10
%175 = icmp eq i32 %173, 0
%176 = zext i1 %175 to i64
%177 = select i1 %175, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
%178 = load %struct.group*, %struct.group** %7
%179 = getelementptr inbounds %struct.group, %struct.group* %178, i32 0, i32 1
%180 = load i8*, i8** %179
%181 = load %struct.group*, %struct.group** %7
%182 = getelementptr inbounds %struct.group, %struct.group* %181, i32 0, i32 0
%183 = load i8*, i8** %182
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %177, i8* %180, i8* %183)
store i8* null, i8** %13
br label %188
185: ; preds = %165
%186 = load i8*, i8** %13
%187 = getelementptr inbounds i8, i8* %186, i32 1
store i8* %187, i8** %13
br label %188
188: ; preds = %185, %172
br label %155
189: ; preds = %163
br label %147
190: ; preds = %147
%191 = call i32 (...) @endgrent()
br label %192
192: ; preds = %190, %145
%193 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%194 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.passwd = type { i32, i8*, i32 }
%struct.group = type { i8*, i8*, i8** }
@.str = [24 x i8] c"Username does not exist\00"
@.str.1 = [11 x i8] c"uid=%d(%s)\00"
@.str.2 = [12 x i8] c" gid=%d(%s)\00"
@.str.3 = [13 x i8] c" euid=%d(%s)\00"
@.str.4 = [21 x i8] c"Group does not exist\00"
@.str.5 = [13 x i8] c" egid=%d(%s)\00"
@.str.6 = [9 x i8] c"%s%d(%s)\00"
@.str.7 = [9 x i8] c" groups=\00"
@.str.8 = [2 x i8] c",\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @usage(i32 1, i8* null)
br label %15
6: ; preds = %2
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %15
8: ; preds = %6
%9 = tail call i64 (...) @getuid()
%10 = trunc i64 %9 to i32
%11 = tail call %struct.passwd* @getpwuid(i32 %10)
%12 = icmp eq %struct.passwd* %11, null
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = tail call i32 @usage(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %25
15: ; preds = %4, %6
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call %struct.passwd* @getpwnam(i8* %17)
%19 = icmp eq %struct.passwd* %18, null
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = tail call i32 @usage(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
%23 = getelementptr inbounds %struct.passwd, %struct.passwd* %18, i64 0, i32 0
%24 = load i32, i32* %23
br label %25
25: ; preds = %8, %13, %22
%26 = phi i1 [ false, %8 ], [ false, %13 ], [ true, %22 ]
%27 = phi i32 [ %10, %8 ], [ %10, %13 ], [ %24, %22 ]
%28 = phi %struct.passwd* [ %11, %8 ], [ null, %13 ], [ %18, %22 ]
%29 = getelementptr inbounds %struct.passwd, %struct.passwd* %28, i64 0, i32 1
%30 = load i8*, i8** %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %27, i8* %30)
%32 = getelementptr inbounds %struct.passwd, %struct.passwd* %28, i64 0, i32 2
%33 = load i32, i32* %32
%34 = tail call %struct.group* @getgrgid(i32 %33)
%35 = icmp eq %struct.group* %34, null
br i1 %35, label %41, label %36
36: ; preds = %25
%37 = load i32, i32* %32
%38 = getelementptr inbounds %struct.group, %struct.group* %34, i64 0, i32 0
%39 = load i8*, i8** %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %37, i8* %39)
br label %41
41: ; preds = %36, %25
br i1 %26, label %42, label %45
42: ; preds = %41
%43 = tail call %struct.group* (...) @getgrent()
%44 = icmp eq %struct.group* %43, null
br i1 %44, label %137, label %105
45: ; preds = %41
%46 = tail call i64 (...) @getuid()
%47 = tail call i64 (...) @geteuid()
%48 = icmp eq i64 %46, %47
br i1 %48, label %60, label %49
49: ; preds = %45
%50 = tail call i64 (...) @geteuid()
%51 = trunc i64 %50 to i32
%52 = tail call %struct.passwd* @getpwuid(i32 %51)
%53 = icmp eq %struct.passwd* %52, null
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = tail call i32 @usage(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %56
56: ; preds = %54, %49
%57 = getelementptr inbounds %struct.passwd, %struct.passwd* %52, i64 0, i32 1
%58 = load i8*, i8** %57
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %51, i8* %58)
br label %60
60: ; preds = %56, %45
%61 = tail call i64 (...) @getgid()
%62 = tail call i64 (...) @getegid()
%63 = icmp eq i64 %61, %62
br i1 %63, label %75, label %64
64: ; preds = %60
%65 = tail call i64 (...) @getegid()
%66 = trunc i64 %65 to i32
%67 = tail call %struct.group* @getgrgid(i32 %66)
%68 = icmp eq %struct.group* %67, null
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = tail call i32 @usage(i32 1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %71
71: ; preds = %69, %64
%72 = getelementptr inbounds %struct.group, %struct.group* %67, i64 0, i32 0
%73 = load i8*, i8** %72
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %66, i8* %73)
br label %75
75: ; preds = %71, %60
%76 = tail call i32 @getgroups(i32 0, i32* null)
%77 = icmp eq i32 %76, 0
br i1 %77, label %139, label %78
78: ; preds = %75
%79 = shl i32 %76, 2
%80 = tail call i32* @malloc(i32 %79)
%81 = tail call i32 @getgroups(i32 %76, i32* %80)
%82 = icmp sgt i32 %76, 0
br i1 %82, label %83, label %103
83: ; preds = %78
%84 = zext i32 %76 to i64
br label %85
85: ; preds = %83, %93
%86 = phi i64 [ 0, %83 ], [ %101, %93 ]
%87 = getelementptr inbounds i32, i32* %80, i64 %86
%88 = load i32, i32* %87
%89 = tail call %struct.group* @getgrgid(i32 %88)
%90 = icmp eq %struct.group* %89, null
br i1 %90, label %91, label %93
91: ; preds = %85
%92 = tail call i32 @die(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %93
93: ; preds = %91, %85
%94 = icmp eq i64 %86, 0
%95 = select i1 %94, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
%96 = getelementptr inbounds %struct.group, %struct.group* %89, i64 0, i32 1
%97 = load i8*, i8** %96
%98 = getelementptr inbounds %struct.group, %struct.group* %89, i64 0, i32 0
%99 = load i8*, i8** %98
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %95, i8* %97, i8* %99)
%101 = add nuw nsw i64 %86, 1
%102 = icmp eq i64 %101, %84
br i1 %102, label %103, label %85
103: ; preds = %93, %78
%104 = tail call i32 @free(i32* %80)
br label %139
105: ; preds = %42, %133
%106 = phi %struct.group* [ %135, %133 ], [ %43, %42 ]
%107 = phi i32 [ %134, %133 ], [ 0, %42 ]
%108 = getelementptr inbounds %struct.group, %struct.group* %106, i64 0, i32 2
%109 = load i8**, i8*** %108
%110 = load i8*, i8** %109
%111 = icmp eq i8* %110, null
br i1 %111, label %133, label %112
112: ; preds = %105
%113 = getelementptr inbounds %struct.group, %struct.group* %106, i64 0, i32 1
%114 = getelementptr inbounds %struct.group, %struct.group* %106, i64 0, i32 0
%115 = load i8, i8* %110
%116 = icmp eq i8 %115, 0
br i1 %116, label %133, label %120
117: ; preds = %120
%118 = load i8, i8* %125
%119 = icmp eq i8 %118, 0
br i1 %119, label %133, label %120
120: ; preds = %112, %117
%121 = phi i8* [ %125, %117 ], [ %110, %112 ]
%122 = load i8*, i8** %29
%123 = tail call i32 @strncmp(i8* %121, i8* %122, i32 16)
%124 = icmp eq i32 %123, 0
%125 = getelementptr inbounds i8, i8* %121, i64 1
br i1 %124, label %126, label %117
126: ; preds = %120
%127 = add nsw i32 %107, 1
%128 = icmp eq i32 %107, 0
%129 = select i1 %128, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
%130 = load i8*, i8** %113
%131 = load i8*, i8** %114
%132 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %129, i8* %130, i8* %131)
br label %133
133: ; preds = %117, %112, %126, %105
%134 = phi i32 [ %107, %105 ], [ %127, %126 ], [ %107, %112 ], [ %107, %117 ]
%135 = tail call %struct.group* (...) @getgrent()
%136 = icmp eq %struct.group* %135, null
br i1 %136, label %137, label %105
137: ; preds = %133, %42
%138 = tail call i32 (...) @endgrent()
br label %139
139: ; preds = %75, %103, %137
%140 = tail call i32 @putchar(i32 10)
%141 = tail call i32 @exit(i32 0)
unreachable
}