#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*/ assert(int);
int match_keywords(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
void test_match_keywords() {
  char keywords1[(4096 * 4)];
  char keywords2[(4096 * 4)];
  printf("test_match_keywords...");
  sprintf(keywords1, "%s", "the, cat, sat, on, the, mat");
  sprintf(keywords2, "%s", "cat, mat");
  assert(match_keywords(keywords2, keywords1) == 2);
  sprintf(keywords2, "%s", "badger, antelope");
  assert(match_keywords(keywords2, keywords1) == 0);
  sprintf(keywords2, "%s", "badger, the, antelope");
  assert(match_keywords(keywords2, keywords1) == 1);
  sprintf(keywords2, "%s", "the, cat, sat, on, the, mat");
  assert(match_keywords(keywords2, keywords1) == 6);
  printf("Ok\n");
}


x86 assembly (clang, -O0):
<test_match_keywords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8000,%rsp
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    -0x4000(%rbp),%rdi
lea    0xeb2(%rip),%rsi
lea    0xeae(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x8000(%rbp),%rdi
lea    0xe98(%rip),%rsi
lea    0xeb0(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x8000(%rbp),%rdi
lea    -0x4000(%rbp),%rsi
call   1050 <match_keywords@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x8000(%rbp),%rdi
lea    0xe5b(%rip),%rsi
lea    0xe7c(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x8000(%rbp),%rdi
lea    -0x4000(%rbp),%rsi
call   1050 <match_keywords@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x8000(%rbp),%rdi
lea    0xe1e(%rip),%rsi
lea    0xe50(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x8000(%rbp),%rdi
lea    -0x4000(%rbp),%rsi
call   1050 <match_keywords@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x8000(%rbp),%rdi
lea    0xde1(%rip),%rsi
lea    0xddd(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x8000(%rbp),%rdi
lea    -0x4000(%rbp),%rsi
call   1050 <match_keywords@plt>
cmp    $0x6,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
add    $0x8000,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_match_keywords>:
push   %r14
push   %rbx
sub    $0x8008,%rsp
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
movups 0xeba(%rip),%xmm0
movaps %xmm0,0x4000(%rsp)
movups 0xeb7(%rip),%xmm0
movups %xmm0,0x400c(%rsp)
movabs $0x74616d202c746163,%rax
6d 61 74
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
mov    %rsp,%rbx
lea    0x4000(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <match_keywords@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
movups 0xe8a(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <match_keywords@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
movabs $0x65706f6c65746e,%rax
mov    %rax,0xe(%rsp)
movups 0xe64(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <match_keywords@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
movups 0xe0a(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xe0b(%rip),%xmm0
movups %xmm0,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <match_keywords@plt>
xor    %edi,%edi
cmp    $0x6,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
add    $0x8008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"test_match_keywords...\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"the, cat, sat, on, the, mat\00"
@.str.3 = [9 x i8] c"cat, mat\00"
@.str.4 = [17 x i8] c"badger, antelope\00"
@.str.5 = [22 x i8] c"badger, the, antelope\00"
@.str.6 = [4 x i8] c"Ok\0A\00"
define void @test_match_keywords() {
%1 = alloca [16384 x i8]
%2 = alloca [16384 x i8]
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [16384 x i8], [16384 x i8]* %1, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%6 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%8 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [16384 x i8], [16384 x i8]* %1, i64 0, i64 0
%10 = call i32 @match_keywords(i8* %8, i8* %9)
%11 = icmp eq i32 %10, 2
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%15 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%16 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [16384 x i8], [16384 x i8]* %1, i64 0, i64 0
%18 = call i32 @match_keywords(i8* %16, i8* %17)
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%23 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%24 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%25 = getelementptr inbounds [16384 x i8], [16384 x i8]* %1, i64 0, i64 0
%26 = call i32 @match_keywords(i8* %24, i8* %25)
%27 = icmp eq i32 %26, 1
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%31 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%32 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%33 = getelementptr inbounds [16384 x i8], [16384 x i8]* %1, i64 0, i64 0
%34 = call i32 @match_keywords(i8* %32, i8* %33)
%35 = icmp eq i32 %34, 6
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"test_match_keywords...\00"
@.str.2 = [28 x i8] c"the, cat, sat, on, the, mat\00"
@.str.3 = [9 x i8] c"cat, mat\00"
@.str.4 = [17 x i8] c"badger, antelope\00"
@.str.5 = [22 x i8] c"badger, the, antelope\00"
@str = [3 x i8] c"Ok\00"
define void @test_match_keywords() {
%1 = alloca [16384 x i8]
%2 = alloca [16384 x i8]
%3 = getelementptr inbounds [16384 x i8], [16384 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @match_keywords(i8* %4, i8* %3)
%7 = icmp eq i32 %6, 2
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @match_keywords(i8* %4, i8* %3)
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @match_keywords(i8* %4, i8* %3)
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @match_keywords(i8* %4, i8* %3)
%19 = icmp eq i32 %18, 6
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}