#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*/ strncasecmp(char *, char *, int);
int par_op_where(char *cmd, int len) {
  if (!strncasecmp("OR", cmd, len)) {
    return 1;
  } else if (!strncasecmp("AND", cmd, len)) {
    return 2;
  } else if (!strncasecmp("WHERE", cmd, len)) {
    return 3;
  } else if (!strncasecmp("LIKE", cmd, len)) {
    return 4;
  }
  return 0;
}


x86 assembly (clang, -O0):
<par_op_where>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1147 <par_op_where+0x37>
movl   $0x1,-0x4(%rbp)
jmp    11d5 <par_op_where+0xc5>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xeae(%rip),%rdi
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    116f <par_op_where+0x5f>
movl   $0x2,-0x4(%rbp)
jmp    11d5 <par_op_where+0xc5>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe8a(%rip),%rdi
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1197 <par_op_where+0x87>
movl   $0x3,-0x4(%rbp)
jmp    11d5 <par_op_where+0xc5>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe68(%rip),%rdi
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    11bf <par_op_where+0xaf>
movl   $0x4,-0x4(%rbp)
jmp    11d5 <par_op_where+0xc5>
jmp    11c4 <par_op_where+0xb4>
jmp    11c9 <par_op_where+0xb9>
jmp    11ce <par_op_where+0xbe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_op_where>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xee1(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     1176 <par_op_where+0x66>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     117d <par_op_where+0x6d>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     1184 <par_op_where+0x74>
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
shl    $0x2,%eax
jmp    1189 <par_op_where+0x79>
mov    $0x1,%eax
jmp    1189 <par_op_where+0x79>
mov    $0x2,%eax
jmp    1189 <par_op_where+0x79>
mov    $0x3,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"OR\00"
@.str.1 = [4 x i8] c"AND\00"
@.str.2 = [6 x i8] c"WHERE\00"
@.str.3 = [5 x i8] c"LIKE\00"
define i32 @par_op_where(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = load i32, i32* %5
%8 = call i32 @strncasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %2
store i32 1, i32* %3
br label %33
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12, i32 %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %11
store i32 2, i32* %3
br label %33
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = call i32 @strncasecmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %18, i32 %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %17
store i32 3, i32* %3
br label %33
23: ; preds = %17
%24 = load i8*, i8** %4
%25 = load i32, i32* %5
%26 = call i32 @strncasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %24, i32 %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %23
store i32 4, i32* %3
br label %33
29: ; preds = %23
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
store i32 0, i32* %3
br label %33
33: ; preds = %32, %28, %22, %16, %10
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [3 x i8] c"OR\00"
@.str.1 = [4 x i8] c"AND\00"
@.str.2 = [6 x i8] c"WHERE\00"
@.str.3 = [5 x i8] c"LIKE\00"
define i32 @par_op_where(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %5
%9 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %0, i32 %1)
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i32 4, i32 0
br label %15
15: ; preds = %11, %8, %5, %2
%16 = phi i32 [ 1, %2 ], [ 2, %5 ], [ 3, %8 ], [ %14, %11 ]
ret i32 %16
}