char *coap2dia_code(unsigned int code) {
  switch (code) {
  case (((201) / 100 << 5) | (201) % 100):
    return "STATUS_CREATED";
  case (((202) / 100 << 5) | (202) % 100):
    return "STATUS_DELETED";
  case (((204) / 100 << 5) | (204) % 100):
    return "STATUS_OK";
  case (((205) / 100 << 5) | (205) % 100):
    return "STATUS_OK";
  case (((400) / 100 << 5) | (400) % 100):
    return "STATUS_BAD_REQUEST";
  case (((401) / 100 << 5) | (401) % 100):
    return "STATUS_PERMISSION_DENIED";
  case (((404) / 100 << 5) | (404) % 100):
    return "STATUS_NOT_FOUND";
  case (((405) / 100 << 5) | (405) % 100):
    return "STATUS_METHOD_NOT_ALLOWED";
  case (((406) / 100 << 5) | (406) % 100):
    return "STATUS_NOT_ACCEPTABLE";
  case (((409) / 100 << 5) | (409) % 100):
    return "STATUS_CONFLICT";
  case (((415) / 100 << 5) | (415) % 100):
    return "STATUS_UNSUPPORTED_MEDIA_TYPE";
  case (((500) / 100 << 5) | (500) % 100):
    return "STATUS_INTERNAL_SERVER_ERROR";
  case (((501) / 100 << 5) | (501) % 100):
    return "STATUS_NOT_IMPLEMENTED";
  case (((502) / 100 << 5) | (502) % 100):
    return "STATUS_BAD_GATEWAY";
  case (((503) / 100 << 5) | (503) % 100):
    return "STATUS_SERVICE_UNAVAILABLE";
  case (((504) / 100 << 5) | (504) % 100):
    return "STATUS_GATEWAY_TIMEOUT";
  default:
    return "STATUS_BAD_REQUEST";
  }
}


x86 assembly (clang, -O0):
<coap2dia_code>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x63,%eax
ja     1230 <coap2dia_code+0x130>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1059(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1058(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1057(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1047(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1041(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1044(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x104d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x104e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1058(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x105e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x105e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x106c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1079(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1080(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x1083(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0x108e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123b <coap2dia_code+0x13b>
lea    0xf81(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<coap2dia_code>:
add    $0xffffffbf,%edi
cmp    $0x63,%edi
ja     1127 <coap2dia_code+0x27>
lea    0x1081(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0x1088(%rip),%rax
ret
lea    0x108a(%rip),%rax
ret
lea    0x1069(%rip),%rax
ret
lea    0x108d(%rip),%rax
ret
lea    0x109e(%rip),%rax
ret
lea    0x10a7(%rip),%rax
ret
lea    0x10b9(%rip),%rax
ret
lea    0x10c7(%rip),%rax
ret
lea    0x10cf(%rip),%rax
ret
lea    0x10e5(%rip),%rax
ret
lea    0x10fa(%rip),%rax
ret
lea    0x1109(%rip),%rax
ret
lea    0x1114(%rip),%rax
ret
lea    0x1127(%rip),%rax
ret

LLVM IR (-O0):
@.str = [15 x i8] c"STATUS_CREATED\00"
@.str.1 = [15 x i8] c"STATUS_DELETED\00"
@.str.2 = [10 x i8] c"STATUS_OK\00"
@.str.3 = [19 x i8] c"STATUS_BAD_REQUEST\00"
@.str.4 = [25 x i8] c"STATUS_PERMISSION_DENIED\00"
@.str.5 = [17 x i8] c"STATUS_NOT_FOUND\00"
@.str.6 = [26 x i8] c"STATUS_METHOD_NOT_ALLOWED\00"
@.str.7 = [22 x i8] c"STATUS_NOT_ACCEPTABLE\00"
@.str.8 = [16 x i8] c"STATUS_CONFLICT\00"
@.str.9 = [30 x i8] c"STATUS_UNSUPPORTED_MEDIA_TYPE\00"
@.str.10 = [29 x i8] c"STATUS_INTERNAL_SERVER_ERROR\00"
@.str.11 = [23 x i8] c"STATUS_NOT_IMPLEMENTED\00"
@.str.12 = [19 x i8] c"STATUS_BAD_GATEWAY\00"
@.str.13 = [27 x i8] c"STATUS_SERVICE_UNAVAILABLE\00"
@.str.14 = [23 x i8] c"STATUS_GATEWAY_TIMEOUT\00"
define i8* @coap2dia_code(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %21 [
i32 65, label %5
i32 66, label %6
i32 68, label %7
i32 69, label %8
i32 128, label %9
i32 129, label %10
i32 132, label %11
i32 133, label %12
i32 134, label %13
i32 137, label %14
i32 143, label %15
i32 160, label %16
i32 161, label %17
i32 162, label %18
i32 163, label %19
i32 164, label %20
]
5: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
br label %22
6: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %22
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %22
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %22
9: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %22
10: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %22
11: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %22
12: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %22
13: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %22
14: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %22
15: ; preds = %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %22
16: ; preds = %1
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %22
17: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %22
18: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %22
19: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %22
20: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %22
21: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %22
22: ; preds = %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@.str = [15 x i8] c"STATUS_CREATED\00"
@.str.1 = [15 x i8] c"STATUS_DELETED\00"
@.str.2 = [10 x i8] c"STATUS_OK\00"
@.str.3 = [19 x i8] c"STATUS_BAD_REQUEST\00"
@.str.4 = [25 x i8] c"STATUS_PERMISSION_DENIED\00"
@.str.5 = [17 x i8] c"STATUS_NOT_FOUND\00"
@.str.6 = [26 x i8] c"STATUS_METHOD_NOT_ALLOWED\00"
@.str.7 = [22 x i8] c"STATUS_NOT_ACCEPTABLE\00"
@.str.8 = [16 x i8] c"STATUS_CONFLICT\00"
@.str.9 = [30 x i8] c"STATUS_UNSUPPORTED_MEDIA_TYPE\00"
@.str.10 = [29 x i8] c"STATUS_INTERNAL_SERVER_ERROR\00"
@.str.11 = [23 x i8] c"STATUS_NOT_IMPLEMENTED\00"
@.str.12 = [19 x i8] c"STATUS_BAD_GATEWAY\00"
@.str.13 = [27 x i8] c"STATUS_SERVICE_UNAVAILABLE\00"
@.str.14 = [23 x i8] c"STATUS_GATEWAY_TIMEOUT\00"
define i8* @coap2dia_code(i32 %0) {
switch i32 %0, label %17 [
i32 65, label %18
i32 66, label %2
i32 68, label %3
i32 69, label %4
i32 128, label %5
i32 129, label %6
i32 132, label %7
i32 133, label %8
i32 134, label %9
i32 137, label %10
i32 143, label %11
i32 160, label %12
i32 161, label %13
i32 162, label %14
i32 163, label %15
i32 164, label %16
]
2: ; preds = %1
br label %18
3: ; preds = %1
br label %18
4: ; preds = %1
br label %18
5: ; preds = %1
br label %18
6: ; preds = %1
br label %18
7: ; preds = %1
br label %18
8: ; preds = %1
br label %18
9: ; preds = %1
br label %18
10: ; preds = %1
br label %18
11: ; preds = %1
br label %18
12: ; preds = %1
br label %18
13: ; preds = %1
br label %18
14: ; preds = %1
br label %18
15: ; preds = %1
br label %18
16: ; preds = %1
br label %18
17: ; preds = %1
br label %18
18: ; preds = %1, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%19 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), %17 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), %16 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), %15 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), %14 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), %13 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), %12 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), %11 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), %10 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %19
}