#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 *, char *);
int isinlist(char *s, char *list[]) {
  int i;
  for (i = 0; strcmp(list[i], "") != 0; i++) {
    if (strcmp(s, list[i]) == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<isinlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1187 <isinlist+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1174 <isinlist+0x64>
movl   $0x1,-0x4(%rbp)
jmp    118e <isinlist+0x7e>
jmp    1179 <isinlist+0x69>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <isinlist+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinlist>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    (%rsi),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     116d <isinlist+0x5d>
add    $0x8,%rbx
lea    0xec1(%rip),%r15
nop
mov    -0x8(%rbx),%rsi
mov    %rbp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1167 <isinlist+0x57>
mov    (%rbx),%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
add    $0x8,%rbx
test   %rax,%rax
jne    1140 <isinlist+0x30>
jmp    116d <isinlist+0x5d>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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