#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 sscanf(char *, char *, char *, int *, int *);
scalar_t__ strcmp(char *, char *);
int matchData(unsigned char *data, size_t length) {
  char buf[65];
  int major, minor;
  if (sscanf((char *)data, "%64s / HTTP/%d.%d\r\n", buf, &major, &minor) == 3 ||
      sscanf((char *)data, "%64s /%*s HTTP/%d.%d\r\n", buf, &major, &minor) ==
          3) {
    if (major >= 1 && minor >= 0) {
      if (strcmp(buf, "GET") == 0 || strcmp(buf, "POST") == 0 ||
          strcmp(buf, "PUT") == 0 || strcmp(buf, "DELETE") == 0 ||
          strcmp(buf, "PATCH") == 0 || strcmp(buf, "HEAD") == 0 ||
          strcmp(buf, "CONNECT") == 0 || strcmp(buf, "TRACE") == 0 ||
          strcmp(buf, "OPTIONS") == 0)
        return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<matchData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xec1(%rip),%rsi
lea    -0x64(%rbp),%rcx
lea    -0x68(%rbp),%r8
call   1040 <sscanf@plt>
cmp    $0x3,%eax
je     117a <matchData+0x5a>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xeb0(%rip),%rsi
lea    -0x64(%rbp),%rcx
lea    -0x68(%rbp),%r8
call   1040 <sscanf@plt>
cmp    $0x3,%eax
jne    128e <matchData+0x16e>
cmpl   $0x1,-0x64(%rbp)
jl     1289 <matchData+0x169>
cmpl   $0x0,-0x68(%rbp)
jl     1289 <matchData+0x169>
lea    -0x60(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xe03(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1278 <matchData+0x158>
lea    -0x60(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1284 <matchData+0x164>
movl   $0x1,-0x4(%rbp)
jmp    1295 <matchData+0x175>
jmp    1289 <matchData+0x169>
jmp    128e <matchData+0x16e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchData>:
push   %rbx
sub    $0x60,%rsp
mov    %rdi,%rbx
lea    0xed1(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <sscanf@plt>
cmp    $0x3,%eax
je     116f <matchData+0x4f>
lea    0xec5(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rbx,%rdi
call   1040 <sscanf@plt>
cmp    $0x3,%eax
jne    125c <matchData+0x13c>
cmpl   $0x0,0xc(%rsp)
jle    125c <matchData+0x13c>
cmpl   $0x0,0x8(%rsp)
js     125c <matchData+0x13c>
lea    0xe9f(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe84(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe6f(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe59(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe4a(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe3a(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe29(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe1b(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
lea    0xe0b(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125e <matchData+0x13e>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%64s / HTTP/%d.%d\0D\0A\00"
@.str.1 = [23 x i8] c"%64s /%*s HTTP/%d.%d\0D\0A\00"
@.str.2 = [4 x i8] c"GET\00"
@.str.3 = [5 x i8] c"POST\00"
@.str.4 = [4 x i8] c"PUT\00"
@.str.5 = [7 x i8] c"DELETE\00"
@.str.6 = [6 x i8] c"PATCH\00"
@.str.7 = [5 x i8] c"HEAD\00"
@.str.8 = [8 x i8] c"CONNECT\00"
@.str.9 = [6 x i8] c"TRACE\00"
@.str.10 = [8 x i8] c"OPTIONS\00"
define i32 @matchData(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca [65 x i8]
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
%9 = load i8*, i8** %4
%10 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%11 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %10, i32* %7, i32* %8)
%12 = icmp eq i32 %11, 3
br i1 %12, label %18, label %13
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%16 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32* %7, i32* %8)
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %63
18: ; preds = %13, %2
%19 = load i32, i32* %7
%20 = icmp sge i32 %19, 1
br i1 %20, label %21, label %62
21: ; preds = %18
%22 = load i32, i32* %8
%23 = icmp sge i32 %22, 0
br i1 %23, label %24, label %62
24: ; preds = %21
%25 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %60, label %28
28: ; preds = %24
%29 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %60, label %32
32: ; preds = %28
%33 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %60, label %36
36: ; preds = %32
%37 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %60, label %40
40: ; preds = %36
%41 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %60, label %44
44: ; preds = %40
%45 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %60, label %48
48: ; preds = %44
%49 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %60, label %52
52: ; preds = %48
%53 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %60, label %56
56: ; preds = %52
%57 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %56, %52, %48, %44, %40, %36, %32, %28, %24
store i32 1, i32* %3
br label %64
61: ; preds = %56
br label %62
62: ; preds = %61, %21, %18
br label %63
63: ; preds = %62, %13
store i32 0, i32* %3
br label %64
64: ; preds = %63, %60
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@.str = [20 x i8] c"%64s / HTTP/%d.%d\0D\0A\00"
@.str.1 = [23 x i8] c"%64s /%*s HTTP/%d.%d\0D\0A\00"
@.str.2 = [4 x i8] c"GET\00"
@.str.3 = [5 x i8] c"POST\00"
@.str.4 = [4 x i8] c"PUT\00"
@.str.5 = [7 x i8] c"DELETE\00"
@.str.6 = [6 x i8] c"PATCH\00"
@.str.7 = [5 x i8] c"HEAD\00"
@.str.8 = [8 x i8] c"CONNECT\00"
@.str.9 = [6 x i8] c"TRACE\00"
@.str.10 = [8 x i8] c"OPTIONS\00"
define i32 @matchData(i8* nocapture %0, i64 %1) {
%3 = alloca [65 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6, i32* %4, i32* %5)
%10 = icmp eq i32 %9, 3
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32* %4, i32* %5)
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %47
14: ; preds = %11, %2
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, -1
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %20, label %47
20: ; preds = %14
%21 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %48, label %23
23: ; preds = %20
%24 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %48, label %26
26: ; preds = %23
%27 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %48, label %29
29: ; preds = %26
%30 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %48, label %32
32: ; preds = %29
%33 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %48, label %35
35: ; preds = %32
%36 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %48, label %38
38: ; preds = %35
%39 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %48, label %41
41: ; preds = %38
%42 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %41
%45 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %14, %44, %11
br label %48
48: ; preds = %20, %23, %26, %29, %32, %35, %38, %41, %44, %47
%49 = phi i32 [ 0, %47 ], [ 1, %44 ], [ 1, %41 ], [ 1, %38 ], [ 1, %35 ], [ 1, %32 ], [ 1, %29 ], [ 1, %26 ], [ 1, %23 ], [ 1, %20 ]
ret i32 %49
}