#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*/ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int /*<<< orphan*/);
int isrule(char *word) {
  if (!strcmp(word, "<and>") || !strncmp(word, "<near>", strlen("<near>")) ||
      !strcmp(word, "<or>") || !strcmp(word, "<not>"))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isrule>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     11b6 <isrule+0x86>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xea2(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xe90(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     11b6 <isrule+0x86>
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     11b6 <isrule+0x86>
mov    -0x10(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11c2 <isrule+0x92>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <isrule+0x99>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrule>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xec2(%rip),%rsi
call   1050 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1196 <isrule+0x66>
lea    0xeb3(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1196 <isrule+0x66>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1196 <isrule+0x66>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"<and>\00"
@.str.1 = [7 x i8] c"<near>\00"
@.str.2 = [5 x i8] c"<or>\00"
@.str.3 = [6 x i8] c"<not>\00"
define i32 @isrule(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @strncmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16, %12, %7, %1
store i32 1, i32* %2
br label %22
21: ; preds = %16
store i32 0, i32* %2
br label %22
22: ; preds = %21, %20
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [6 x i8] c"<and>\00"
@.str.1 = [7 x i8] c"<near>\00"
@.str.2 = [5 x i8] c"<or>\00"
@.str.3 = [6 x i8] c"<not>\00"
define i32 @isrule(i8* %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %4
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %11, %1, %4, %8
%16 = phi i32 [ 1, %8 ], [ 1, %4 ], [ 1, %1 ], [ %14, %11 ]
ret i32 %16
}