#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);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strtok(char *, char const *);
long long strtoll(char *, int /*<<< orphan*/ *, int);
int valueInListInt(long long int value, char *ValueList) {
  if (ValueList == NULL)
    return -1;
  const char *sep = "|";
  char *tok = NULL;
  long long int tok_int = 0;
  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) {
    tok_int = strtoll(tok, NULL, 10);
    if (value == tok_int) {
      free(ValueListCopy);
      return 1;
    }
    tok = strtok(NULL, sep);
  }
  free(ValueListCopy);
  return 0;
}


x86 assembly (clang, -O0):
<valueInListInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1187 <valueInListInt+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    126d <valueInListInt+0x10d>
lea    0xe72(%rip),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%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,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11fe <valueInListInt+0x9e>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    126d <valueInListInt+0x10d>
jmp    1203 <valueInListInt+0xa3>
cmpq   $0x0,-0x28(%rbp)
je     125d <valueInListInt+0xfd>
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtoll@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x30(%rbp),%rax
jne    1247 <valueInListInt+0xe7>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    126d <valueInListInt+0x10d>
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1080 <strtok@plt>
mov    %rax,-0x28(%rbp)
jmp    1203 <valueInListInt+0xa3>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valueInListInt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     11d7 <valueInListInt+0x77>
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0xe68(%rip),%rsi
mov    %r14,%rdi
call   1080 <strtok@plt>
test   %rax,%rax
je     11de <valueInListInt+0x7e>
lea    0xe54(%rip),%r12
nopl   0x0(%rax)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtoll@plt>
cmp    %r15,%rax
je     11e5 <valueInListInt+0x85>
xor    %ebx,%ebx
xor    %edi,%edi
mov    %r12,%rsi
call   1080 <strtok@plt>
test   %rax,%rax
jne    11b0 <valueInListInt+0x50>
jmp    11ea <valueInListInt+0x8a>
mov    $0xffffffff,%ebx
jmp    11f2 <valueInListInt+0x92>
mov    $0xffffffff,%ebx
jmp    11ea <valueInListInt+0x8a>
mov    $0x1,%ebx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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