#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*/ printf(char *, char *, ...);
int /*<<< orphan*/ putchar(char);
void print_group(const struct group *gr) {
  int i;
  printf("%s:%s:%ld:", gr->gr_name, gr->gr_passwd, (long)gr->gr_gid);
  for (i = 0; gr->gr_mem[i] != NULL; i++) {
    printf("%s", gr->gr_mem[i]);
    if (gr->gr_mem[i + 1] != NULL)
      putchar(',');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11c6 <print_group+0xa6>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11b3 <print_group+0x93>
mov    $0x2c,%edi
call   1030 <putchar@plt>
jmp    11b8 <print_group+0x98>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <print_group+0x38>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_group>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    (%rdi),%rsi
mov    0x8(%rdi),%rdx
mov    0x18(%rdi),%rcx
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r15),%rax
mov    (%rax),%rsi
test   %rsi,%rsi
je     1190 <print_group+0x70>
mov    $0x8,%ebx
lea    0xeb2(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r15),%rax
cmpq   $0x0,(%rax,%rbx,1)
je     1190 <print_group+0x70>
mov    $0x2c,%edi
call   1030 <putchar@plt>
mov    0x10(%r15),%rax
mov    (%rax,%rbx,1),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1160 <print_group+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.group = type { i8*, i8*, i8**, i64 }
@.str = [11 x i8] c"%s:%s:%ld:\00"
@.str.1 = [3 x i8] c"%s\00"
define void @print_group(%struct.group* %0) {
%2 = alloca %struct.group*
%3 = alloca i32
store %struct.group* %0, %struct.group** %2
%4 = load %struct.group*, %struct.group** %2
%5 = getelementptr inbounds %struct.group, %struct.group* %4, i32 0, i32 0
%6 = load i8*, i8** %5
%7 = load %struct.group*, %struct.group** %2
%8 = getelementptr inbounds %struct.group, %struct.group* %7, i32 0, i32 1
%9 = load i8*, i8** %8
%10 = load %struct.group*, %struct.group** %2
%11 = getelementptr inbounds %struct.group, %struct.group* %10, i32 0, i32 3
%12 = load i64, i64* %11
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %9, i64 %12)
store i32 0, i32* %3
br label %14
14: ; preds = %44, %1
%15 = load %struct.group*, %struct.group** %2
%16 = getelementptr inbounds %struct.group, %struct.group* %15, i32 0, i32 2
%17 = load i8**, i8*** %16
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %47
23: ; preds = %14
%24 = load %struct.group*, %struct.group** %2
%25 = getelementptr inbounds %struct.group, %struct.group* %24, i32 0, i32 2
%26 = load i8**, i8*** %25
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load %struct.group*, %struct.group** %2
%33 = getelementptr inbounds %struct.group, %struct.group* %32, i32 0, i32 2
%34 = load i8**, i8*** %33
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %34, i64 %37
%39 = load i8*, i8** %38
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %43
41: ; preds = %23
%42 = call i32 @putchar(i8 signext 44)
br label %43
43: ; preds = %41, %23
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %14
47: ; preds = %14
%48 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
%struct.group = type { i8*, i8*, i8**, i64 }
@.str = [11 x i8] c"%s:%s:%ld:\00"
@.str.1 = [3 x i8] c"%s\00"
define void @print_group(%struct.group* nocapture %0) {
%2 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 1
%5 = load i8*, i8** %4
%6 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 3
%7 = load i64, i64* %6
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %5, i64 %7)
%9 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 2
%10 = load i8**, i8*** %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %28, label %13
13: ; preds = %1, %22
%14 = phi i64 [ %18, %22 ], [ 0, %1 ]
%15 = phi i8* [ %26, %22 ], [ %11, %1 ]
%16 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i8**, i8*** %9
%18 = add nuw i64 %14, 1
%19 = getelementptr inbounds i8*, i8** %17, i64 %18
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %28, label %22
22: ; preds = %13
%23 = tail call i32 @putchar(i8 signext 44)
%24 = load i8**, i8*** %9
%25 = getelementptr inbounds i8*, i8** %24, i64 %18
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %13
28: ; preds = %13, %22, %1
%29 = tail call i32 @putchar(i8 signext 10)
ret void
}