#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 */
scalar_t__ strcmp(char *, char *);
bool isValidOperator(char *op, char *attr) {
  int i;
  if (op == NULL)
    return false;
  if (strcmp("ID", attr) == 0) {
    char *operators[1] = {"EQ"};
    for (i = 0; i < 1; i++) {
      if ((strcmp(operators[i], op) == 0))
        return true;
    }
  } else if (strcmp("NAME", attr) == 0) {
    char *operators[2] = {"EQ", "~"};
    for (i = 0; i < 2; i++) {
      if ((strcmp(operators[i], op) == 0))
        return true;
    }
  } else if (strcmp("DATE", attr) == 0) {
    char *operators[5] = {"EQ", "LT", "LE", "GT", "GE"};
    for (i = 0; i < 5; i++) {
      if ((strcmp(operators[i], op) == 0))
        return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<isValidOperator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1147 <isValidOperator+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1301 <isValidOperator+0x1e1>
mov    -0x18(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11bd <isValidOperator+0x9d>
mov    0x2c98(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    11b8 <isValidOperator+0x98>
movslq -0x1c(%rbp),%rax
mov    -0x28(%rbp,%rax,8),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a5 <isValidOperator+0x85>
movl   $0x1,-0x4(%rbp)
jmp    1301 <isValidOperator+0x1e1>
jmp    11aa <isValidOperator+0x8a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1173 <isValidOperator+0x53>
jmp    12fa <isValidOperator+0x1da>
mov    -0x18(%rbp),%rsi
lea    0xe3e(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    123e <isValidOperator+0x11e>
mov    0x2c32(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c2f(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1239 <isValidOperator+0x119>
movslq -0x1c(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1226 <isValidOperator+0x106>
movl   $0x1,-0x4(%rbp)
jmp    1301 <isValidOperator+0x1e1>
jmp    122b <isValidOperator+0x10b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f4 <isValidOperator+0xd4>
jmp    12f5 <isValidOperator+0x1d5>
mov    -0x18(%rbp),%rsi
lea    0xdc4(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12f0 <isValidOperator+0x1d0>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
lea    0xd94(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xd98(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xd90(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xd88(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xd80(%rip),%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    12eb <isValidOperator+0x1cb>
movslq -0x1c(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12d8 <isValidOperator+0x1b8>
movl   $0x1,-0x4(%rbp)
jmp    1301 <isValidOperator+0x1e1>
jmp    12dd <isValidOperator+0x1bd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12a6 <isValidOperator+0x186>
jmp    12f0 <isValidOperator+0x1d0>
jmp    12f5 <isValidOperator+0x1d5>
jmp    12fa <isValidOperator+0x1da>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isValidOperator>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1158 <isValidOperator+0x48>
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeda(%rip),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     115f <isValidOperator+0x4f>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1168 <isValidOperator+0x58>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1193 <isValidOperator+0x83>
xor    %eax,%eax
jmp    11fd <isValidOperator+0xed>
lea    0xe9d(%rip),%rdi
jmp    1183 <isValidOperator+0x73>
lea    0xe94(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11fb <isValidOperator+0xeb>
lea    0xe88(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
sete   %al
jmp    11fd <isValidOperator+0xed>
lea    0xe69(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11fb <isValidOperator+0xeb>
lea    0xe64(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11fb <isValidOperator+0xeb>
lea    0xe53(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11fb <isValidOperator+0xeb>
lea    0xe42(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11fb <isValidOperator+0xeb>
lea    0xe31(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1158 <isValidOperator+0x48>
mov    $0x1,%al
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ID\00"
@.str.1 = [3 x i8] c"EQ\00"
@__const.isValidOperator.operators = [1 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [5 x i8] c"NAME\00"
@.str.3 = [2 x i8] c"~\00"
@__const.isValidOperator.operators.4 = [2 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0)]
@.str.5 = [5 x i8] c"DATE\00"
@.str.6 = [3 x i8] c"LT\00"
@.str.7 = [3 x i8] c"LE\00"
@.str.8 = [3 x i8] c"GT\00"
@.str.9 = [3 x i8] c"GE\00"
define i32 @isValidOperator(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [1 x i8*]
%8 = alloca [2 x i8*]
%9 = alloca [5 x i8*]
store i8* %0, i8** %4
store i8* %1, i8** %5
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %91
13: ; preds = %2
%14 = load i8*, i8** %5
%15 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %36
17: ; preds = %13
%18 = bitcast [1 x i8*]* %7 to i8*
store i32 0, i32* %6
br label %19
19: ; preds = %32, %17
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 1
br i1 %21, label %22, label %35
22: ; preds = %19
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1 x i8*], [1 x i8*]* %7, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = load i8*, i8** %4
%28 = call i64 @strcmp(i8* %26, i8* %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %22
store i32 1, i32* %3
br label %91
31: ; preds = %22
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %19
35: ; preds = %19
br label %90
36: ; preds = %13
%37 = load i8*, i8** %5
%38 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %59
40: ; preds = %36
%41 = bitcast [2 x i8*]* %8 to i8*
store i32 0, i32* %6
br label %42
42: ; preds = %55, %40
%43 = load i32, i32* %6
%44 = icmp slt i32 %43, 2
br i1 %44, label %45, label %58
45: ; preds = %42
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [2 x i8*], [2 x i8*]* %8, i64 0, i64 %47
%49 = load i8*, i8** %48
%50 = load i8*, i8** %4
%51 = call i64 @strcmp(i8* %49, i8* %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %45
store i32 1, i32* %3
br label %91
54: ; preds = %45
br label %55
55: ; preds = %54
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %42
58: ; preds = %42
br label %89
59: ; preds = %36
%60 = load i8*, i8** %5
%61 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %88
63: ; preds = %59
%64 = bitcast [5 x i8*]* %9 to i8*
%65 = bitcast i8* %64 to [5 x i8*]*
%66 = getelementptr inbounds [5 x i8*], [5 x i8*]* %65, i32 0, i32 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8** %66
%67 = getelementptr inbounds [5 x i8*], [5 x i8*]* %65, i32 0, i32 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8** %67
%68 = getelementptr inbounds [5 x i8*], [5 x i8*]* %65, i32 0, i32 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8** %68
%69 = getelementptr inbounds [5 x i8*], [5 x i8*]* %65, i32 0, i32 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8** %69
%70 = getelementptr inbounds [5 x i8*], [5 x i8*]* %65, i32 0, i32 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8** %70
store i32 0, i32* %6
br label %71
71: ; preds = %84, %63
%72 = load i32, i32* %6
%73 = icmp slt i32 %72, 5
br i1 %73, label %74, label %87
74: ; preds = %71
%75 = load i32, i32* %6
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 %76
%78 = load i8*, i8** %77
%79 = load i8*, i8** %4
%80 = call i64 @strcmp(i8* %78, i8* %79)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %83
82: ; preds = %74
store i32 1, i32* %3
br label %91
83: ; preds = %74
br label %84
84: ; preds = %83
%85 = load i32, i32* %6
%86 = add nsw i32 %85, 1
store i32 %86, i32* %6
br label %71
87: ; preds = %71
br label %88
88: ; preds = %87, %59
br label %89
89: ; preds = %88, %58
br label %90
90: ; preds = %89, %35
store i32 0, i32* %3
br label %91
91: ; preds = %90, %82, %53, %30, %12
%92 = load i32, i32* %3
ret i32 %92
}

LLVM IR (-O2):
@.str = [3 x i8] c"ID\00"
@.str.1 = [3 x i8] c"EQ\00"
@.str.2 = [5 x i8] c"NAME\00"
@.str.3 = [2 x i8] c"~\00"
@.str.5 = [5 x i8] c"DATE\00"
@.str.6 = [3 x i8] c"LT\00"
@.str.7 = [3 x i8] c"LE\00"
@.str.8 = [3 x i8] c"GT\00"
@.str.9 = [3 x i8] c"GE\00"
define i32 @isValidOperator(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %38, label %4
4: ; preds = %2
%5 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%9 = icmp eq i64 %8, 0
br label %38
10: ; preds = %4
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%15 = icmp eq i64 %14, 0
br i1 %15, label %38, label %16
16: ; preds = %13
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%18 = icmp eq i64 %17, 0
br label %38
19: ; preds = %10
%20 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %38
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%24 = icmp eq i64 %23, 0
br i1 %24, label %37, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%27 = icmp eq i64 %26, 0
br i1 %27, label %37, label %28
28: ; preds = %25
%29 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %0)
%30 = icmp eq i64 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %28
%32 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %0)
%33 = icmp eq i64 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %0)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %34, %31, %28, %25, %22
br label %38
38: ; preds = %16, %13, %34, %7, %19, %37, %2
%39 = phi i1 [ true, %37 ], [ false, %2 ], [ false, %19 ], [ %9, %7 ], [ false, %34 ], [ true, %13 ], [ %18, %16 ]
%40 = zext i1 %39 to i32
ret i32 %40
}