const char *http_method_text(int method) {
  char *r;
  switch (method) {
  case 0x0001:
    r = "GET";
    break;
  case 0x0002:
    r = "POST";
    break;
  case 0x0004:
    r = "PUT";
    break;
  case 0x0010:
    r = "DELETE";
    break;
  case 0x0020:
    r = "HEAD";
    break;
  case 0x0040:
    r = "OPTIONS";
    break;
  case 0x0080:
    r = "PATCH";
    break;
  default:
    r = "";
    break;
  }
  return (r);
}


x86 assembly (clang, -O0):
<http_method_text>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     1183 <http_method_text+0x83>
jmp    111b <http_method_text+0x1b>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1193 <http_method_text+0x93>
jmp    112c <http_method_text+0x2c>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     11a3 <http_method_text+0xa3>
jmp    113d <http_method_text+0x3d>
mov    -0x14(%rbp),%eax
sub    $0x10,%eax
je     11b3 <http_method_text+0xb3>
jmp    114e <http_method_text+0x4e>
mov    -0x14(%rbp),%eax
sub    $0x20,%eax
je     11c3 <http_method_text+0xc3>
jmp    115f <http_method_text+0x5f>
mov    -0x14(%rbp),%eax
sub    $0x40,%eax
je     11d3 <http_method_text+0xd3>
jmp    1170 <http_method_text+0x70>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     11e3 <http_method_text+0xe3>
jmp    11f3 <http_method_text+0xf3>
lea    0xe76(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fe <http_method_text+0xfe>
lea    0xe6a(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fe <http_method_text+0xfe>
lea    0xe5f(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fe <http_method_text+0xfe>
lea    0xe53(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fe <http_method_text+0xfe>
lea    0xe4a(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fe <http_method_text+0xfe>
lea    0xe3f(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fe <http_method_text+0xfe>
lea    0xe37(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fe <http_method_text+0xfe>
lea    0xe1e(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_method_text>:
lea    -0x1(%rdi),%ecx
cmp    $0x1f,%ecx
ja     1127 <http_method_text+0x27>
lea    0xf71(%rip),%rax
lea    0xeea(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xf5e(%rip),%rax
ret
cmp    $0x40,%edi
je     115c <http_method_text+0x5c>
cmp    $0x80,%edi
jne    113c <http_method_text+0x3c>
lea    0xf66(%rip),%rax
ret
lea    0xf55(%rip),%rax
ret
lea    0xf3e(%rip),%rax
ret
lea    0xf3a(%rip),%rax
ret
lea    0xf39(%rip),%rax
ret
lea    0xf36(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"GET\00"
@.str.1 = [5 x i8] c"POST\00"
@.str.2 = [4 x i8] c"PUT\00"
@.str.3 = [7 x i8] c"DELETE\00"
@.str.4 = [5 x i8] c"HEAD\00"
@.str.5 = [8 x i8] c"OPTIONS\00"
@.str.6 = [6 x i8] c"PATCH\00"
@.str.7 = [1 x i8] zeroinitializer
define i8* @http_method_text(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %12 [
i32 1, label %5
i32 2, label %6
i32 4, label %7
i32 16, label %8
i32 32, label %9
i32 64, label %10
i32 128, label %11
]
5: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3
br label %13
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %13
7: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %13
8: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %13
9: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %13
10: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %13
11: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %13
12: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7, %6, %5
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [4 x i8] c"GET\00"
@.str.1 = [5 x i8] c"POST\00"
@.str.2 = [4 x i8] c"PUT\00"
@.str.3 = [7 x i8] c"DELETE\00"
@.str.4 = [5 x i8] c"HEAD\00"
@.str.5 = [8 x i8] c"OPTIONS\00"
@.str.6 = [6 x i8] c"PATCH\00"
@.str.7 = [1 x i8] zeroinitializer
define i8* @http_method_text(i32 %0) {
switch i32 %0, label %8 [
i32 1, label %9
i32 2, label %2
i32 4, label %3
i32 16, label %4
i32 32, label %5
i32 64, label %6
i32 128, label %7
]
2: ; preds = %1
br label %9
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5, %4, %3, %2
%10 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %10
}