#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 *const, char const *);
int cst_member_string(const char *str, const char *const *slist) {
  const char *const *p;
  for (p = slist; *p; ++p)
    if ((strcmp(*p, str) == 0))
      break;
  return *p != NULL;
}


x86 assembly (clang, -O0):
<cst_member_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     116b <cst_member_string+0x5b>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1155 <cst_member_string+0x45>
jmp    116b <cst_member_string+0x5b>
jmp    115a <cst_member_string+0x4a>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <cst_member_string+0x18>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cst_member_string>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
mov    (%rsi),%rdi
xor    %r14d,%r14d
test   %rdi,%rdi
je     1157 <cst_member_string+0x47>
mov    %rsi,%rbx
add    $0x8,%rbx
nopl   0x0(%rax)
mov    %rbp,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114b <cst_member_string+0x3b>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <cst_member_string+0x20>
jmp    1157 <cst_member_string+0x47>
xor    %r14d,%r14d
cmpq   $0x0,-0x8(%rbx)
setne  %r14b
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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