#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char const *, char *);
int is_valid_http_method(const char *method) {
  fprintf(stderr, "Received HTTP method %s\n", method);
  return !strcmp(method, "GET") || !strcmp(method, "POST") ||
         !strcmp(method, "DELETE") || !strcmp(method, "OPTIONS");
}


x86 assembly (clang, -O0):
<is_valid_http_method>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     11c0 <is_valid_http_method+0xa0>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     11c0 <is_valid_http_method+0xa0>
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     11c0 <is_valid_http_method+0xa0>
mov    -0x8(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_http_method>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1193 <is_valid_http_method+0x73>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1193 <is_valid_http_method+0x73>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1193 <is_valid_http_method+0x73>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Received HTTP method %s\0A\00"
@.str.1 = [4 x i8] c"GET\00"
@.str.2 = [5 x i8] c"POST\00"
@.str.3 = [7 x i8] c"DELETE\00"
@.str.4 = [8 x i8] c"OPTIONS\00"
define i32 @is_valid_http_method(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i8*, i8** %2
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
br label %22
22: ; preds = %17, %13, %9, %1
%23 = phi i1 [ true, %13 ], [ true, %9 ], [ true, %1 ], [ %21, %17 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Received HTTP method %s\0A\00"
@.str.1 = [4 x i8] c"GET\00"
@.str.2 = [5 x i8] c"POST\00"
@.str.3 = [7 x i8] c"DELETE\00"
@.str.4 = [8 x i8] c"OPTIONS\00"
define i32 @is_valid_http_method(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %6, %1
%17 = phi i32 [ 1, %9 ], [ 1, %6 ], [ 1, %1 ], [ %15, %12 ]
ret i32 %17
}