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

/* Variables and functions */
scalar_t__ strcmp(scalar_t__, char *);
int isUserInGroup(char *userName, struct group *g) {
  int i;
  for (i = 0; g->gr_mem[i]; i++) {
    if (strcmp(g->gr_mem[i], userName) == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<isUserInGroup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     117e <isUserInGroup+0x6e>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    116b <isUserInGroup+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    1185 <isUserInGroup+0x75>
jmp    1170 <isUserInGroup+0x60>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <isUserInGroup+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isUserInGroup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    (%rsi),%rax
mov    (%rax),%rdi
xor    %r14d,%r14d
test   %rdi,%rdi
je     1155 <isUserInGroup+0x45>
mov    %rsi,%rbx
mov    $0x8,%ebp
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114f <isUserInGroup+0x3f>
mov    (%rbx),%rax
mov    (%rax,%rbp,1),%rdi
add    $0x8,%rbp
test   %rdi,%rdi
jne    1130 <isUserInGroup+0x20>
jmp    1155 <isUserInGroup+0x45>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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