#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 */
int strlen(char const *);
char *strstr(char const *, char const *);
int member(const char *elem, const char *list) {
  char *p;
  int len;
  p = strstr(list, elem);
  len = strlen(elem);
  return (p != NULL && (p == list || p[-1] == ',') &&
          (p[len] == '\0' || p[len] == ','));
}


x86 assembly (clang, -O0):
<member>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
je     11b6 <member+0x96>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1181 <member+0x61>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x2c,%ecx
mov    %al,-0x1d(%rbp)
jne    11b6 <member+0x96>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1e(%rbp)
je     11b0 <member+0x90>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
sete   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<member>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1040 <strstr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %r15,%r15
je     1170 <member+0x50>
cmp    %r14,%r15
je     1156 <member+0x36>
cmpb   $0x2c,-0x1(%r15)
jne    1170 <member+0x50>
movslq %ecx,%rax
mov    (%r15,%rax,1),%cl
test   %cl,%cl
je     116b <member+0x4b>
xor    %eax,%eax
cmp    $0x2c,%cl
sete   %al
jmp    1170 <member+0x50>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @member(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = call i8* @strstr(i8* %7, i8* %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %6
%12 = load i8*, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %42
14: ; preds = %2
%15 = load i8*, i8** %5
%16 = load i8*, i8** %4
%17 = icmp eq i8* %15, %16
br i1 %17, label %24, label %18
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 -1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 44
br i1 %23, label %24, label %42
24: ; preds = %18, %14
%25 = load i8*, i8** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %40, label %32
32: ; preds = %24
%33 = load i8*, i8** %5
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 44
br label %40
40: ; preds = %32, %24
%41 = phi i1 [ true, %24 ], [ %39, %32 ]
br label %42
42: ; preds = %40, %18, %2
%43 = phi i1 [ false, %18 ], [ false, %2 ], [ %41, %40 ]
%44 = zext i1 %43 to i32
ret i32 %44
}

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