#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 getRequestTypeFromString(char *str, size_t len) {
  if (str == NULL || len == 0)
    return -1;
  if (len == 3) {
    if (!strncasecmp(str, "set", 3) || !strncasecmp(str, "add", 3)) {
      return 1;
    } else if (!strncasecmp(str, "cas", 3)) {
      return 2;
    } else if (!strncasecmp(str, "get", 3)) {
      return 3;
    } else {
      return -1;
    }
  } else if (len == 4) {
    if (!strncasecmp(str, "gets", 4)) {
      return 3;
    } else if (!strncasecmp(str, "incr", 4) || !strncasecmp(str, "decr", 4)) {
      return 4;
    } else {
      return -1;
    }
  } else if (len == 6) {
    if (!strncasecmp(str, "append", 6)) {
      return 1;
    } else if (!strncasecmp(str, "delete", 6)) {
      return 5;
    } else {
      return -1;
    }
  } else if (len == 7) {
    if (!strncasecmp(str, "replace", 7) || !strncasecmp(str, "prepend", 7)) {
      return 1;
    } else {
      return -1;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<getRequestTypeFromString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <getRequestTypeFromString+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <getRequestTypeFromString+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
cmpq   $0x3,-0x18(%rbp)
jne    11f5 <getRequestTypeFromString+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
je     1189 <getRequestTypeFromString+0x79>
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1195 <getRequestTypeFromString+0x85>
movl   $0x1,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
mov    -0x10(%rbp),%rdi
lea    0xe68(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    11bf <getRequestTypeFromString+0xaf>
movl   $0x2,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
mov    -0x10(%rbp),%rdi
lea    0xe42(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    11e9 <getRequestTypeFromString+0xd9>
movl   $0x3,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
movl   $0xffffffff,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
cmpq   $0x4,-0x18(%rbp)
jne    127e <getRequestTypeFromString+0x16e>
mov    -0x10(%rbp),%rdi
lea    0xe05(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    122a <getRequestTypeFromString+0x11a>
movl   $0x3,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
mov    -0x10(%rbp),%rdi
lea    0xde0(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
je     1266 <getRequestTypeFromString+0x156>
mov    -0x10(%rbp),%rdi
lea    0xdc7(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1272 <getRequestTypeFromString+0x162>
movl   $0x4,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
movl   $0xffffffff,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
cmpq   $0x6,-0x18(%rbp)
jne    12e9 <getRequestTypeFromString+0x1d9>
mov    -0x10(%rbp),%rdi
lea    0xd8b(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    12b3 <getRequestTypeFromString+0x1a3>
movl   $0x1,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
mov    -0x10(%rbp),%rdi
lea    0xd68(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    12dd <getRequestTypeFromString+0x1cd>
movl   $0x5,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
movl   $0xffffffff,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
cmpq   $0x7,-0x18(%rbp)
jne    1348 <getRequestTypeFromString+0x238>
mov    -0x10(%rbp),%rdi
lea    0xd2e(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
je     1330 <getRequestTypeFromString+0x220>
mov    -0x10(%rbp),%rdi
lea    0xd18(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    133c <getRequestTypeFromString+0x22c>
movl   $0x1,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
movl   $0xffffffff,-0x4(%rbp)
jmp    135e <getRequestTypeFromString+0x24e>
jmp    134d <getRequestTypeFromString+0x23d>
jmp    1352 <getRequestTypeFromString+0x242>
jmp    1357 <getRequestTypeFromString+0x247>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRequestTypeFromString>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%ebp
test   %rdi,%rdi
je     129b <getRequestTypeFromString+0x18b>
test   %rsi,%rsi
je     129b <getRequestTypeFromString+0x18b>
add    $0xfffffffffffffffd,%rsi
cmp    $0x4,%rsi
ja     129b <getRequestTypeFromString+0x18b>
mov    %rdi,%rbx
lea    0xebe(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     129b <getRequestTypeFromString+0x18b>
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     129b <getRequestTypeFromString+0x18b>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     1296 <getRequestTypeFromString+0x186>
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x3,%ebp
jmp    129b <getRequestTypeFromString+0x18b>
lea    0xe59(%rip),%rsi
mov    $0x4,%ebp
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     128f <getRequestTypeFromString+0x17f>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     129b <getRequestTypeFromString+0x18b>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncasecmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x4,%ebp
jmp    129b <getRequestTypeFromString+0x18b>
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     1288 <getRequestTypeFromString+0x178>
lea    0xdfd(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncasecmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x5,%ebp
jmp    129b <getRequestTypeFromString+0x18b>
lea    0xde7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     1288 <getRequestTypeFromString+0x178>
lea    0xdd7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncasecmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x1,%ebp
jmp    129b <getRequestTypeFromString+0x18b>
mov    $0x1,%ebp
jmp    129b <getRequestTypeFromString+0x18b>
mov    $0x3,%ebp
jmp    129b <getRequestTypeFromString+0x18b>
mov    $0x2,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"set\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"cas\00"
@.str.3 = [4 x i8] c"get\00"
@.str.4 = [5 x i8] c"gets\00"
@.str.5 = [5 x i8] c"incr\00"
@.str.6 = [5 x i8] c"decr\00"
@.str.7 = [7 x i8] c"append\00"
@.str.8 = [7 x i8] c"delete\00"
@.str.9 = [8 x i8] c"replace\00"
@.str.10 = [8 x i8] c"prepend\00"
define i32 @getRequestTypeFromString(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i64, i64* %5
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 -1, i32* %3
br label %84
12: ; preds = %8
%13 = load i64, i64* %5
%14 = icmp eq i64 %13, 3
br i1 %14, label %15, label %35
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = call i32 @strncasecmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = call i32 @strncasecmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %19, %15
store i32 1, i32* %3
br label %84
24: ; preds = %19
%25 = load i8*, i8** %4
%26 = call i32 @strncasecmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %24
store i32 2, i32* %3
br label %84
29: ; preds = %24
%30 = load i8*, i8** %4
%31 = call i32 @strncasecmp(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
%32 = icmp ne i32 %31, 0
br i1 %32, label %34, label %33
33: ; preds = %29
store i32 3, i32* %3
br label %84
34: ; preds = %29
store i32 -1, i32* %3
br label %84
35: ; preds = %12
%36 = load i64, i64* %5
%37 = icmp eq i64 %36, 4
br i1 %37, label %38, label %53
38: ; preds = %35
%39 = load i8*, i8** %4
%40 = call i32 @strncasecmp(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%41 = icmp ne i32 %40, 0
br i1 %41, label %43, label %42
42: ; preds = %38
store i32 3, i32* %3
br label %84
43: ; preds = %38
%44 = load i8*, i8** %4
%45 = call i32 @strncasecmp(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %51
47: ; preds = %43
%48 = load i8*, i8** %4
%49 = call i32 @strncasecmp(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %47, %43
store i32 4, i32* %3
br label %84
52: ; preds = %47
store i32 -1, i32* %3
br label %84
53: ; preds = %35
%54 = load i64, i64* %5
%55 = icmp eq i64 %54, 6
br i1 %55, label %56, label %67
56: ; preds = %53
%57 = load i8*, i8** %4
%58 = call i32 @strncasecmp(i8* %57, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 6)
%59 = icmp ne i32 %58, 0
br i1 %59, label %61, label %60
60: ; preds = %56
store i32 1, i32* %3
br label %84
61: ; preds = %56
%62 = load i8*, i8** %4
%63 = call i32 @strncasecmp(i8* %62, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 6)
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %61
store i32 5, i32* %3
br label %84
66: ; preds = %61
store i32 -1, i32* %3
br label %84
67: ; preds = %53
%68 = load i64, i64* %5
%69 = icmp eq i64 %68, 7
br i1 %69, label %70, label %80
70: ; preds = %67
%71 = load i8*, i8** %4
%72 = call i32 @strncasecmp(i8* %71, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 7)
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %78
74: ; preds = %70
%75 = load i8*, i8** %4
%76 = call i32 @strncasecmp(i8* %75, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32 7)
%77 = icmp ne i32 %76, 0
br i1 %77, label %79, label %78
78: ; preds = %74, %70
store i32 1, i32* %3
br label %84
79: ; preds = %74
store i32 -1, i32* %3
br label %84
80: ; preds = %67
br label %81
81: ; preds = %80
br label %82
82: ; preds = %81
br label %83
83: ; preds = %82
store i32 -1, i32* %3
br label %84
84: ; preds = %83, %79, %78, %66, %65, %60, %52, %51, %42, %34, %33, %28, %23, %11
%85 = load i32, i32* %3
ret i32 %85
}

LLVM IR (-O2):
@.str = [4 x i8] c"set\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"cas\00"
@.str.3 = [4 x i8] c"get\00"
@.str.4 = [5 x i8] c"gets\00"
@.str.5 = [5 x i8] c"incr\00"
@.str.6 = [5 x i8] c"decr\00"
@.str.7 = [7 x i8] c"append\00"
@.str.8 = [7 x i8] c"delete\00"
@.str.9 = [8 x i8] c"replace\00"
@.str.10 = [8 x i8] c"prepend\00"
define i32 @getRequestTypeFromString(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %44, label %6
6: ; preds = %2
switch i64 %1, label %44 [
i64 3, label %7
i64 4, label %20
i64 6, label %30
i64 7, label %37
]
7: ; preds = %6
%8 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %44, label %10
10: ; preds = %7
%11 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %44, label %13
13: ; preds = %10
%14 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%15 = icmp eq i32 %14, 0
br i1 %15, label %44, label %16
16: ; preds = %13
%17 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i32 3, i32 -1
br label %44
20: ; preds = %6
%21 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%22 = icmp eq i32 %21, 0
br i1 %22, label %44, label %23
23: ; preds = %20
%24 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%25 = icmp eq i32 %24, 0
br i1 %25, label %44, label %26
26: ; preds = %23
%27 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i32 4, i32 -1
br label %44
30: ; preds = %6
%31 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 6)
%32 = icmp eq i32 %31, 0
br i1 %32, label %44, label %33
33: ; preds = %30
%34 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 6)
%35 = icmp eq i32 %34, 0
%36 = select i1 %35, i32 5, i32 -1
br label %44
37: ; preds = %6
%38 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 7)
%39 = icmp eq i32 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %37
%41 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32 7)
%42 = icmp eq i32 %41, 0
%43 = select i1 %42, i32 1, i32 -1
br label %44
44: ; preds = %40, %26, %6, %37, %33, %30, %23, %20, %16, %13, %7, %10, %2
%45 = phi i32 [ -1, %2 ], [ 1, %10 ], [ 1, %7 ], [ 2, %13 ], [ %19, %16 ], [ 3, %20 ], [ 4, %23 ], [ 1, %30 ], [ %36, %33 ], [ 1, %37 ], [ -1, %6 ], [ %29, %26 ], [ %43, %40 ]
ret i32 %45
}