#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 const *);
int valid_verb(char *verb) {
  static const char *valid[] = {"GET", "POST",   "CONNECT", "HEAD",
                                "PUT", "DELETE", "OPTIONS"};
  static const int sizes[] = {3, 4, 7, 4, 3, 6, 7, 0};
  int i;
  for (i = 0; sizes[i]; i++) {
    if (!strcmp(verb, valid[i]))
      break;
  }
  return sizes[i];
}


x86 assembly (clang, -O0):
<valid_verb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
lea    0xf02(%rip),%rax
cmpl   $0x0,(%rax,%rcx,4)
je     1171 <valid_verb+0x61>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rcx
lea    0x2ee9(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115e <valid_verb+0x4e>
jmp    1171 <valid_verb+0x61>
jmp    1163 <valid_verb+0x53>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <valid_verb+0x13>
movslq -0xc(%rbp),%rcx
lea    0xeb4(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_verb>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a0 <valid_verb+0x90>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a4 <valid_verb+0x94>
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ab <valid_verb+0x9b>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11b2 <valid_verb+0xa2>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11b9 <valid_verb+0xa9>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11c0 <valid_verb+0xb0>
lea    0xe97(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
cmp    $0x1,%eax
mov    $0x7,%eax
sbb    $0x0,%rax
jmp    11c5 <valid_verb+0xb5>
xor    %eax,%eax
jmp    11c5 <valid_verb+0xb5>
mov    $0x1,%eax
jmp    11c5 <valid_verb+0xb5>
mov    $0x2,%eax
jmp    11c5 <valid_verb+0xb5>
mov    $0x3,%eax
jmp    11c5 <valid_verb+0xb5>
mov    $0x4,%eax
jmp    11c5 <valid_verb+0xb5>
mov    $0x5,%eax
lea    0xe64(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rbx
ret

LLVM IR (-O0):
@valid_verb.valid = internal global [7 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0)]
@.str = [4 x i8] c"GET\00"
@.str.1 = [5 x i8] c"POST\00"
@.str.2 = [8 x i8] c"CONNECT\00"
@.str.3 = [5 x i8] c"HEAD\00"
@.str.4 = [4 x i8] c"PUT\00"
@.str.5 = [7 x i8] c"DELETE\00"
@.str.6 = [8 x i8] c"OPTIONS\00"
@valid_verb.sizes = internal constant [8 x i32] [i32 3, i32 4, i32 7, i32 4, i32 3, i32 6, i32 7, i32 0]
define i32 @valid_verb(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %20, %1
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [8 x i32], [8 x i32]* @valid_verb.sizes, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %4
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [7 x i8*], [7 x i8*]* @valid_verb.valid, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 @strcmp(i8* %11, i8* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %10
br label %23
19: ; preds = %10
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %4
23: ; preds = %18, %4
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [8 x i32], [8 x i32]* @valid_verb.sizes, i64 0, i64 %25
%27 = load i32, i32* %26
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"GET\00"
@.str.1 = [5 x i8] c"POST\00"
@.str.2 = [8 x i8] c"CONNECT\00"
@.str.3 = [5 x i8] c"HEAD\00"
@.str.4 = [4 x i8] c"PUT\00"
@.str.5 = [7 x i8] c"DELETE\00"
@.str.6 = [8 x i8] c"OPTIONS\00"
@valid_verb.sizes = internal unnamed_addr constant [8 x i32] [i32 3, i32 4, i32 7, i32 4, i32 3, i32 6, i32 7, i32 0]
define i32 @valid_verb(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i64 6, i64 7
br label %23
23: ; preds = %19, %16, %13, %10, %7, %4, %1
%24 = phi i64 [ 0, %1 ], [ 1, %4 ], [ 2, %7 ], [ 3, %10 ], [ 4, %13 ], [ 5, %16 ], [ %22, %19 ]
%25 = getelementptr inbounds [8 x i32], [8 x i32]* @valid_verb.sizes, i64 0, i64 %24
%26 = load i32, i32* %25
ret i32 %26
}