#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 /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strtok(char *, char const *);
int valueNotInListStr(char *value, char *ValueList) {
  if (value == NULL || ValueList == NULL)
    return -1;
  const char *sep = "|";
  char *tok = NULL;
  char *ValueListCopy = (char *)malloc(strlen(ValueList) * sizeof(char) + 1);
  strcpy(ValueListCopy, ValueList);
  tok = strtok(ValueListCopy, sep);
  if (tok == NULL) {
    free(ValueListCopy);
    return -1;
  }
  while (tok) {
    if (strcmp(value, tok) == 0) {
      free(ValueListCopy);
      return 0;
    }
    tok = strtok(NULL, sep);
  }
  free(ValueListCopy);
  return 1;
}


x86 assembly (clang, -O0):
<valueNotInListStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1186 <valueNotInListStr+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1192 <valueNotInListStr+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1263 <valueNotInListStr+0x103>
lea    0xe67(%rip),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
cltq
shl    $0x0,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1201 <valueNotInListStr+0xa1>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1263 <valueNotInListStr+0x103>
jmp    1206 <valueNotInListStr+0xa6>
cmpq   $0x0,-0x28(%rbp)
je     1253 <valueNotInListStr+0xf3>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    123d <valueNotInListStr+0xdd>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    1263 <valueNotInListStr+0x103>
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1080 <strtok@plt>
mov    %rax,-0x28(%rbp)
jmp    1206 <valueNotInListStr+0xa6>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valueNotInListStr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0xffffffff,%r15d
test   %rdi,%rdi
je     11f5 <valueNotInListStr+0x95>
mov    %rsi,%r12
test   %rsi,%rsi
je     11f5 <valueNotInListStr+0x95>
mov    %rdi,%rbx
mov    %r12,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
lea    0xe59(%rip),%rsi
mov    %r14,%rdi
call   1080 <strtok@plt>
test   %rax,%rax
je     11e7 <valueNotInListStr+0x87>
lea    0xe45(%rip),%r12
xor    %r15d,%r15d
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11ed <valueNotInListStr+0x8d>
xor    %edi,%edi
mov    %r12,%rsi
call   1080 <strtok@plt>
test   %rax,%rax
jne    11c0 <valueNotInListStr+0x60>
mov    $0x1,%r15d
jmp    11ed <valueNotInListStr+0x8d>
mov    $0xffffffff,%r15d
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"|\00"
define i32 @valueNotInListStr(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %11, %2
store i32 -1, i32* %3
br label %53
15: ; preds = %11
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* null, i8** %7
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* %16)
%18 = sext i32 %17 to i64
%19 = mul i64 %18, 1
%20 = add i64 %19, 1
%21 = trunc i64 %20 to i32
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %8
%24 = load i8*, i8** %8
%25 = load i8*, i8** %5
%26 = call i32 @strcpy(i8* %24, i8* %25)
%27 = load i8*, i8** %8
%28 = load i8*, i8** %6
%29 = call i8* @strtok(i8* %27, i8* %28)
store i8* %29, i8** %7
%30 = load i8*, i8** %7
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %35
32: ; preds = %15
%33 = load i8*, i8** %8
%34 = call i32 @free(i8* %33)
store i32 -1, i32* %3
br label %53
35: ; preds = %15
br label %36
36: ; preds = %47, %35
%37 = load i8*, i8** %7
%38 = icmp ne i8* %37, null
br i1 %38, label %39, label %50
39: ; preds = %36
%40 = load i8*, i8** %4
%41 = load i8*, i8** %7
%42 = call i64 @strcmp(i8* %40, i8* %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load i8*, i8** %8
%46 = call i32 @free(i8* %45)
store i32 0, i32* %3
br label %53
47: ; preds = %39
%48 = load i8*, i8** %6
%49 = call i8* @strtok(i8* null, i8* %48)
store i8* %49, i8** %7
br label %36
50: ; preds = %36
%51 = load i8*, i8** %8
%52 = call i32 @free(i8* %51)
store i32 1, i32* %3
br label %53
53: ; preds = %50, %44, %32, %14
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@.str = [2 x i8] c"|\00"
define i32 @valueNotInListStr(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %24, label %6
6: ; preds = %2
%7 = tail call i32 @strlen(i8* %1)
%8 = add i32 %7, 1
%9 = tail call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 @strcpy(i8* %10, i8* %1)
%12 = tail call i8* @strtok(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %21, label %14
14: ; preds = %6, %18
%15 = phi i8* [ %19, %18 ], [ %12, %6 ]
%16 = tail call i64 @strcmp(i8* %0, i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %14
21: ; preds = %18, %14, %6
%22 = phi i32 [ -1, %6 ], [ 0, %14 ], [ 1, %18 ]
%23 = tail call i32 @free(i8* %10)
br label %24
24: ; preds = %21, %2
%25 = phi i32 [ -1, %2 ], [ %22, %21 ]
ret i32 %25
}