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

/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
bool ng_check_group_member(const char *user, struct group *ent) {
  for (char **current_user_p = ent->gr_mem; *current_user_p; ++current_user_p) {
    if (strcmp(user, *current_user_p) == 0) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<ng_check_group_member>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     1175 <ng_check_group_member+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    115f <ng_check_group_member+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    117c <ng_check_group_member+0x6c>
jmp    1164 <ng_check_group_member+0x54>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    112b <ng_check_group_member+0x1b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ng_check_group_member>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%rbx
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1153 <ng_check_group_member+0x43>
mov    %rdi,%r14
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1149 <ng_check_group_member+0x39>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <ng_check_group_member+0x20>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
jmp    1155 <ng_check_group_member+0x45>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.group = type { i8** }
define i32 @ng_check_group_member(i8* %0, %struct.group* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.group*
%6 = alloca i8**
store i8* %0, i8** %4
store %struct.group* %1, %struct.group** %5
%7 = load %struct.group*, %struct.group** %5
%8 = getelementptr inbounds %struct.group, %struct.group* %7, i32 0, i32 0
%9 = load i8**, i8*** %8
store i8** %9, i8*** %6
br label %10
10: ; preds = %22, %2
%11 = load i8**, i8*** %6
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i8**, i8*** %6
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %15, i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 1, i32* %3
br label %26
21: ; preds = %14
br label %22
22: ; preds = %21
%23 = load i8**, i8*** %6
%24 = getelementptr inbounds i8*, i8** %23, i32 1
store i8** %24, i8*** %6
br label %10
25: ; preds = %10
store i32 0, i32* %3
br label %26
26: ; preds = %25, %20
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
%struct.group = type { i8** }
define i32 @ng_check_group_member(i8* %0, %struct.group* nocapture %1) {
%3 = getelementptr inbounds %struct.group, %struct.group* %1, i64 0, i32 0
%4 = load i8**, i8*** %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %18, label %10
7: ; preds = %10
%8 = load i8*, i8** %15
%9 = icmp eq i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %2, %7
%11 = phi i8* [ %8, %7 ], [ %5, %2 ]
%12 = phi i8** [ %15, %7 ], [ %4, %2 ]
%13 = tail call i64 @strcmp(i8* %0, i8* %11)
%14 = icmp eq i64 %13, 0
%15 = getelementptr inbounds i8*, i8** %12, i64 1
br i1 %14, label %16, label %7
16: ; preds = %10, %7
%17 = zext i1 %14 to i32
br label %18
18: ; preds = %16, %2
%19 = phi i32 [ 0, %2 ], [ %17, %16 ]
ret i32 %19
}