#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*/ Destroy(char *);
char *GetTok(char const *, char *, char **);
scalar_t__ ItemMatches(char *, char const *);
int ItemListMatches(const char *ItemList, const char *MatchList) {
  char *Item = NULL;
  const char *ptr;
  int result = 0;
  ptr = GetTok(ItemList, " ", &Item);
  while (ptr) {
    if (ItemMatches(Item, MatchList)) {
      result = 1;
      break;
    }
    ptr = GetTok(ptr, " ", &Item);
  }
  Destroy(Item);
  return (result);
}


x86 assembly (clang, -O0):
<ItemListMatches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <GetTok@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11b2 <ItemListMatches+0x82>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ItemMatches@plt>
cmp    $0x0,%rax
je     1195 <ItemListMatches+0x65>
movl   $0x1,-0x24(%rbp)
jmp    11b2 <ItemListMatches+0x82>
mov    -0x20(%rbp),%rdi
lea    0xe60(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <GetTok@plt>
mov    %rax,-0x20(%rbp)
jmp    1167 <ItemListMatches+0x37>
mov    -0x18(%rbp),%rdi
call   1050 <Destroy@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ItemListMatches>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
lea    0xeb1(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1030 <GetTok@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     11a0 <ItemListMatches+0x70>
mov    %rax,%rbp
lea    0xe95(%rip),%r15
lea    0x8(%rsp),%r12
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <ItemMatches@plt>
test   %rax,%rax
jne    119a <ItemListMatches+0x6a>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <GetTok@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1170 <ItemListMatches+0x40>
jmp    11a0 <ItemListMatches+0x70>
mov    $0x1,%r14d
mov    0x8(%rsp),%rdi
call   1050 <Destroy@plt>
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define i32 @ItemListMatches(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8* null, i8** %5
store i32 0, i32* %7
%8 = load i8*, i8** %3
%9 = call i8* @GetTok(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5)
store i8* %9, i8** %6
br label %10
10: ; preds = %19, %2
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i8*, i8** %5
%15 = load i8*, i8** %4
%16 = call i64 @ItemMatches(i8* %14, i8* %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 1, i32* %7
br label %22
19: ; preds = %13
%20 = load i8*, i8** %6
%21 = call i8* @GetTok(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5)
store i8* %21, i8** %6
br label %10
22: ; preds = %18, %10
%23 = load i8*, i8** %5
%24 = call i32 @Destroy(i8* %23)
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @ItemListMatches(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i8* @GetTok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %3)
%6 = icmp eq i8* %5, null
br i1 %6, label %15, label %7
7: ; preds = %2, %12
%8 = phi i8* [ %13, %12 ], [ %5, %2 ]
%9 = load i8*, i8** %3
%10 = call i64 @ItemMatches(i8* %9, i8* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = call i8* @GetTok(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %3)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %7
15: ; preds = %12, %7, %2
%16 = phi i32 [ 0, %2 ], [ 1, %7 ], [ 0, %12 ]
%17 = load i8*, i8** %3
%18 = call i32 @Destroy(i8* %17)
ret i32 %16
}