#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 group {
  scalar_t__ gr_gid;
  char **gr_mem;
};
typedef scalar_t__ ssize_t;
typedef scalar_t__ gid_t;
typedef int /*<<< orphan*/ fpos_t;
typedef enum nss_status { ____Placeholder_nss_status } nss_status;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int ENOMEM;
int /*<<< orphan*/ FSETLOCKING_BYCALLER;
long MIN(long, int);
int NSS_STATUS_NOTFOUND;
int NSS_STATUS_SUCCESS;
int NSS_STATUS_TRYAGAIN;
int NSS_STATUS_UNAVAIL;
int /*<<< orphan*/ __fsetlocking(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ __libc_use_alloca(size_t);
int _nss_files_parse_grent(char *, struct group *, void *, size_t, int *);
void *alloca(size_t);
int errno;
void *extend_alloca(void *, size_t, size_t);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof_unlocked(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fsetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ getline(char **, size_t *, int /*<<< orphan*/ *);
void *realloc(scalar_t__ *, long);
scalar_t__ strcmp(char *, char const *);
enum nss_status _nss_files_initgroups_dyn(const char *user, gid_t group,
                                          long int *start, long int *size,
                                          gid_t **groupsp, long int limit,
                                          int *errnop) {
  FILE *stream = fopen("/etc/group", "rce");
  if (stream == NULL) {
    *errnop = errno;
    return *errnop == ENOMEM ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
  }
  __fsetlocking(stream, FSETLOCKING_BYCALLER);
  char *line = NULL;
  size_t linelen = 0;
  enum nss_status status = NSS_STATUS_SUCCESS;
  bool any = false;
  size_t buflen = 1024;
  void *buffer = alloca(buflen);
  bool buffer_use_malloc = false;
  gid_t *groups = *groupsp;
  while (1) {
    fpos_t pos;
    fgetpos(stream, &pos);
    ssize_t n = getline(&line, &linelen, stream);
    if (n < 0) {
      if (!feof_unlocked(stream))
        status = ((*errnop = errno) == ENOMEM ? NSS_STATUS_TRYAGAIN
                                              : NSS_STATUS_UNAVAIL);
      break;
    }
    struct group grp;
    int res = _nss_files_parse_grent(line, &grp, buffer, buflen, errnop);
    if (res == -1) {
      size_t newbuflen = 2 * buflen;
      if (buffer_use_malloc || !__libc_use_alloca(buflen + newbuflen)) {
        void *newbuf = realloc(buffer_use_malloc ? buffer : NULL, newbuflen);
        if (newbuf == NULL) {
          *errnop = ENOMEM;
          status = NSS_STATUS_TRYAGAIN;
          goto out;
        }
        buffer = newbuf;
        buflen = newbuflen;
        buffer_use_malloc = true;
      } else
        buffer = extend_alloca(buffer, buflen, newbuflen);
      fsetpos(stream, &pos);
      continue;
    }
    if (res > 0 && grp.gr_gid != group)
      for (char **m = grp.gr_mem; *m != NULL; ++m)
        if (strcmp(*m, user) == 0) {
          if (*start == *size) {
            if (limit > 0 && *size == limit)
              goto out;
            long int newsize;
            if (limit <= 0)
              newsize = 2 * *size;
            else
              newsize = MIN(limit, 2 * *size);
            gid_t *newgroups = realloc(groups, newsize * sizeof(*groups));
            if (newgroups == NULL) {
              *errnop = ENOMEM;
              status = NSS_STATUS_TRYAGAIN;
              goto out;
            }
            *groupsp = groups = newgroups;
            *size = newsize;
          }
          groups[*start] = grp.gr_gid;
          *start += 1;
          any = true;
          break;
        }
  }
out:
  if (buffer_use_malloc)
    free(buffer);
  free(line);
  fclose(stream);
  return status == NSS_STATUS_SUCCESS && !any ? NSS_STATUS_NOTFOUND : status;
}


x86 assembly (clang, -O0):
<_nss_files_initgroups_dyn>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
lea    0xdf2(%rip),%rdi
lea    0xdf6(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    127e <_nss_files_initgroups_dyn+0x9e>
mov    0x2d90(%rip),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2d8b(%rip),%rcx
cmp    (%rcx),%eax
jne    1261 <_nss_files_initgroups_dyn+0x81>
mov    0x2d74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xcc(%rbp)
jmp    1270 <_nss_files_initgroups_dyn+0x90>
mov    0x2d80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1690 <_nss_files_initgroups_dyn+0x4b0>
mov    -0x40(%rbp),%rdi
mov    0x2d2f(%rip),%rax
mov    (%rax),%esi
call   1090 <__fsetlocking@plt>
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    0x2d39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movq   $0x400,-0x60(%rbp)
mov    -0x60(%rbp),%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    -0x40(%rbp),%rdi
lea    -0x7c(%rbp),%rsi
call   1060 <fgetpos@plt>
mov    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10e0 <getline@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jge    137a <_nss_files_initgroups_dyn+0x19a>
mov    -0x40(%rbp),%rdi
call   1100 <feof_unlocked@plt>
cmp    $0x0,%eax
jne    1375 <_nss_files_initgroups_dyn+0x195>
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
mov    0x10(%rbp),%rcx
mov    %eax,(%rcx)
mov    0x2c8f(%rip),%rcx
cmp    (%rcx),%eax
jne    135d <_nss_files_initgroups_dyn+0x17d>
mov    0x2c78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd0(%rbp)
jmp    136c <_nss_files_initgroups_dyn+0x18c>
mov    0x2c84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
mov    %eax,-0x54(%rbp)
jmp    1624 <_nss_files_initgroups_dyn+0x444>
mov    -0x48(%rbp),%rdi
mov    -0x68(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    0x10(%rbp),%r8
lea    -0x98(%rbp),%rsi
call   10f0 <_nss_files_parse_grent@plt>
mov    %eax,-0x9c(%rbp)
cmpl   $0xffffffff,-0x9c(%rbp)
jne    1497 <_nss_files_initgroups_dyn+0x2b7>
mov    -0x60(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0xa8(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jne    13db <_nss_files_initgroups_dyn+0x1fb>
mov    -0x60(%rbp),%rdi
add    -0xa8(%rbp),%rdi
call   10c0 <__libc_use_alloca@plt>
cmp    $0x0,%eax
jne    146d <_nss_files_initgroups_dyn+0x28d>
cmpl   $0x0,-0x6c(%rbp)
je     13f5 <_nss_files_initgroups_dyn+0x215>
mov    -0x68(%rbp),%rax
mov    %rax,-0xd8(%rbp)
jmp    1403 <_nss_files_initgroups_dyn+0x223>
xor    %eax,%eax
mov    %rax,-0xd8(%rbp)
jmp    1403 <_nss_files_initgroups_dyn+0x223>
mov    -0xd8(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
call   10a0 <realloc@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
jne    144b <_nss_files_initgroups_dyn+0x26b>
mov    0x2b9e(%rip),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2b87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
jmp    1629 <_nss_files_initgroups_dyn+0x449>
mov    -0xb0(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0xa8(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    1485 <_nss_files_initgroups_dyn+0x2a5>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0xa8(%rbp),%rdx
call   1080 <extend_alloca@plt>
mov    %rax,-0x68(%rbp)
mov    -0x40(%rbp),%rdi
lea    -0x7c(%rbp),%rsi
call   10d0 <fsetpos@plt>
jmp    12e6 <_nss_files_initgroups_dyn+0x106>
cmpl   $0x0,-0x9c(%rbp)
jle    161f <_nss_files_initgroups_dyn+0x43f>
mov    -0x98(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     161f <_nss_files_initgroups_dyn+0x43f>
mov    -0x90(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rax
cmpq   $0x0,(%rax)
je     161a <_nss_files_initgroups_dyn+0x43a>
mov    -0xb8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    15fe <_nss_files_initgroups_dyn+0x41e>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jne    15ce <_nss_files_initgroups_dyn+0x3ee>
cmpq   $0x0,-0x38(%rbp)
jle    1526 <_nss_files_initgroups_dyn+0x346>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
cmp    -0x38(%rbp),%rax
jne    1526 <_nss_files_initgroups_dyn+0x346>
jmp    1629 <_nss_files_initgroups_dyn+0x449>
cmpq   $0x0,-0x38(%rbp)
jg     1548 <_nss_files_initgroups_dyn+0x368>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
shl    $0x1,%rax
mov    %rax,-0xc0(%rbp)
jmp    1565 <_nss_files_initgroups_dyn+0x385>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
shl    $0x1,%rax
mov    %eax,%esi
call   1040 <MIN@plt>
mov    %rax,-0xc0(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
shl    $0x3,%rsi
call   10a0 <realloc@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
jne    15ae <_nss_files_initgroups_dyn+0x3ce>
mov    0x2a3b(%rip),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2a24(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
jmp    1629 <_nss_files_initgroups_dyn+0x449>
mov    -0xc8(%rbp),%rcx
mov    %rcx,-0x78(%rbp)
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xc0(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x98(%rbp),%rdx
mov    -0x78(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x58(%rbp)
jmp    161a <_nss_files_initgroups_dyn+0x43a>
jmp    1603 <_nss_files_initgroups_dyn+0x423>
mov    -0xb8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xb8(%rbp)
jmp    14c3 <_nss_files_initgroups_dyn+0x2e3>
jmp    161f <_nss_files_initgroups_dyn+0x43f>
jmp    12e6 <_nss_files_initgroups_dyn+0x106>
jmp    1629 <_nss_files_initgroups_dyn+0x449>
cmpl   $0x0,-0x6c(%rbp)
je     163c <_nss_files_initgroups_dyn+0x45c>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x54(%rbp),%eax
mov    0x2988(%rip),%rcx
cmp    (%rcx),%eax
jne    167e <_nss_files_initgroups_dyn+0x49e>
cmpl   $0x0,-0x58(%rbp)
jne    167e <_nss_files_initgroups_dyn+0x49e>
mov    0x293f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xdc(%rbp)
jmp    1687 <_nss_files_initgroups_dyn+0x4a7>
mov    -0x54(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    -0xdc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_files_initgroups_dyn>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,-0x80(%rbp)
mov    %r8,%rbx
mov    %rcx,-0x68(%rbp)
mov    %rdx,-0x60(%rbp)
mov    %rsi,-0x88(%rbp)
mov    %rdi,%r13
mov    0x10(%rbp),%r14
lea    0xdeb(%rip),%rdi
lea    0xdef(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     145b <_nss_files_initgroups_dyn+0x27b>
mov    %rax,%r15
mov    0x2d84(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1090 <__fsetlocking@plt>
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x70(%rbp)
mov    0x2d8b(%rip),%rax
mov    (%rax),%r12d
mov    %rsp,%r14
add    $0xfffffffffffffc00,%r14
mov    %r14,%rsp
mov    (%rbx),%rax
mov    %rax,-0x58(%rbp)
lea    -0x2c(%rbp),%rsi
mov    %r15,%rdi
call   1060 <fgetpos@plt>
lea    -0x48(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    %r15,%rdx
call   10e0 <getline@plt>
test   %rax,%rax
mov    %r12d,-0x34(%rbp)
js     1482 <_nss_files_initgroups_dyn+0x2a2>
mov    %rbx,-0x78(%rbp)
mov    $0x400,%r12d
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x30(%rbp)
mov    0x10(%rbp),%rbx
jmp    12ff <_nss_files_initgroups_dyn+0x11f>
mov    -0x58(%rbp),%rdx
mov    -0x98(%rbp),%rax
mov    %rdx,-0x58(%rbp)
mov    %rax,(%rdx,%r14,8)
addq   $0x1,(%rcx)
mov    $0x1,%eax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%r14
mov    0x10(%rbp),%rbx
lea    -0x2c(%rbp),%rsi
mov    %r15,%rdi
call   1060 <fgetpos@plt>
lea    -0x48(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    %r15,%rdx
call   10e0 <getline@plt>
test   %rax,%rax
js     148f <_nss_files_initgroups_dyn+0x2af>
mov    -0x48(%rbp),%rdi
lea    -0x98(%rbp),%rsi
mov    %r14,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
call   10f0 <_nss_files_parse_grent@plt>
cmp    $0xffffffff,%eax
je     1370 <_nss_files_initgroups_dyn+0x190>
test   %eax,%eax
jle    12da <_nss_files_initgroups_dyn+0xfa>
mov    -0x88(%rbp),%rax
cmp    %rax,-0x98(%rbp)
je     12da <_nss_files_initgroups_dyn+0xfa>
mov    -0x90(%rbp),%rbx
mov    (%rbx),%rdi
test   %rdi,%rdi
je     12d6 <_nss_files_initgroups_dyn+0xf6>
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13db <_nss_files_initgroups_dyn+0x1fb>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1350 <_nss_files_initgroups_dyn+0x170>
jmp    12d6 <_nss_files_initgroups_dyn+0xf6>
xchg   %ax,%ax
lea    (%r12,%r12,1),%rbx
mov    %r14,%rdi
cmpl   $0x0,-0x30(%rbp)
je     13a1 <_nss_files_initgroups_dyn+0x1c1>
mov    %r14,-0x40(%rbp)
mov    %rbx,%rsi
call   10a0 <realloc@plt>
test   %rax,%rax
je     151c <_nss_files_initgroups_dyn+0x33c>
movl   $0x1,-0x30(%rbp)
mov    %rax,%r14
mov    %rbx,%r12
jmp    13c6 <_nss_files_initgroups_dyn+0x1e6>
lea    (%r12,%r12,2),%rdi
call   10c0 <__libc_use_alloca@plt>
test   %eax,%eax
je     141a <_nss_files_initgroups_dyn+0x23a>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1080 <extend_alloca@plt>
mov    %rax,%r14
movl   $0x0,-0x30(%rbp)
mov    0x10(%rbp),%rbx
lea    -0x2c(%rbp),%rsi
mov    %r15,%rdi
call   10d0 <fsetpos@plt>
jmp    12da <_nss_files_initgroups_dyn+0xfa>
mov    %r14,-0x40(%rbp)
mov    -0x60(%rbp),%rcx
mov    (%rcx),%r14
mov    -0x68(%rbp),%rax
cmp    (%rax),%r14
jne    12b2 <_nss_files_initgroups_dyn+0xd2>
mov    -0x80(%rbp),%rdi
test   %rdi,%rdi
jle    1405 <_nss_files_initgroups_dyn+0x225>
cmp    %rdi,%r14
je     1564 <_nss_files_initgroups_dyn+0x384>
test   %rdi,%rdi
jle    1421 <_nss_files_initgroups_dyn+0x241>
add    %r14d,%r14d
mov    %r14d,%esi
call   1040 <MIN@plt>
mov    %rax,%r14
jmp    1424 <_nss_files_initgroups_dyn+0x244>
xor    %edi,%edi
jmp    137d <_nss_files_initgroups_dyn+0x19d>
add    %r14,%r14
lea    0x0(,%r14,8),%rsi
mov    -0x58(%rbp),%rdi
call   10a0 <realloc@plt>
test   %rax,%rax
je     151c <_nss_files_initgroups_dyn+0x33c>
mov    %rax,%rdx
mov    -0x78(%rbp),%rax
mov    %rdx,(%rax)
mov    -0x68(%rbp),%rax
mov    %r14,(%rax)
mov    -0x60(%rbp),%rcx
mov    (%rcx),%r14
jmp    12b6 <_nss_files_initgroups_dyn+0xd6>
mov    0x2b5e(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%r14)
mov    0x2b62(%rip),%rcx
cmp    (%rcx),%eax
jne    1500 <_nss_files_initgroups_dyn+0x320>
mov    0x2b4b(%rip),%rax
jmp    1507 <_nss_files_initgroups_dyn+0x327>
movl   $0x0,-0x30(%rbp)
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
mov    %r14,-0x40(%rbp)
mov    %r15,%rdi
call   1100 <feof_unlocked@plt>
test   %eax,%eax
mov    0x2b3c(%rip),%rbx
mov    -0x34(%rbp),%r14d
je     14dd <_nss_files_initgroups_dyn+0x2fd>
cmpl   $0x0,-0x30(%rbp)
je     14b9 <_nss_files_initgroups_dyn+0x2d9>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    (%rbx),%eax
xor    %r14d,%eax
or     -0x50(%rbp),%eax
jne    150a <_nss_files_initgroups_dyn+0x32a>
mov    0x2ad5(%rip),%rax
jmp    1507 <_nss_files_initgroups_dyn+0x327>
mov    0x2adc(%rip),%rax
mov    (%rax),%eax
mov    0x10(%rbp),%rcx
mov    %eax,(%rcx)
mov    0x2add(%rip),%rcx
cmp    (%rcx),%eax
jne    154b <_nss_files_initgroups_dyn+0x36b>
mov    0x2aca(%rip),%rax
jmp    1552 <_nss_files_initgroups_dyn+0x372>
mov    0x2ae1(%rip),%rax
mov    (%rax),%r14d
mov    %r14d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aad(%rip),%rax
mov    (%rax),%eax
mov    0x10(%rbp),%rcx
mov    %eax,(%rcx)
mov    0x2a96(%rip),%rax
mov    (%rax),%r14d
mov    0x2aa4(%rip),%rbx
cmpl   $0x0,-0x30(%rbp)
jne    14b0 <_nss_files_initgroups_dyn+0x2d0>
jmp    14b9 <_nss_files_initgroups_dyn+0x2d9>
mov    0x2a96(%rip),%rax
mov    (%rax),%r14d
cmpl   $0x0,-0x30(%rbp)
jne    14b0 <_nss_files_initgroups_dyn+0x2d0>
jmp    14b9 <_nss_files_initgroups_dyn+0x2d9>
mov    -0x34(%rbp),%r14d
jmp    1535 <_nss_files_initgroups_dyn+0x355>

LLVM IR (-O0):
%struct.group = type { i64, i8** }
@.str = [11 x i8] c"/etc/group\00"
@.str.1 = [4 x i8] c"rce\00"
@errno = global i32 0
@ENOMEM = global i32 0
@NSS_STATUS_TRYAGAIN = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
@FSETLOCKING_BYCALLER = global i32 0
@NSS_STATUS_SUCCESS = global i32 0
@NSS_STATUS_NOTFOUND = global i32 0
define i32 @_nss_files_initgroups_dyn(i8* %0, i64 %1, i64* %2, i64* %3, i64** %4, i64 %5, i32* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i64*
%13 = alloca i64**
%14 = alloca i64
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i32
%20 = alloca i32
%21 = alloca i64
%22 = alloca i8*
%23 = alloca i32
%24 = alloca i64*
%25 = alloca i32
%26 = alloca i64
%27 = alloca %struct.group
%28 = alloca i32
%29 = alloca i64
%30 = alloca i8*
%31 = alloca i8**
%32 = alloca i64
%33 = alloca i64*
store i8* %0, i8** %9
store i64 %1, i64* %10
store i64* %2, i64** %11
store i64* %3, i64** %12
store i64** %4, i64*** %13
store i64 %5, i64* %14
store i32* %6, i32** %15
%34 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %34, i32** %16
%35 = load i32*, i32** %16
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %50
37: ; preds = %7
%38 = load i32, i32* @errno
%39 = load i32*, i32** %15
store i32 %38, i32* %39
%40 = load i32*, i32** %15
%41 = load i32, i32* %40
%42 = load i32, i32* @ENOMEM
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %37
%45 = load i32, i32* @NSS_STATUS_TRYAGAIN
br label %48
46: ; preds = %37
%47 = load i32, i32* @NSS_STATUS_UNAVAIL
br label %48
48: ; preds = %46, %44
%49 = phi i32 [ %45, %44 ], [ %47, %46 ]
store i32 %49, i32* %8
br label %236
50: ; preds = %7
%51 = load i32*, i32** %16
%52 = load i32, i32* @FSETLOCKING_BYCALLER
%53 = call i32 @__fsetlocking(i32* %51, i32 %52)
store i8* null, i8** %17
store i64 0, i64* %18
%54 = load i32, i32* @NSS_STATUS_SUCCESS
store i32 %54, i32* %19
store i32 0, i32* %20
store i64 1024, i64* %21
%55 = load i64, i64* %21
%56 = alloca i8, i64 %55
store i8* %56, i8** %22
store i32 0, i32* %23
%57 = load i64**, i64*** %13
%58 = load i64*, i64** %57
store i64* %58, i64** %24
br label %59
59: ; preds = %50, %126, %211
%60 = load i32*, i32** %16
%61 = call i32 @fgetpos(i32* %60, i32* %25)
%62 = load i32*, i32** %16
%63 = call i64 @getline(i8** %17, i64* %18, i32* %62)
store i64 %63, i64* %26
%64 = load i64, i64* %26
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %82
66: ; preds = %59
%67 = load i32*, i32** %16
%68 = call i32 @feof_unlocked(i32* %67)
%69 = icmp ne i32 %68, 0
br i1 %69, label %81, label %70
70: ; preds = %66
%71 = load i32, i32* @errno
%72 = load i32*, i32** %15
store i32 %71, i32* %72
%73 = load i32, i32* @ENOMEM
%74 = icmp eq i32 %71, %73
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = load i32, i32* @NSS_STATUS_TRYAGAIN
br label %79
77: ; preds = %70
%78 = load i32, i32* @NSS_STATUS_UNAVAIL
br label %79
79: ; preds = %77, %75
%80 = phi i32 [ %76, %75 ], [ %78, %77 ]
store i32 %80, i32* %19
br label %81
81: ; preds = %79, %66
br label %212
82: ; preds = %59
%83 = load i8*, i8** %17
%84 = load i8*, i8** %22
%85 = load i64, i64* %21
%86 = load i32*, i32** %15
%87 = call i32 @_nss_files_parse_grent(i8* %83, %struct.group* %27, i8* %84, i64 %85, i32* %86)
store i32 %87, i32* %28
%88 = load i32, i32* %28
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %129
90: ; preds = %82
%91 = load i64, i64* %21
%92 = mul i64 2, %91
store i64 %92, i64* %29
%93 = load i32, i32* %23
%94 = icmp ne i32 %93, 0
br i1 %94, label %101, label %95
95: ; preds = %90
%96 = load i64, i64* %21
%97 = load i64, i64* %29
%98 = add i64 %96, %97
%99 = call i32 @__libc_use_alloca(i64 %98)
%100 = icmp ne i32 %99, 0
br i1 %100, label %121, label %101
101: ; preds = %95, %90
%102 = load i32, i32* %23
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %101
%105 = load i8*, i8** %22
br label %107
106: ; preds = %101
br label %107
107: ; preds = %106, %104
%108 = phi i8* [ %105, %104 ], [ null, %106 ]
%109 = bitcast i8* %108 to i64*
%110 = load i64, i64* %29
%111 = call i8* @realloc(i64* %109, i64 %110)
store i8* %111, i8** %30
%112 = load i8*, i8** %30
%113 = icmp eq i8* %112, null
br i1 %113, label %114, label %118
114: ; preds = %107
%115 = load i32, i32* @ENOMEM
%116 = load i32*, i32** %15
store i32 %115, i32* %116
%117 = load i32, i32* @NSS_STATUS_TRYAGAIN
store i32 %117, i32* %19
br label %213
118: ; preds = %107
%119 = load i8*, i8** %30
store i8* %119, i8** %22
%120 = load i64, i64* %29
store i64 %120, i64* %21
store i32 1, i32* %23
br label %126
121: ; preds = %95
%122 = load i8*, i8** %22
%123 = load i64, i64* %21
%124 = load i64, i64* %29
%125 = call i8* @extend_alloca(i8* %122, i64 %123, i64 %124)
store i8* %125, i8** %22
br label %126
126: ; preds = %121, %118
%127 = load i32*, i32** %16
%128 = call i32 @fsetpos(i32* %127, i32* %25)
br label %59
129: ; preds = %82
%130 = load i32, i32* %28
%131 = icmp sgt i32 %130, 0
br i1 %131, label %132, label %211
132: ; preds = %129
%133 = getelementptr inbounds %struct.group, %struct.group* %27, i32 0, i32 0
%134 = load i64, i64* %133
%135 = load i64, i64* %10
%136 = icmp ne i64 %134, %135
br i1 %136, label %137, label %211
137: ; preds = %132
%138 = getelementptr inbounds %struct.group, %struct.group* %27, i32 0, i32 1
%139 = load i8**, i8*** %138
store i8** %139, i8*** %31
br label %140
140: ; preds = %207, %137
%141 = load i8**, i8*** %31
%142 = load i8*, i8** %141
%143 = icmp ne i8* %142, null
br i1 %143, label %144, label %210
144: ; preds = %140
%145 = load i8**, i8*** %31
%146 = load i8*, i8** %145
%147 = load i8*, i8** %9
%148 = call i64 @strcmp(i8* %146, i8* %147)
%149 = icmp eq i64 %148, 0
br i1 %149, label %150, label %206
150: ; preds = %144
%151 = load i64*, i64** %11
%152 = load i64, i64* %151
%153 = load i64*, i64** %12
%154 = load i64, i64* %153
%155 = icmp eq i64 %152, %154
br i1 %155, label %156, label %196
156: ; preds = %150
%157 = load i64, i64* %14
%158 = icmp sgt i64 %157, 0
br i1 %158, label %159, label %165
159: ; preds = %156
%160 = load i64*, i64** %12
%161 = load i64, i64* %160
%162 = load i64, i64* %14
%163 = icmp eq i64 %161, %162
br i1 %163, label %164, label %165
164: ; preds = %159
br label %213
165: ; preds = %159, %156
%166 = load i64, i64* %14
%167 = icmp sle i64 %166, 0
br i1 %167, label %168, label %172
168: ; preds = %165
%169 = load i64*, i64** %12
%170 = load i64, i64* %169
%171 = mul nsw i64 2, %170
store i64 %171, i64* %32
br label %179
172: ; preds = %165
%173 = load i64, i64* %14
%174 = load i64*, i64** %12
%175 = load i64, i64* %174
%176 = mul nsw i64 2, %175
%177 = trunc i64 %176 to i32
%178 = call i64 @MIN(i64 %173, i32 %177)
store i64 %178, i64* %32
br label %179
179: ; preds = %172, %168
%180 = load i64*, i64** %24
%181 = load i64, i64* %32
%182 = mul i64 %181, 8
%183 = call i8* @realloc(i64* %180, i64 %182)
%184 = bitcast i8* %183 to i64*
store i64* %184, i64** %33
%185 = load i64*, i64** %33
%186 = icmp eq i64* %185, null
br i1 %186, label %187, label %191
187: ; preds = %179
%188 = load i32, i32* @ENOMEM
%189 = load i32*, i32** %15
store i32 %188, i32* %189
%190 = load i32, i32* @NSS_STATUS_TRYAGAIN
store i32 %190, i32* %19
br label %213
191: ; preds = %179
%192 = load i64*, i64** %33
store i64* %192, i64** %24
%193 = load i64**, i64*** %13
store i64* %192, i64** %193
%194 = load i64, i64* %32
%195 = load i64*, i64** %12
store i64 %194, i64* %195
br label %196
196: ; preds = %191, %150
%197 = getelementptr inbounds %struct.group, %struct.group* %27, i32 0, i32 0
%198 = load i64, i64* %197
%199 = load i64*, i64** %24
%200 = load i64*, i64** %11
%201 = load i64, i64* %200
%202 = getelementptr inbounds i64, i64* %199, i64 %201
store i64 %198, i64* %202
%203 = load i64*, i64** %11
%204 = load i64, i64* %203
%205 = add nsw i64 %204, 1
store i64 %205, i64* %203
store i32 1, i32* %20
br label %210
206: ; preds = %144
br label %207
207: ; preds = %206
%208 = load i8**, i8*** %31
%209 = getelementptr inbounds i8*, i8** %208, i32 1
store i8** %209, i8*** %31
br label %140
210: ; preds = %196, %140
br label %211
211: ; preds = %210, %132, %129
br label %59
212: ; preds = %81
br label %213
213: ; preds = %212, %187, %164, %114
%214 = load i32, i32* %23
%215 = icmp ne i32 %214, 0
br i1 %215, label %216, label %219
216: ; preds = %213
%217 = load i8*, i8** %22
%218 = call i32 @free(i8* %217)
br label %219
219: ; preds = %216, %213
%220 = load i8*, i8** %17
%221 = call i32 @free(i8* %220)
%222 = load i32*, i32** %16
%223 = call i32 @fclose(i32* %222)
%224 = load i32, i32* %19
%225 = load i32, i32* @NSS_STATUS_SUCCESS
%226 = icmp eq i32 %224, %225
br i1 %226, label %227, label %232
227: ; preds = %219
%228 = load i32, i32* %20
%229 = icmp ne i32 %228, 0
br i1 %229, label %232, label %230
230: ; preds = %227
%231 = load i32, i32* @NSS_STATUS_NOTFOUND
br label %234
232: ; preds = %227, %219
%233 = load i32, i32* %19
br label %234
234: ; preds = %232, %230
%235 = phi i32 [ %231, %230 ], [ %233, %232 ]
store i32 %235, i32* %8
br label %236
236: ; preds = %234, %48
%237 = load i32, i32* %8
ret i32 %237
}

LLVM IR (-O2):
%struct.group = type { i64, i8** }
@.str = [11 x i8] c"/etc/group\00"
@.str.1 = [4 x i8] c"rce\00"
@errno = global i32 0
@ENOMEM = global i32 0
@NSS_STATUS_TRYAGAIN = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
@FSETLOCKING_BYCALLER = global i32 0
@NSS_STATUS_SUCCESS = global i32 0
@NSS_STATUS_NOTFOUND = global i32 0
define i32 @_nss_files_initgroups_dyn(i8* %0, i64 %1, i64* nocapture %2, i64* nocapture %3, i64** nocapture %4, i64 %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.group
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %21
14: ; preds = %7
%15 = load i32, i32* @errno
store i32 %15, i32* %6
%16 = load i32, i32* @ENOMEM
%17 = icmp eq i32 %15, %16
%18 = load i32, i32* @NSS_STATUS_TRYAGAIN
%19 = load i32, i32* @NSS_STATUS_UNAVAIL
%20 = select i1 %17, i32 %18, i32 %19
br label %163
21: ; preds = %7
%22 = load i32, i32* @FSETLOCKING_BYCALLER
%23 = tail call i32 @__fsetlocking(i32* %12, i32 %22)
%24 = bitcast i8** %8 to i8*
store i8* null, i8** %8
%25 = bitcast i64* %9 to i8*
store i64 0, i64* %9
%26 = load i32, i32* @NSS_STATUS_SUCCESS
%27 = alloca [1024 x i8]
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %27, i64 0, i64 0
%29 = load i64*, i64** %4
%30 = bitcast i32* %10 to i8*
%31 = call i32 @fgetpos(i32* %12, i32* %10)
%32 = call i64 @getline(i8** %8, i64* %9, i32* %12)
%33 = icmp slt i64 %32, 0
br i1 %33, label %41, label %34
34: ; preds = %21
%35 = bitcast %struct.group* %11 to i8*
%36 = getelementptr inbounds %struct.group, %struct.group* %11, i64 0, i32 0
%37 = getelementptr inbounds %struct.group, %struct.group* %11, i64 0, i32 1
%38 = icmp sgt i64 %5, 0
%39 = icmp slt i64 %5, 1
%40 = bitcast i64** %4 to i8**
br label %54
41: ; preds = %136, %21
%42 = phi i8* [ %28, %21 ], [ %137, %136 ]
%43 = phi i32 [ 0, %21 ], [ %138, %136 ]
%44 = phi i32 [ 0, %21 ], [ %141, %136 ]
%45 = call i32 @feof_unlocked(i32* %12)
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %129
47: ; preds = %41
%48 = load i32, i32* @errno
store i32 %48, i32* %6
%49 = load i32, i32* @ENOMEM
%50 = icmp eq i32 %48, %49
%51 = load i32, i32* @NSS_STATUS_TRYAGAIN
%52 = load i32, i32* @NSS_STATUS_UNAVAIL
%53 = select i1 %50, i32 %51, i32 %52
br label %129
54: ; preds = %34, %136
%55 = phi i32 [ 0, %34 ], [ %141, %136 ]
%56 = phi i64 [ 1024, %34 ], [ %140, %136 ]
%57 = phi i64* [ %29, %34 ], [ %139, %136 ]
%58 = phi i32 [ 0, %34 ], [ %138, %136 ]
%59 = phi i8* [ %28, %34 ], [ %137, %136 ]
%60 = load i8*, i8** %8
%61 = call i32 @_nss_files_parse_grent(i8* %60, %struct.group* %11, i8* %59, i64 %56, i32* %6)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %82
63: ; preds = %54
%64 = shl i64 %56, 1
%65 = icmp eq i32 %58, 0
br i1 %65, label %66, label %70
66: ; preds = %63
%67 = mul i64 %56, 3
%68 = call i32 @__libc_use_alloca(i64 %67)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %66, %63
%71 = phi i8* [ null, %66 ], [ %59, %63 ]
%72 = bitcast i8* %71 to i64*
%73 = call i8* @realloc(i64* %72, i64 %64)
%74 = icmp eq i8* %73, null
br i1 %74, label %131, label %77
75: ; preds = %66
%76 = call i8* @extend_alloca(i8* %59, i64 %56, i64 %64)
br label %77
77: ; preds = %70, %75
%78 = phi i8* [ %76, %75 ], [ %73, %70 ]
%79 = phi i32 [ 0, %75 ], [ 1, %70 ]
%80 = phi i64 [ %56, %75 ], [ %64, %70 ]
%81 = call i32 @fsetpos(i32* %12, i32* %10)
br label %136
82: ; preds = %54
%83 = icmp slt i32 %61, 1
%84 = load i64, i64* %36
%85 = icmp eq i64 %84, %1
%86 = select i1 %83, i1 true, i1 %85
br i1 %86, label %136, label %87
87: ; preds = %82
%88 = load i8**, i8*** %37
%89 = load i8*, i8** %88
%90 = icmp eq i8* %89, null
br i1 %90, label %136, label %94
91: ; preds = %94
%92 = load i8*, i8** %99
%93 = icmp eq i8* %92, null
br i1 %93, label %136, label %94
94: ; preds = %87, %91
%95 = phi i8* [ %92, %91 ], [ %89, %87 ]
%96 = phi i8** [ %99, %91 ], [ %88, %87 ]
%97 = call i64 @strcmp(i8* %95, i8* %0)
%98 = icmp eq i64 %97, 0
%99 = getelementptr inbounds i8*, i8** %96, i64 1
br i1 %98, label %100, label %91
100: ; preds = %94
%101 = load i64, i64* %2
%102 = load i64, i64* %3
%103 = icmp eq i64 %101, %102
br i1 %103, label %104, label %122
104: ; preds = %100
%105 = icmp eq i64 %101, %5
%106 = select i1 %38, i1 %105, i1 false
br i1 %106, label %134, label %107
107: ; preds = %104
br i1 %39, label %108, label %110
108: ; preds = %107
%109 = shl nsw i64 %101, 1
br label %114
110: ; preds = %107
%111 = trunc i64 %101 to i32
%112 = shl i32 %111, 1
%113 = call i64 @MIN(i64 %5, i32 %112)
br label %114
114: ; preds = %110, %108
%115 = phi i64 [ %109, %108 ], [ %113, %110 ]
%116 = shl i64 %115, 3
%117 = call i8* @realloc(i64* %57, i64 %116)
%118 = icmp eq i8* %117, null
br i1 %118, label %131, label %119
119: ; preds = %114
%120 = bitcast i8* %117 to i64*
store i8* %117, i8** %40
store i64 %115, i64* %3
%121 = load i64, i64* %2
br label %122
122: ; preds = %119, %100
%123 = phi i64 [ %121, %119 ], [ %101, %100 ]
%124 = phi i64* [ %120, %119 ], [ %57, %100 ]
%125 = load i64, i64* %36
%126 = getelementptr inbounds i64, i64* %124, i64 %123
store i64 %125, i64* %126
%127 = load i64, i64* %2
%128 = add nsw i64 %127, 1
store i64 %128, i64* %2
br label %136
129: ; preds = %47, %41
%130 = phi i32 [ %53, %47 ], [ %26, %41 ]
br label %145
131: ; preds = %114, %70
%132 = load i32, i32* @ENOMEM
store i32 %132, i32* %6
%133 = load i32, i32* @NSS_STATUS_TRYAGAIN
br label %134
134: ; preds = %104, %131
%135 = phi i32 [ %133, %131 ], [ %26, %104 ]
br label %145
136: ; preds = %91, %87, %122, %77, %82
%137 = phi i8* [ %78, %77 ], [ %59, %82 ], [ %59, %122 ], [ %59, %87 ], [ %59, %91 ]
%138 = phi i32 [ %79, %77 ], [ %58, %82 ], [ %58, %122 ], [ %58, %87 ], [ %58, %91 ]
%139 = phi i64* [ %57, %77 ], [ %57, %82 ], [ %124, %122 ], [ %57, %87 ], [ %57, %91 ]
%140 = phi i64 [ %80, %77 ], [ %56, %82 ], [ %56, %122 ], [ %56, %87 ], [ %56, %91 ]
%141 = phi i32 [ %55, %77 ], [ %55, %82 ], [ 1, %122 ], [ %55, %87 ], [ %55, %91 ]
%142 = call i32 @fgetpos(i32* %12, i32* %10)
%143 = call i64 @getline(i8** %8, i64* %9, i32* %12)
%144 = icmp slt i64 %143, 0
br i1 %144, label %41, label %54
145: ; preds = %134, %129
%146 = phi i8* [ %42, %129 ], [ %59, %134 ]
%147 = phi i32 [ %43, %129 ], [ %58, %134 ]
%148 = phi i32 [ %44, %129 ], [ %55, %134 ]
%149 = phi i32 [ %130, %129 ], [ %135, %134 ]
%150 = icmp eq i32 %147, 0
br i1 %150, label %153, label %151
151: ; preds = %145
%152 = call i32 @free(i8* %146)
br label %153
153: ; preds = %145, %151
%154 = load i8*, i8** %8
%155 = call i32 @free(i8* %154)
%156 = call i32 @fclose(i32* %12)
%157 = load i32, i32* @NSS_STATUS_SUCCESS
%158 = icmp ne i32 %149, %157
%159 = icmp ne i32 %148, 0
%160 = select i1 %158, i1 true, i1 %159
%161 = load i32, i32* @NSS_STATUS_NOTFOUND
%162 = select i1 %160, i32 %149, i32 %161
br label %163
163: ; preds = %153, %14
%164 = phi i32 [ %20, %14 ], [ %162, %153 ]
ret i32 %164
}