const char *reason_phrase(int status) {
  switch (status) {
  case 200:
    return "OK";
  case 400:
    return "Bad Request";
  case 403:
    return "Forbidden";
  case 404:
    return "Not Found";
  case 405:
    return "Method Not Allowed";
  case 413:
    return "Request Entity Too Large";
  case 500:
    return "Internal Server Error";
  case 505:
    return "HTTP Version Not Supported";
  default:
    return "";
  }
}


x86 assembly (clang, -O0):
<reason_phrase>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xc8,%eax
je     11a2 <reason_phrase+0xa2>
jmp    111d <reason_phrase+0x1d>
mov    -0x10(%rbp),%eax
sub    $0x190,%eax
je     11b2 <reason_phrase+0xb2>
jmp    1130 <reason_phrase+0x30>
mov    -0x10(%rbp),%eax
sub    $0x193,%eax
je     11c2 <reason_phrase+0xc2>
jmp    1143 <reason_phrase+0x43>
mov    -0x10(%rbp),%eax
sub    $0x194,%eax
je     11d2 <reason_phrase+0xd2>
jmp    1156 <reason_phrase+0x56>
mov    -0x10(%rbp),%eax
sub    $0x195,%eax
je     11e2 <reason_phrase+0xe2>
jmp    1169 <reason_phrase+0x69>
mov    -0x10(%rbp),%eax
sub    $0x19d,%eax
je     11f2 <reason_phrase+0xf2>
jmp    117c <reason_phrase+0x7c>
mov    -0x10(%rbp),%eax
sub    $0x1f4,%eax
je     1202 <reason_phrase+0x102>
jmp    118f <reason_phrase+0x8f>
mov    -0x10(%rbp),%eax
sub    $0x1f9,%eax
je     1212 <reason_phrase+0x112>
jmp    1222 <reason_phrase+0x122>
lea    0xe57(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xe4a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xe46(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xe40(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xe3a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xe3d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xe46(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xe4c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <reason_phrase+0x12d>
lea    0xdd9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reason_phrase>:
cmp    $0x1f3,%edi
jg     112b <reason_phrase+0x2b>
lea    -0x190(%rdi),%eax
cmp    $0xd,%eax
ja     1143 <reason_phrase+0x43>
lea    0xee6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf11(%rip),%rax
ret
cmp    $0x1f4,%edi
je     117b <reason_phrase+0x7b>
cmp    $0x1f9,%edi
jne    1153 <reason_phrase+0x53>
lea    0xf5b(%rip),%rax
ret
cmp    $0xc8,%edi
jne    1153 <reason_phrase+0x53>
lea    0xee6(%rip),%rax
ret
lea    0xee0(%rip),%rax
ret
lea    0xee5(%rip),%rax
ret
lea    0xee7(%rip),%rax
ret
lea    0xee9(%rip),%rax
ret
lea    0xef4(%rip),%rax
ret
lea    0xf05(%rip),%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"OK\00"
@.str.1 = [12 x i8] c"Bad Request\00"
@.str.2 = [10 x i8] c"Forbidden\00"
@.str.3 = [10 x i8] c"Not Found\00"
@.str.4 = [19 x i8] c"Method Not Allowed\00"
@.str.5 = [25 x i8] c"Request Entity Too Large\00"
@.str.6 = [22 x i8] c"Internal Server Error\00"
@.str.7 = [27 x i8] c"HTTP Version Not Supported\00"
@.str.8 = [1 x i8] zeroinitializer
define i8* @reason_phrase(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %13 [
i32 200, label %5
i32 400, label %6
i32 403, label %7
i32 404, label %8
i32 405, label %9
i32 413, label %10
i32 500, label %11
i32 505, label %12
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %14
6: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %14
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %14
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %14
9: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %14
10: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %14
11: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %14
12: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %14
13: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7, %6, %5
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"OK\00"
@.str.1 = [12 x i8] c"Bad Request\00"
@.str.2 = [10 x i8] c"Forbidden\00"
@.str.3 = [10 x i8] c"Not Found\00"
@.str.4 = [19 x i8] c"Method Not Allowed\00"
@.str.5 = [25 x i8] c"Request Entity Too Large\00"
@.str.6 = [22 x i8] c"Internal Server Error\00"
@.str.7 = [27 x i8] c"HTTP Version Not Supported\00"
@.str.8 = [1 x i8] zeroinitializer
define i8* @reason_phrase(i32 %0) {
switch i32 %0, label %9 [
i32 200, label %10
i32 400, label %2
i32 403, label %3
i32 404, label %4
i32 405, label %5
i32 413, label %6
i32 500, label %7
i32 505, label %8
]
2: ; preds = %1
br label %10
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3, %2
%11 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}