#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 {
  char *gr_name;
  char *gr_passwd;
  char **gr_mem;
  scalar_t__ gr_gid;
};
typedef scalar_t__ gid_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ free(char **);
int /*<<< orphan*/ lseek(int, long, int /*<<< orphan*/);
scalar_t__ malloc(int);
int read(int, char *, short);
char *realloc(void *, short);
char *strchr(char *, char);
scalar_t__ strtoul(char *, char **, int);
struct group *__getgrent(int grp_fd) {
  static char *line_buff = NULL;
  static char **members = NULL;
  short line_index;
  short buff_size;
  static struct group group;
  char *ptr;
  char *field_begin;
  short member_num;
  char *endptr;
  int line_len;
restart:
  line_index = 0;
  buff_size = 256;
  line_buff = realloc(line_buff, buff_size);
  while (1) {
    if ((line_len =
             read(grp_fd, line_buff + line_index, buff_size - line_index)) <= 0)
      return NULL;
    field_begin = strchr(line_buff, '\n');
    if (field_begin != NULL) {
      lseek(grp_fd,
            (long)(1 + field_begin - (line_len + line_index + line_buff)),
            SEEK_CUR);
      *field_begin = '\0';
      if (*line_buff == '#' || *line_buff == ' ' || *line_buff == '\n' ||
          *line_buff == '\t')
        goto restart;
      break;
    } else {
      line_index = buff_size;
      buff_size += 256;
      line_buff = realloc(line_buff, buff_size);
    }
  }
  group.gr_name = line_buff;
  ptr = strchr(line_buff, ':');
  if (ptr == NULL)
    goto restart;
  *ptr++ = '\0';
  group.gr_passwd = ptr;
  ptr = strchr(ptr, ':');
  if (ptr == NULL)
    goto restart;
  *ptr++ = '\0';
  field_begin = ptr;
  ptr = strchr(ptr, ':');
  if (ptr == NULL)
    goto restart;
  *ptr++ = '\0';
  group.gr_gid = (gid_t)strtoul(field_begin, &endptr, 10);
  if (*endptr != '\0')
    goto restart;
  member_num = 0;
  field_begin = ptr;
  if (members != NULL)
    free(members);
  members = (char **)malloc(1 * sizeof(char *));
  while ((ptr = strchr(ptr, ',')) != NULL) {
    *ptr = '\0';
    ptr++;
    members[member_num] = field_begin;
    field_begin = ptr;
    member_num++;
    members =
        (char **)realloc((void *)members, (member_num + 1) * sizeof(char *));
  }
  if (*field_begin == '\0')
    members[member_num] = NULL;
  else {
    members[member_num] = field_begin;
    members[member_num + 1] = NULL;
  }
  group.gr_mem = members;
  return &group;
}


