char *get_message_code(int code) {
  switch (code) {
  case 100:
    return "Continue";
    break;
  case 200:
    return "OK";
    break;
  case 400:
    return "Bad Request";
    break;
  case 401:
    return "Unauthorized";
    break;
  case 404:
    return "Not Found";
    break;
  case 418:
    return "I’m a teapot";
    break;
  case 501:
    return "Not Implemented";
    break;
  }
}


x86 assembly (clang, -O0):
<get_message_code>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x64,%eax
je     118d <get_message_code+0x8d>
jmp    111b <get_message_code+0x1b>
mov    -0x10(%rbp),%eax
sub    $0xc8,%eax
je     119d <get_message_code+0x9d>
jmp    112e <get_message_code+0x2e>
mov    -0x10(%rbp),%eax
sub    $0x190,%eax
je     11ad <get_message_code+0xad>
jmp    1141 <get_message_code+0x41>
mov    -0x10(%rbp),%eax
sub    $0x191,%eax
je     11bd <get_message_code+0xbd>
jmp    1154 <get_message_code+0x54>
mov    -0x10(%rbp),%eax
sub    $0x194,%eax
je     11cd <get_message_code+0xcd>
jmp    1167 <get_message_code+0x67>
mov    -0x10(%rbp),%eax
sub    $0x1a2,%eax
je     11dd <get_message_code+0xdd>
jmp    117a <get_message_code+0x7a>
mov    -0x10(%rbp),%eax
sub    $0x1f5,%eax
je     11ed <get_message_code+0xed>
jmp    11f8 <get_message_code+0xf8>
lea    0xe6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_message_code+0xf8>
lea    0xe65(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_message_code+0xf8>
lea    0xe58(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_message_code+0xf8>
lea    0xe54(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_message_code+0xf8>
lea    0xe51(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_message_code+0xf8>
lea    0xe4b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_message_code+0xf8>
lea    0xe4a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_message_code>:
lea    0xf45(%rip),%rax
lea    -0x190(%rdi),%ecx
cmp    $0x12,%ecx
ja     112a <get_message_code+0x2a>
lea    0xee7(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xf2f(%rip),%rax
ret
cmp    $0x1f5,%edi
je     115a <get_message_code+0x5a>
cmp    $0xc8,%edi
jne    1161 <get_message_code+0x61>
lea    0xf14(%rip),%rax
ret
lea    0xf1b(%rip),%rax
ret
lea    0xf20(%rip),%rax
ret
lea    0xf22(%rip),%rax
ret
lea    0xf29(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Continue\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [12 x i8] c"Bad Request\00"
@.str.3 = [13 x i8] c"Unauthorized\00"
@.str.4 = [10 x i8] c"Not Found\00"
@.str.5 = [15 x i8] c"I\E2\80\99m a teapot\00"
@.str.6 = [16 x i8] c"Not Implemented\00"
define i8* @get_message_code(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %12 [
i32 100, label %5
i32 200, label %6
i32 400, label %7
i32 401, label %8
i32 404, label %9
i32 418, label %10
i32 501, label %11
]
5: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %12
7: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %12
8: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %12
9: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %12
10: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %5, %6, %7, %8, %9, %10, %11, %1
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [9 x i8] c"Continue\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [12 x i8] c"Bad Request\00"
@.str.3 = [13 x i8] c"Unauthorized\00"
@.str.4 = [10 x i8] c"Not Found\00"
@.str.5 = [15 x i8] c"I\E2\80\99m a teapot\00"
@.str.6 = [16 x i8] c"Not Implemented\00"
define i8* @get_message_code(i32 %0) {
switch i32 %0, label %8 [
i32 501, label %7
i32 200, label %2
i32 400, label %3
i32 401, label %4
i32 404, label %5
i32 418, label %6
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %2, %3, %4, %5, %6, %7, %1
%9 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %9
}