#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 */

/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int memberOfList(const char *name, char **list) {
  if (list) {
    for (; *list; list++) {
      if (strcmp(name, *list) == 0)
        return 1;
    }
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<memberOfList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1186 <memberOfList+0x76>
jmp    1130 <memberOfList+0x20>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     117a <memberOfList+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1164 <memberOfList+0x54>
movl   $0x1,-0x4(%rbp)
jmp    118d <memberOfList+0x7d>
jmp    1169 <memberOfList+0x59>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1130 <memberOfList+0x20>
movl   $0x0,-0x4(%rbp)
jmp    118d <memberOfList+0x7d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memberOfList>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%r14d
test   %rsi,%rsi
je     115c <memberOfList+0x4c>
mov    %rsi,%rbx
mov    (%rsi),%rsi
test   %rsi,%rsi
je     1159 <memberOfList+0x49>
mov    %rdi,%rbp
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     115c <memberOfList+0x4c>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1140 <memberOfList+0x30>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @memberOfList(i8* %0, i8** %1) {
%3 = icmp eq i8** %1, null
br i1 %3, label %16, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
br i1 %6, label %16, 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 = %4, %7
%11 = phi i8* [ %8, %7 ], [ %5, %4 ]
%12 = phi i8** [ %15, %7 ], [ %1, %4 ]
%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, %4, %2
%17 = phi i32 [ 1, %2 ], [ 0, %4 ], [ 1, %10 ], [ 0, %7 ]
ret i32 %17
}