#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*/ printByteDebug(unsigned char);
int /*<<< orphan*/ printf(char *);
short decodeMethod(unsigned char info) {
  unsigned char x;
  if ((info >> 4) == 1) {
    printf("Processing GET request\n");
    return 1;
  } else if ((info >> 4) == 2) {
    printf("Processing HEAD request\n");
    return 2;
  } else if ((info >> 4) == 3) {
    printf("Processing POST request\n");
    return 3;
  } else if ((info >> 4) == 4) {
    printf("Processing PUT request\n");
    return 4;
  } else if ((info >> 4) == 5) {
    printf("Processing DELETE request\n");
    return 5;
  } else if ((info >> 4) == 6) {
    printf("Processing CONNECT request\n");
    return 6;
  } else if ((info >> 4) == 7) {
    printf("Processing OPTIONS request\n");
    return 7;
  } else if ((info >> 4) == 8) {
    printf("Processing TRACE request\n");
    return 8;
  } else if ((info >> 4) == 0) {
    printf("Request method missing\n");
    printByteDebug(info);
    return -1;
  } else {
    printf("Request method not supported\n");
    printByteDebug(info);
    return -1;
  }
}


x86 assembly (clang, -O0):
<decodeMethod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x1,%eax
jne    1155 <decodeMethod+0x35>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
movw   $0x1,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x2,%eax
jne    117c <decodeMethod+0x5c>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
movw   $0x2,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x3,%eax
jne    11a3 <decodeMethod+0x83>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
movw   $0x3,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x4,%eax
jne    11ca <decodeMethod+0xaa>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
movw   $0x4,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x5,%eax
jne    11f1 <decodeMethod+0xd1>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movw   $0x5,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x6,%eax
jne    1218 <decodeMethod+0xf8>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
movw   $0x6,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x7,%eax
jne    123f <decodeMethod+0x11f>
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
movw   $0x7,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x8,%eax
jne    1266 <decodeMethod+0x146>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
movw   $0x8,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
movzbl -0x3(%rbp),%eax
sar    $0x4,%eax
cmp    $0x0,%eax
jne    1296 <decodeMethod+0x176>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x3(%rbp),%edi
call   1040 <printByteDebug@plt>
movw   $0xffff,-0x2(%rbp)
jmp    12b1 <decodeMethod+0x191>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x3(%rbp),%edi
call   1040 <printByteDebug@plt>
movw   $0xffff,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decodeMethod>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
shr    $0x4,%al
add    $0xff,%al
cmp    $0x7,%al
ja     11d5 <decodeMethod+0xb5>
movzbl %al,%eax
lea    0xec4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfb8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ax
pop    %rbx
ret
lea    0xf8e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%ax
pop    %rbx
ret
lea    0xf64(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%ax
pop    %rbx
ret
lea    0xf3b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4,%ax
pop    %rbx
ret
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%ax
pop    %rbx
ret
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%ax
pop    %rbx
ret
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x7,%ax
pop    %rbx
ret
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%ax
pop    %rbx
ret
cmp    $0xf,%bl
ja     11e3 <decodeMethod+0xc3>
lea    0xe5c(%rip),%rdi
jmp    11ea <decodeMethod+0xca>
lea    0xe36(%rip),%rdi
call   1030 <puts@plt>
movzbl %bl,%edi
call   1040 <printByteDebug@plt>
mov    $0xffff,%ax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Processing GET request\0A\00"
@.str.1 = [25 x i8] c"Processing HEAD request\0A\00"
@.str.2 = [25 x i8] c"Processing POST request\0A\00"
@.str.3 = [24 x i8] c"Processing PUT request\0A\00"
@.str.4 = [27 x i8] c"Processing DELETE request\0A\00"
@.str.5 = [28 x i8] c"Processing CONNECT request\0A\00"
@.str.6 = [28 x i8] c"Processing OPTIONS request\0A\00"
@.str.7 = [26 x i8] c"Processing TRACE request\0A\00"
@.str.8 = [24 x i8] c"Request method missing\0A\00"
@.str.9 = [30 x i8] c"Request method not supported\0A\00"
define signext i16 @decodeMethod(i8 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = ashr i32 %6, 4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i16 1, i16* %2
br label %73
11: ; preds = %1
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = ashr i32 %13, 4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i16 2, i16* %2
br label %73
18: ; preds = %11
%19 = load i8, i8* %3
%20 = zext i8 %19 to i32
%21 = ashr i32 %20, 4
%22 = icmp eq i32 %21, 3
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i16 3, i16* %2
br label %73
25: ; preds = %18
%26 = load i8, i8* %3
%27 = zext i8 %26 to i32
%28 = ashr i32 %27, 4
%29 = icmp eq i32 %28, 4
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i16 4, i16* %2
br label %73
32: ; preds = %25
%33 = load i8, i8* %3
%34 = zext i8 %33 to i32
%35 = ashr i32 %34, 4
%36 = icmp eq i32 %35, 5
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
store i16 5, i16* %2
br label %73
39: ; preds = %32
%40 = load i8, i8* %3
%41 = zext i8 %40 to i32
%42 = ashr i32 %41, 4
%43 = icmp eq i32 %42, 6
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i16 6, i16* %2
br label %73
46: ; preds = %39
%47 = load i8, i8* %3
%48 = zext i8 %47 to i32
%49 = ashr i32 %48, 4
%50 = icmp eq i32 %49, 7
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
store i16 7, i16* %2
br label %73
53: ; preds = %46
%54 = load i8, i8* %3
%55 = zext i8 %54 to i32
%56 = ashr i32 %55, 4
%57 = icmp eq i32 %56, 8
br i1 %57, label %58, label %60
58: ; preds = %53
%59 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
store i16 8, i16* %2
br label %73
60: ; preds = %53
%61 = load i8, i8* %3
%62 = zext i8 %61 to i32
%63 = ashr i32 %62, 4
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %60
%66 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%67 = load i8, i8* %3
%68 = call i32 @printByteDebug(i8 zeroext %67)
store i16 -1, i16* %2
br label %73
69: ; preds = %60
%70 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%71 = load i8, i8* %3
%72 = call i32 @printByteDebug(i8 zeroext %71)
store i16 -1, i16* %2
br label %73
73: ; preds = %69, %65, %58, %51, %44, %37, %30, %23, %16, %9
%74 = load i16, i16* %2
ret i16 %74
}

LLVM IR (-O2):
@str = [29 x i8] c"Request method not supported\00"
@str.10 = [23 x i8] c"Request method missing\00"
@str.11 = [25 x i8] c"Processing TRACE request\00"
@str.12 = [27 x i8] c"Processing OPTIONS request\00"
@str.13 = [27 x i8] c"Processing CONNECT request\00"
@str.14 = [26 x i8] c"Processing DELETE request\00"
@str.15 = [23 x i8] c"Processing PUT request\00"
@str.16 = [24 x i8] c"Processing POST request\00"
@str.17 = [24 x i8] c"Processing HEAD request\00"
@str.18 = [23 x i8] c"Processing GET request\00"
define signext i16 @decodeMethod(i8 zeroext %0) {
%2 = lshr i8 %0, 4
switch i8 %2, label %19 [
i8 1, label %3
i8 2, label %5
i8 3, label %7
i8 4, label %9
i8 5, label %11
i8 6, label %13
i8 7, label %15
i8 8, label %17
]
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.18, i64 0, i64 0))
br label %27
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.17, i64 0, i64 0))
br label %27
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.16, i64 0, i64 0))
br label %27
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
br label %27
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.14, i64 0, i64 0))
br label %27
13: ; preds = %1
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.13, i64 0, i64 0))
br label %27
15: ; preds = %1
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0))
br label %27
17: ; preds = %1
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.11, i64 0, i64 0))
br label %27
19: ; preds = %1
%20 = icmp ult i8 %0, 16
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%23 = tail call i32 @printByteDebug(i8 zeroext %0)
br label %27
24: ; preds = %19
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%26 = tail call i32 @printByteDebug(i8 zeroext %0)
br label %27
27: ; preds = %24, %21, %17, %15, %13, %11, %9, %7, %5, %3
%28 = phi i16 [ 1, %3 ], [ 2, %5 ], [ 3, %7 ], [ 4, %9 ], [ 5, %11 ], [ 6, %13 ], [ 7, %15 ], [ 8, %17 ], [ -1, %21 ], [ -1, %24 ]
ret i16 %28
}