#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__ memcmp(char *, char *, int);
char *strchr(char *, char);
int strlen(char *);
int nameInCommaList(char *name, char *commaList) {
  if (commaList == NULL)
    return 0;
  int nameLen = strlen(name);
  for (;;) {
    char c = *commaList;
    if (c == 0)
      return 0;
    if (memcmp(name, commaList, nameLen) == 0) {
      c = commaList[nameLen];
      if (c == 0 || c == ',')
        return 1;
    }
    commaList = strchr(commaList, ',');
    if (commaList == NULL)
      return 0;
    commaList += 1;
  }
}


x86 assembly (clang, -O0):
<nameInCommaList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1157 <nameInCommaList+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1212 <nameInCommaList+0xe2>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1d(%rbp)
movsbl -0x1d(%rbp),%eax
cmp    $0x0,%eax
jne    1185 <nameInCommaList+0x55>
movl   $0x0,-0x4(%rbp)
jmp    1212 <nameInCommaList+0xe2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
jne    11d8 <nameInCommaList+0xa8>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1d(%rbp)
movsbl -0x1d(%rbp),%eax
cmp    $0x0,%eax
je     11c7 <nameInCommaList+0x97>
movsbl -0x1d(%rbp),%eax
cmp    $0x2c,%eax
jne    11d3 <nameInCommaList+0xa3>
movl   $0x1,-0x4(%rbp)
jmp    1212 <nameInCommaList+0xe2>
jmp    11d8 <nameInCommaList+0xa8>
mov    -0x18(%rbp),%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1201 <nameInCommaList+0xd1>
movl   $0x0,-0x4(%rbp)
jmp    1212 <nameInCommaList+0xe2>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1163 <nameInCommaList+0x33>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nameInCommaList>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     11a3 <nameInCommaList+0x73>
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
cmpb   $0x0,(%rbx)
je     11a3 <nameInCommaList+0x73>
mov    %eax,%ebp
movslq %eax,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    1185 <nameInCommaList+0x55>
movzbl (%rbx,%r15,1),%ecx
mov    $0x1,%eax
test   %cl,%cl
je     11a5 <nameInCommaList+0x75>
cmp    $0x2c,%cl
je     11a5 <nameInCommaList+0x75>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11a3 <nameInCommaList+0x73>
mov    %rax,%rbx
add    $0x1,%rbx
cmpb   $0x0,(%rbx)
jne    1160 <nameInCommaList+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @nameInCommaList(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %51
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %6
br label %14
14: ; preds = %48, %11
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
store i8 %16, i8* %7
%17 = load i8, i8* %7
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 0, i32* %3
br label %51
21: ; preds = %14
%22 = load i8*, i8** %4
%23 = load i8*, i8** %5
%24 = load i32, i32* %6
%25 = call i64 @memcmp(i8* %22, i8* %23, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %42
27: ; preds = %21
%28 = load i8*, i8** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
store i8 %32, i8* %7
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %27
%37 = load i8, i8* %7
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 44
br i1 %39, label %40, label %41
40: ; preds = %36, %27
store i32 1, i32* %3
br label %51
41: ; preds = %36
br label %42
42: ; preds = %41, %21
%43 = load i8*, i8** %5
%44 = call i8* @strchr(i8* %43, i8 signext 44)
store i8* %44, i8** %5
%45 = load i8*, i8** %5
%46 = icmp eq i8* %45, null
br i1 %46, label %47, label %48
47: ; preds = %42
store i32 0, i32* %3
br label %51
48: ; preds = %42
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i64 1
store i8* %50, i8** %5
br label %14
51: ; preds = %47, %40, %20, %10
%52 = load i32, i32* %3
ret i32 %52
}

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