#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;
};

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, unsigned long);
int /*<<< orphan*/ stdout;
print_group(struct group *grp) {
  unsigned int i = 0;
  printf("%s:%s:%ld:", grp->gr_name ? grp->gr_name : "",
         grp->gr_passwd ? grp->gr_passwd : "", (unsigned long)grp->gr_gid);
  while (grp->gr_mem[i] != NULL) {
    fputs(grp->gr_mem[i], stdout);
    ++i;
    if (grp->gr_mem[i] != NULL)
      fputs(",", stdout);
  }
  fputs("\n", stdout);
}


x86 assembly (clang, -O0):
<print_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1151 <print_group+0x31>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1161 <print_group+0x41>
lea    0xeb6(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1161 <print_group+0x41>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1189 <print_group+0x69>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1199 <print_group+0x79>
lea    0xe7e(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    1199 <print_group+0x79>
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x14(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     1221 <print_group+0x101>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x14(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     121c <print_group+0xfc>
mov    0x2dd2(%rip),%rax
mov    (%rax),%esi
lea    0xdf4(%rip),%rdi
call   1040 <fputs@plt>
jmp    11b5 <print_group+0x95>
mov    0x2db8(%rip),%rax
mov    (%rax),%esi
lea    0xddc(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_group>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rsi
mov    0x8(%rdi),%rdx
test   %rsi,%rsi
lea    0xed3(%rip),%rax
cmove  %rax,%rsi
test   %rdx,%rdx
cmove  %rax,%rdx
mov    0x18(%rdi),%rcx
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     11b0 <print_group+0x90>
mov    $0x1,%ebp
mov    0x2e72(%rip),%r15
lea    0xe96(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%esi
call   1040 <fputs@plt>
mov    0x10(%rbx),%rax
mov    %ebp,%ebp
cmpq   $0x0,(%rax,%rbp,8)
je     11b0 <print_group+0x90>
mov    (%r15),%esi
mov    %r14,%rdi
call   1040 <fputs@plt>
mov    0x10(%rbx),%rax
mov    (%rax,%rbp,8),%rdi
add    $0x1,%ebp
test   %rdi,%rdi
jne    1180 <print_group+0x60>
mov    0x2e29(%rip),%rax
mov    (%rax),%esi
lea    0xe4d(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fputs@plt>

LLVM IR (-O0):
%struct.group = type { i8*, i8*, i8**, i64 }
@.str = [11 x i8] c"%s:%s:%ld:\00"
@.str.1 = [1 x i8] zeroinitializer
@stdout = global i32 0
@.str.2 = [2 x i8] c",\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @print_group(%struct.group* %0) {
%2 = alloca i32
%3 = alloca %struct.group*
%4 = alloca i32
store %struct.group* %0, %struct.group** %3
store i32 0, i32* %4
%5 = load %struct.group*, %struct.group** %3
%6 = getelementptr inbounds %struct.group, %struct.group* %5, i32 0, i32 0
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load %struct.group*, %struct.group** %3
%11 = getelementptr inbounds %struct.group, %struct.group* %10, i32 0, i32 0
%12 = load i8*, i8** %11
br label %14
13: ; preds = %1
br label %14
14: ; preds = %13, %9
%15 = phi i8* [ %12, %9 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %13 ]
%16 = load %struct.group*, %struct.group** %3
%17 = getelementptr inbounds %struct.group, %struct.group* %16, i32 0, i32 1
%18 = load i8*, i8** %17
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = load %struct.group*, %struct.group** %3
%22 = getelementptr inbounds %struct.group, %struct.group* %21, i32 0, i32 1
%23 = load i8*, i8** %22
br label %25
24: ; preds = %14
br label %25
25: ; preds = %24, %20
%26 = phi i8* [ %23, %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %24 ]
%27 = load %struct.group*, %struct.group** %3
%28 = getelementptr inbounds %struct.group, %struct.group* %27, i32 0, i32 3
%29 = load i64, i64* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %26, i64 %29)
br label %31
31: ; preds = %63, %25
%32 = load %struct.group*, %struct.group** %3
%33 = getelementptr inbounds %struct.group, %struct.group* %32, i32 0, i32 2
%34 = load i8**, i8*** %33
%35 = load i32, i32* %4
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %64
40: ; preds = %31
%41 = load %struct.group*, %struct.group** %3
%42 = getelementptr inbounds %struct.group, %struct.group* %41, i32 0, i32 2
%43 = load i8**, i8*** %42
%44 = load i32, i32* %4
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = load i32, i32* @stdout
%49 = call i32 @fputs(i8* %47, i32 %48)
%50 = load i32, i32* %4
%51 = add i32 %50, 1
store i32 %51, i32* %4
%52 = load %struct.group*, %struct.group** %3
%53 = getelementptr inbounds %struct.group, %struct.group* %52, i32 0, i32 2
%54 = load i8**, i8*** %53
%55 = load i32, i32* %4
%56 = zext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = icmp ne i8* %58, null
br i1 %59, label %60, label %63
60: ; preds = %40
%61 = load i32, i32* @stdout
%62 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %60, %40
br label %31
64: ; preds = %31
%65 = load i32, i32* @stdout
%66 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
%struct.group = type { i8*, i8*, i8**, i64 }
@.str = [11 x i8] c"%s:%s:%ld:\00"
@.str.1 = [1 x i8] zeroinitializer
@stdout = global i32 0
@.str.2 = [2 x i8] c",\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @print_group(%struct.group* nocapture %0) {
%2 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %3
%6 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 1
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
%9 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %7
%10 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 3
%11 = load i64, i64* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %9, i64 %11)
%13 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 2
%14 = load i8**, i8*** %13
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %35, label %17
17: ; preds = %1, %28
%18 = phi i8* [ %33, %28 ], [ %15, %1 ]
%19 = phi i32 [ %22, %28 ], [ 0, %1 ]
%20 = load i32, i32* @stdout
%21 = tail call i32 @fputs(i8* %18, i32 %20)
%22 = add i32 %19, 1
%23 = load i8**, i8*** %13
%24 = zext i32 %22 to i64
%25 = getelementptr inbounds i8*, i8** %23, i64 %24
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %35, label %28
28: ; preds = %17
%29 = load i32, i32* @stdout
%30 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i8**, i8*** %13
%32 = getelementptr inbounds i8*, i8** %31, i64 %24
%33 = load i8*, i8** %32
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %17
35: ; preds = %17, %28, %1
%36 = load i32, i32* @stdout
%37 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %36)
ret i32 undef
}