x86 assembly (clang, -O0):
<__getgrent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
movw   $0x0,-0xe(%rbp)
movw   $0x100,-0x10(%rbp)
mov    0x2ed2(%rip),%rdi
movswl -0x10(%rbp),%esi
call   1080 <realloc@plt>
mov    %rax,0x2ec2(%rip)
mov    -0xc(%rbp),%edi
mov    0x2eb8(%rip),%rsi
movswl -0xe(%rbp),%eax
cltq
add    %rax,%rsi
movswl -0x10(%rbp),%eax
movswl -0xe(%rbp),%ecx
sub    %ecx,%eax
movswl %ax,%edx
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jg     11dc <__getgrent+0x6c>
movq   $0x0,-0x8(%rbp)
jmp    14d1 <__getgrent+0x361>
mov    0x2e7d(%rip),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     128b <__getgrent+0x11b>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    -0x34(%rbp),%ecx
movswl -0xe(%rbp),%eax
add    %eax,%ecx
mov    0x2e49(%rip),%rax
movslq %ecx,%rcx
add    %rcx,%rax
sub    %rax,%rsi
mov    0x2dc1(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    0x2e24(%rip),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     1281 <__getgrent+0x111>
mov    0x2e11(%rip),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1281 <__getgrent+0x111>
mov    0x2dfe(%rip),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     1281 <__getgrent+0x111>
mov    0x2deb(%rip),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    1286 <__getgrent+0x116>
jmp    117b <__getgrent+0xb>
jmp    12bc <__getgrent+0x14c>
mov    -0x10(%rbp),%ax
mov    %ax,-0xe(%rbp)
movswl -0x10(%rbp),%eax
add    $0x100,%eax
mov    %ax,-0x10(%rbp)
mov    0x2db9(%rip),%rdi
movswl -0x10(%rbp),%esi
call   1080 <realloc@plt>
mov    %rax,0x2da9(%rip)
jmp    119e <__getgrent+0x2e>
mov    0x2d9d(%rip),%rax
mov    %rax,0x2da6(%rip)
mov    0x2d8f(%rip),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12ef <__getgrent+0x17f>
jmp    117b <__getgrent+0xb>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,0x2d6c(%rip)
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    132e <__getgrent+0x1be>
jmp    117b <__getgrent+0xb>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    136a <__getgrent+0x1fa>
jmp    117b <__getgrent+0xb>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %rax,0x2cf3(%rip)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13aa <__getgrent+0x23a>
jmp    117b <__getgrent+0xb>
movw   $0x0,-0x22(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,0x2ca8(%rip)
je     13d2 <__getgrent+0x262>
mov    0x2c9b(%rip),%rdi
call   1030 <free@plt>
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,0x2c85(%rip)
mov    -0x18(%rbp),%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1462 <__getgrent+0x2f2>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdx
mov    0x2c4b(%rip),%rax
movswq -0x22(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x22(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x22(%rbp)
mov    0x2c27(%rip),%rdi
movswl -0x22(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
movswl %ax,%esi
call   1080 <realloc@plt>
mov    %rax,0x2c0b(%rip)
jmp    13e3 <__getgrent+0x273>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    148b <__getgrent+0x31b>
mov    0x2bef(%rip),%rax
movswq -0x22(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    14b8 <__getgrent+0x348>
mov    -0x20(%rbp),%rdx
mov    0x2bd2(%rip),%rax
movswq -0x22(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    0x2bc2(%rip),%rax
movswl -0x22(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
mov    0x2ba9(%rip),%rax
mov    %rax,0x2bba(%rip)
lea    0x2ba3(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getgrent>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
mov    0x2edb(%rip),%rdi
mov    $0x100,%esi
call   1080 <realloc@plt>
mov    %rax,0x2eca(%rip)
mov    %r13d,%edi
mov    %rax,%rsi
mov    $0x100,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    135d <__getgrent+0x1ed>
mov    %eax,%r12d
xor    %r14d,%r14d
mov    0x2ea5(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11e0 <__getgrent+0x70>
mov    %rax,%rbp
xor    %r15d,%r15d
jmp    1252 <__getgrent+0xe2>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x100(%r15),%ebp
lea    0x200(%r15),%eax
movswl %ax,%esi
mov    %rbx,%rdi
call   1080 <realloc@plt>
mov    %rax,0x2e50(%rip)
movswq %bp,%rsi
add    %rax,%rsi
mov    %r13d,%edi
mov    $0x100,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    1360 <__getgrent+0x1f0>
mov    %eax,%r12d
mov    0x2e2a(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
add    $0x100,%r15d
test   %rax,%rax
je     11f0 <__getgrent+0x80>
mov    %rax,%rbp
movswl %r15w,%eax
add    %r12d,%eax
cltq
add    %rbx,%rax
neg    %rax
lea    (%rax,%rbp,1),%rsi
add    $0x1,%rsi
mov    0x2d78(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
call   1050 <lseek@plt>
movb   $0x0,0x0(%rbp)
mov    0x2ddb(%rip),%rbx
movzbl (%rbx),%eax
cmp    $0x23,%rax
ja     12d2 <__getgrent+0x162>
movabs $0x900000600,%rcx
bt     %rax,%rcx
jae    12d2 <__getgrent+0x162>
mov    %rbx,%rdi
mov    $0x100,%esi
call   1080 <realloc@plt>
mov    %rax,0x2dae(%rip)
mov    %r13d,%edi
mov    %rax,%rsi
mov    $0x100,%edx
call   1060 <read@plt>
mov    %eax,%r12d
test   %eax,%eax
jg     11b4 <__getgrent+0x44>
jmp    1360 <__getgrent+0x1f0>
mov    %rbx,0x2d97(%rip)
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     129e <__getgrent+0x12e>
mov    %rax,%rdi
add    $0x1,%rdi
movb   $0x0,(%rax)
mov    %rdi,0x2d7c(%rip)
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     129e <__getgrent+0x12e>
mov    %rax,%rbp
add    $0x1,%rbp
movb   $0x0,(%rax)
mov    %rbp,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     129e <__getgrent+0x12e>
mov    %rax,%r12
movb   $0x0,(%rax)
mov    %rbp,%rdi
mov    %rsp,%rsi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %rax,0x2d40(%rip)
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     1372 <__getgrent+0x202>
mov    0x2d08(%rip),%rbx
jmp    129e <__getgrent+0x12e>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cef(%rip),%rdi
test   %rdi,%rdi
je     1383 <__getgrent+0x213>
call   1030 <free@plt>
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
add    $0x1,%r12
mov    %rax,0x2ccd(%rip)
mov    %r12,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1403 <__getgrent+0x293>
mov    %rax,%r15
mov    $0x10,%bp
xor    %ebx,%ebx
movb   $0x0,(%r15)
movswq %bx,%rax
mov    %r12,(%r14,%rax,8)
add    $0x1,%ebx
mov    0x2c9c(%rip),%rdi
movswl %bp,%esi
call   1080 <realloc@plt>
mov    %rax,%r14
mov    %r15,%r12
add    $0x1,%r12
mov    %rax,0x2c83(%rip)
mov    %r12,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,%r15
add    $0x8,%ebp
test   %rax,%rax
jne    13b6 <__getgrent+0x246>
movswq %bx,%rax
jmp    1405 <__getgrent+0x295>
xor    %eax,%eax
cmpb   $0x0,(%r12)
je     1417 <__getgrent+0x2a7>
movq   $0x0,0x8(%r14,%rax,8)
jmp    141a <__getgrent+0x2aa>
xor    %r12d,%r12d
mov    %r12,(%r14,%rax,8)
mov    %r14,0x2c5b(%rip)
lea    0x2c44(%rip),%r14
jmp    1360 <__getgrent+0x1f0>

LLVM IR (-O0):
%struct.group = type { i8*, i8*, i8**, i64 }
@__getgrent.line_buff = internal global i8* null
@__getgrent.members = internal global i8** null
@__getgrent.group = internal global %struct.group zeroinitializer
@SEEK_CUR = global i32 0
define %struct.group* @__getgrent(i32 %0) {
%2 = alloca %struct.group*
%3 = alloca i32
%4 = alloca i16
%5 = alloca i16
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i16
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %3
br label %11
11: ; preds = %118, %108, %99, %90, %72, %1
store i16 0, i16* %4
store i16 256, i16* %5
%12 = load i8*, i8** @__getgrent.line_buff
%13 = load i16, i16* %5
%14 = call i8* @realloc(i8* %12, i16 signext %13)
store i8* %14, i8** @__getgrent.line_buff
br label %15
15: ; preds = %11, %83
%16 = load i32, i32* %3
%17 = load i8*, i8** @__getgrent.line_buff
%18 = load i16, i16* %4
%19 = sext i16 %18 to i32
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = load i16, i16* %5
%23 = sext i16 %22 to i32
%24 = load i16, i16* %4
%25 = sext i16 %24 to i32
%26 = sub nsw i32 %23, %25
%27 = trunc i32 %26 to i16
%28 = call i32 @read(i32 %16, i8* %21, i16 signext %27)
store i32 %28, i32* %10
%29 = icmp sle i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %15
store %struct.group* null, %struct.group** %2
br label %179
31: ; preds = %15
%32 = load i8*, i8** @__getgrent.line_buff
%33 = call i8* @strchr(i8* %32, i8 signext 10)
store i8* %33, i8** %7
%34 = load i8*, i8** %7
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %74
36: ; preds = %31
%37 = load i32, i32* %3
%38 = load i8*, i8** %7
%39 = getelementptr inbounds i8, i8* %38, i64 1
%40 = load i32, i32* %10
%41 = load i16, i16* %4
%42 = sext i16 %41 to i32
%43 = add nsw i32 %40, %42
%44 = load i8*, i8** @__getgrent.line_buff
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds i8, i8* %44, i64 %45
%47 = ptrtoint i8* %39 to i64
%48 = ptrtoint i8* %46 to i64
%49 = sub i64 %47, %48
%50 = load i32, i32* @SEEK_CUR
%51 = call i32 @lseek(i32 %37, i64 %49, i32 %50)
%52 = load i8*, i8** %7
store i8 0, i8* %52
%53 = load i8*, i8** @__getgrent.line_buff
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 35
br i1 %56, label %72, label %57
57: ; preds = %36
%58 = load i8*, i8** @__getgrent.line_buff
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 32
br i1 %61, label %72, label %62
62: ; preds = %57
%63 = load i8*, i8** @__getgrent.line_buff
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 10
br i1 %66, label %72, label %67
67: ; preds = %62
%68 = load i8*, i8** @__getgrent.line_buff
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 9
br i1 %71, label %72, label %73
72: ; preds = %67, %62, %57, %36
br label %11
73: ; preds = %67
br label %84
74: ; preds = %31
%75 = load i16, i16* %5
store i16 %75, i16* %4
%76 = load i16, i16* %5
%77 = sext i16 %76 to i32
%78 = add nsw i32 %77, 256
%79 = trunc i32 %78 to i16
store i16 %79, i16* %5
%80 = load i8*, i8** @__getgrent.line_buff
%81 = load i16, i16* %5
%82 = call i8* @realloc(i8* %80, i16 signext %81)
store i8* %82, i8** @__getgrent.line_buff
br label %83
83: ; preds = %74
br label %15
84: ; preds = %73
%85 = load i8*, i8** @__getgrent.line_buff
store i8* %85, i8** getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i32 0, i32 0)
%86 = load i8*, i8** @__getgrent.line_buff
%87 = call i8* @strchr(i8* %86, i8 signext 58)
store i8* %87, i8** %6
%88 = load i8*, i8** %6
%89 = icmp eq i8* %88, null
br i1 %89, label %90, label %91
90: ; preds = %84
br label %11
91: ; preds = %84
%92 = load i8*, i8** %6
%93 = getelementptr inbounds i8, i8* %92, i32 1
store i8* %93, i8** %6
store i8 0, i8* %92
%94 = load i8*, i8** %6
store i8* %94, i8** getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i32 0, i32 1)
%95 = load i8*, i8** %6
%96 = call i8* @strchr(i8* %95, i8 signext 58)
store i8* %96, i8** %6
%97 = load i8*, i8** %6
%98 = icmp eq i8* %97, null
br i1 %98, label %99, label %100
99: ; preds = %91
br label %11
100: ; preds = %91
%101 = load i8*, i8** %6
%102 = getelementptr inbounds i8, i8* %101, i32 1
store i8* %102, i8** %6
store i8 0, i8* %101
%103 = load i8*, i8** %6
store i8* %103, i8** %7
%104 = load i8*, i8** %6
%105 = call i8* @strchr(i8* %104, i8 signext 58)
store i8* %105, i8** %6
%106 = load i8*, i8** %6
%107 = icmp eq i8* %106, null
br i1 %107, label %108, label %109
108: ; preds = %100
br label %11
109: ; preds = %100
%110 = load i8*, i8** %6
%111 = getelementptr inbounds i8, i8* %110, i32 1
store i8* %111, i8** %6
store i8 0, i8* %110
%112 = load i8*, i8** %7
%113 = call i64 @strtoul(i8* %112, i8** %9, i32 10)
store i64 %113, i64* getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i32 0, i32 3)
%114 = load i8*, i8** %9
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = icmp ne i32 %116, 0
br i1 %117, label %118, label %119
118: ; preds = %109
br label %11
119: ; preds = %109
store i16 0, i16* %8
%120 = load i8*, i8** %6
store i8* %120, i8** %7
%121 = load i8**, i8*** @__getgrent.members
%122 = icmp ne i8** %121, null
br i1 %122, label %123, label %126
123: ; preds = %119
%124 = load i8**, i8*** @__getgrent.members
%125 = call i32 @free(i8** %124)
br label %126
126: ; preds = %123, %119
%127 = call i64 @malloc(i32 8)
%128 = inttoptr i64 %127 to i8**
store i8** %128, i8*** @__getgrent.members
br label %129
129: ; preds = %133, %126
%130 = load i8*, i8** %6
%131 = call i8* @strchr(i8* %130, i8 signext 44)
store i8* %131, i8** %6
%132 = icmp ne i8* %131, null
br i1 %132, label %133, label %155
133: ; preds = %129
%134 = load i8*, i8** %6
store i8 0, i8* %134
%135 = load i8*, i8** %6
%136 = getelementptr inbounds i8, i8* %135, i32 1
store i8* %136, i8** %6
%137 = load i8*, i8** %7
%138 = load i8**, i8*** @__getgrent.members
%139 = load i16, i16* %8
%140 = sext i16 %139 to i64
%141 = getelementptr inbounds i8*, i8** %138, i64 %140
store i8* %137, i8** %141
%142 = load i8*, i8** %6
store i8* %142, i8** %7
%143 = load i16, i16* %8
%144 = add i16 %143, 1
store i16 %144, i16* %8
%145 = load i8**, i8*** @__getgrent.members
%146 = bitcast i8** %145 to i8*
%147 = load i16, i16* %8
%148 = sext i16 %147 to i32
%149 = add nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = mul i64 %150, 8
%152 = trunc i64 %151 to i16
%153 = call i8* @realloc(i8* %146, i16 signext %152)
%154 = bitcast i8* %153 to i8**
store i8** %154, i8*** @__getgrent.members
br label %129
155: ; preds = %129
%156 = load i8*, i8** %7
%157 = load i8, i8* %156
%158 = sext i8 %157 to i32
%159 = icmp eq i32 %158, 0
br i1 %159, label %160, label %165
160: ; preds = %155
%161 = load i8**, i8*** @__getgrent.members
%162 = load i16, i16* %8
%163 = sext i16 %162 to i64
%164 = getelementptr inbounds i8*, i8** %161, i64 %163
store i8* null, i8** %164
br label %177
165: ; preds = %155
%166 = load i8*, i8** %7
%167 = load i8**, i8*** @__getgrent.members
%168 = load i16, i16* %8
%169 = sext i16 %168 to i64
%170 = getelementptr inbounds i8*, i8** %167, i64 %169
store i8* %166, i8** %170
%171 = load i8**, i8*** @__getgrent.members
%172 = load i16, i16* %8
%173 = sext i16 %172 to i32
%174 = add nsw i32 %173, 1
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i8*, i8** %171, i64 %175
store i8* null, i8** %176
br label %177
177: ; preds = %165, %160
%178 = load i8**, i8*** @__getgrent.members
store i8** %178, i8*** getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i32 0, i32 2)
store %struct.group* @__getgrent.group, %struct.group** %2
br label %179
179: ; preds = %177, %30
%180 = load %struct.group*, %struct.group** %2
ret %struct.group* %180
}

LLVM IR (-O2):
%struct.group = type { i8*, i8*, i8**, i64 }
@__getgrent.line_buff = internal unnamed_addr global i8* null
@__getgrent.members = internal unnamed_addr global i8** null
@__getgrent.group = internal global %struct.group zeroinitializer
@SEEK_CUR = global i32 0
define %struct.group* @__getgrent(i32 %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = load i8*, i8** @__getgrent.line_buff
%5 = tail call i8* @realloc(i8* %4, i16 signext 256)
store i8* %5, i8** @__getgrent.line_buff
%6 = tail call i32 @read(i32 %0, i8* %5, i16 signext 256)
%7 = icmp slt i32 %6, 1
br i1 %7, label %108, label %8
8: ; preds = %1, %34
%9 = phi i32 [ %37, %34 ], [ %6, %1 ]
%10 = load i8*, i8** @__getgrent.line_buff
%11 = tail call i8* @strchr(i8* dereferenceable(1) %10, i8 signext 10)
%12 = icmp eq i8* %11, null
br i1 %12, label %39, label %17
13: ; preds = %39
%14 = load i8*, i8** @__getgrent.line_buff
%15 = tail call i8* @strchr(i8* dereferenceable(1) %14, i8 signext 10)
%16 = icmp eq i8* %15, null
br i1 %16, label %39, label %17
17: ; preds = %13, %8
%18 = phi i32 [ %9, %8 ], [ %46, %13 ]
%19 = phi i16 [ 0, %8 ], [ %41, %13 ]
%20 = phi i8* [ %10, %8 ], [ %14, %13 ]
%21 = phi i8* [ %11, %8 ], [ %15, %13 ]
%22 = sext i16 %19 to i32
%23 = getelementptr inbounds i8, i8* %21, i64 1
%24 = add nsw i32 %18, %22
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %20, i64 %25
%27 = ptrtoint i8* %23 to i64
%28 = ptrtoint i8* %26 to i64
%29 = sub i64 %27, %28
%30 = load i32, i32* @SEEK_CUR
%31 = tail call i32 @lseek(i32 %0, i64 %29, i32 %30)
store i8 0, i8* %21
%32 = load i8*, i8** @__getgrent.line_buff
%33 = load i8, i8* %32
switch i8 %33, label %48 [
i8 35, label %34
i8 32, label %34
i8 10, label %34
i8 9, label %34
]
34: ; preds = %64, %17, %17, %17, %17, %48, %51, %55
%35 = phi i8* [ %65, %64 ], [ %32, %17 ], [ %32, %17 ], [ %32, %17 ], [ %32, %17 ], [ %32, %48 ], [ %32, %51 ], [ %32, %55 ]
%36 = tail call i8* @realloc(i8* %35, i16 signext 256)
store i8* %36, i8** @__getgrent.line_buff
%37 = tail call i32 @read(i32 %0, i8* %36, i16 signext 256)
%38 = icmp slt i32 %37, 1
br i1 %38, label %108, label %8
39: ; preds = %8, %13
%40 = phi i8* [ %14, %13 ], [ %10, %8 ]
%41 = phi i16 [ %42, %13 ], [ 256, %8 ]
%42 = add i16 %41, 256
%43 = tail call i8* @realloc(i8* %40, i16 signext %42)
store i8* %43, i8** @__getgrent.line_buff
%44 = sext i16 %41 to i64
%45 = getelementptr inbounds i8, i8* %43, i64 %44
%46 = tail call i32 @read(i32 %0, i8* %45, i16 signext 256)
%47 = icmp slt i32 %46, 1
br i1 %47, label %108, label %13
48: ; preds = %17
store i8* %32, i8** getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i64 0, i32 0)
%49 = tail call i8* @strchr(i8* dereferenceable(1) %32, i8 signext 58)
%50 = icmp eq i8* %49, null
br i1 %50, label %34, label %51
51: ; preds = %48
%52 = getelementptr inbounds i8, i8* %49, i64 1
store i8 0, i8* %49
store i8* %52, i8** getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i64 0, i32 1)
%53 = tail call i8* @strchr(i8* %52, i8 signext 58)
%54 = icmp eq i8* %53, null
br i1 %54, label %34, label %55
55: ; preds = %51
%56 = getelementptr inbounds i8, i8* %53, i64 1
store i8 0, i8* %53
%57 = tail call i8* @strchr(i8* %56, i8 signext 58)
%58 = icmp eq i8* %57, null
br i1 %58, label %34, label %59
59: ; preds = %55
store i8 0, i8* %57
%60 = call i64 @strtoul(i8* %56, i8** %2, i32 10)
store i64 %60, i64* getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i64 0, i32 3)
%61 = load i8*, i8** %2
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %59
%65 = load i8*, i8** @__getgrent.line_buff
br label %34
66: ; preds = %59
%67 = load i8**, i8*** @__getgrent.members
%68 = icmp eq i8** %67, null
br i1 %68, label %71, label %69
69: ; preds = %66
%70 = tail call i32 @free(i8** %67)
br label %71
71: ; preds = %69, %66
%72 = tail call i64 @malloc(i32 8)
%73 = inttoptr i64 %72 to i8**
%74 = getelementptr inbounds i8, i8* %57, i64 1
store i8** %73, i8*** @__getgrent.members
%75 = tail call i8* @strchr(i8* %74, i8 signext 44)
%76 = icmp eq i8* %75, null
br i1 %76, label %96, label %77
77: ; preds = %71, %77
%78 = phi i8* [ %91, %77 ], [ %75, %71 ]
%79 = phi i8* [ %90, %77 ], [ %74, %71 ]
%80 = phi i16 [ %84, %77 ], [ 0, %71 ]
%81 = phi i8** [ %89, %77 ], [ %73, %71 ]
store i8 0, i8* %78
%82 = sext i16 %80 to i64
%83 = getelementptr inbounds i8*, i8** %81, i64 %82
store i8* %79, i8** %83
%84 = add i16 %80, 1
%85 = load i8*, i8** bitcast (i8*** @__getgrent.members to i8**)
%86 = shl i16 %84, 3
%87 = add i16 %86, 8
%88 = tail call i8* @realloc(i8* %85, i16 signext %87)
%89 = bitcast i8* %88 to i8**
%90 = getelementptr inbounds i8, i8* %78, i64 1
store i8* %88, i8** bitcast (i8*** @__getgrent.members to i8**)
%91 = tail call i8* @strchr(i8* %90, i8 signext 44)
%92 = icmp eq i8* %91, null
br i1 %92, label %93, label %77
93: ; preds = %77
%94 = bitcast i8* %88 to i8**
%95 = sext i16 %84 to i64
br label %96
96: ; preds = %93, %71
%97 = phi i8** [ %94, %93 ], [ %73, %71 ]
%98 = phi i64 [ %95, %93 ], [ 0, %71 ]
%99 = phi i8* [ %90, %93 ], [ %74, %71 ]
%100 = load i8, i8* %99
%101 = icmp eq i8 %100, 0
br i1 %101, label %105, label %102
102: ; preds = %96
%103 = add nsw i64 %98, 1
%104 = getelementptr inbounds i8*, i8** %97, i64 %103
store i8* null, i8** %104
br label %105
105: ; preds = %96, %102
%106 = phi i8* [ %99, %102 ], [ null, %96 ]
%107 = getelementptr inbounds i8*, i8** %97, i64 %98
store i8* %106, i8** %107
store i8** %97, i8*** getelementptr inbounds (%struct.group, %struct.group* @__getgrent.group, i64 0, i32 2)
br label %108
108: ; preds = %34, %39, %1, %105
%109 = phi %struct.group* [ @__getgrent.group, %105 ], [ null, %1 ], [ null, %39 ], [ null, %34 ]
ret %struct.group* %109
}