const char *http_code_to_string(int code) {
  switch (code) {
  case 200:
    return "OK";
  case 400:
    return "Bad Request";
  case 403:
    return "Forbidden";
  case 404:
    return "Not Found";
  }
  return "Unknown";
}


x86 assembly (clang, -O0):
<http_code_to_string>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xc8,%eax
je     1156 <http_code_to_string+0x56>
jmp    111d <http_code_to_string+0x1d>
mov    -0x10(%rbp),%eax
sub    $0x190,%eax
je     1166 <http_code_to_string+0x66>
jmp    1130 <http_code_to_string+0x30>
mov    -0x10(%rbp),%eax
sub    $0x193,%eax
je     1176 <http_code_to_string+0x76>
jmp    1143 <http_code_to_string+0x43>
mov    -0x10(%rbp),%eax
sub    $0x194,%eax
je     1186 <http_code_to_string+0x86>
jmp    1196 <http_code_to_string+0x96>
lea    0xea3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <http_code_to_string+0xa1>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <http_code_to_string+0xa1>
lea    0xe92(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <http_code_to_string+0xa1>
lea    0xe8c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <http_code_to_string+0xa1>
lea    0xe86(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_code_to_string>:
cmp    $0x192,%edi
jg     1120 <http_code_to_string+0x20>
cmp    $0xc8,%edi
je     1140 <http_code_to_string+0x40>
cmp    $0x190,%edi
jne    1138 <http_code_to_string+0x38>
lea    0xee4(%rip),%rax
ret
cmp    $0x193,%edi
je     1148 <http_code_to_string+0x48>
cmp    $0x194,%edi
jne    1138 <http_code_to_string+0x38>
lea    0xee2(%rip),%rax
ret
lea    0xee4(%rip),%rax
ret
lea    0xeb9(%rip),%rax
ret
lea    0xec0(%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 = [8 x i8] c"Unknown\00"
define i8* @http_code_to_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 200, label %5
i32 400, label %6
i32 403, label %7
i32 404, label %8
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
6: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %10
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %10
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %10
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i8*, i8** %2
ret i8* %11
}

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 = [8 x i8] c"Unknown\00"
define i8* @http_code_to_string(i32 %0) {
switch i32 %0, label %5 [
i32 200, label %6
i32 400, label %2
i32 403, label %3
i32 404, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i8* [ getelementptr inbounds ([8 x i8], [8 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* %7
}