char *OKN_STATUS_NAME(int code) {
  switch (code) {
  case 1:
    return "OKN_SUCCESS";
  case -1:
    return "OKN_ERROR_INTERNAL";
  case -2:
    return "OKN_ERROR_MEMORY";
  case -3:
    return "OKN_ERROR_NULL";
  case -4:
    return "OKN_ERROR_NOEXIST";
  case -5:
    return "OKN_ERROR_BOUNDS";
  case -6:
    return "OKN_ERROR_LIMIT";
  case -7:
    return "OKN_ERROR_REF";
  case -8:
    return "OKN_ERROR_TYPE";
  case -10:
    return "OKN_ERROR_PARSE";
  case -20:
    return "OKN_ERROR_STATE";
  case -50:
    return "OKN_ERROR_OPEN";
  case -51:
    return "OKN_ERROR_CLOSE";
  case -52:
    return "OKN_ERROR_IO";
  case -100:
    return "OKN_ERROR_PARTY";
  default:
    return "invalid error code";
  }
}


x86 assembly (clang, -O0):
<OKN_STATUS_NAME>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x64,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x65,%eax
ja     1220 <OKN_STATUS_NAME+0x120>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1061(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x105d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1060(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1061(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1060(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1062(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1063(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1063(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1061(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1060(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1060(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x1060(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x105f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x105f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x105c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122b <OKN_STATUS_NAME+0x12b>
lea    0x105c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<OKN_STATUS_NAME>:
add    $0x64,%edi
cmp    $0x65,%edi
ja     1127 <OKN_STATUS_NAME+0x27>
lea    0x1089(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0x114d(%rip),%rax
ret
lea    0x1155(%rip),%rax
ret
lea    0x1130(%rip),%rax
ret
lea    0x1118(%rip),%rax
ret
lea    0x1101(%rip),%rax
ret
lea    0x10e9(%rip),%rax
ret
lea    0x10d1(%rip),%rax
ret
lea    0x10ba(%rip),%rax
ret
lea    0x1094(%rip),%rax
ret
lea    0x107b(%rip),%rax
ret
lea    0x1061(%rip),%rax
ret
lea    0x104a(%rip),%rax
ret
lea    0x1031(%rip),%rax
ret
lea    0x1016(%rip),%rax
ret
lea    0x1074(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"OKN_SUCCESS\00"
@.str.1 = [19 x i8] c"OKN_ERROR_INTERNAL\00"
@.str.2 = [17 x i8] c"OKN_ERROR_MEMORY\00"
@.str.3 = [15 x i8] c"OKN_ERROR_NULL\00"
@.str.4 = [18 x i8] c"OKN_ERROR_NOEXIST\00"
@.str.5 = [17 x i8] c"OKN_ERROR_BOUNDS\00"
@.str.6 = [16 x i8] c"OKN_ERROR_LIMIT\00"
@.str.7 = [14 x i8] c"OKN_ERROR_REF\00"
@.str.8 = [15 x i8] c"OKN_ERROR_TYPE\00"
@.str.9 = [16 x i8] c"OKN_ERROR_PARSE\00"
@.str.10 = [16 x i8] c"OKN_ERROR_STATE\00"
@.str.11 = [15 x i8] c"OKN_ERROR_OPEN\00"
@.str.12 = [16 x i8] c"OKN_ERROR_CLOSE\00"
@.str.13 = [13 x i8] c"OKN_ERROR_IO\00"
@.str.14 = [16 x i8] c"OKN_ERROR_PARTY\00"
@.str.15 = [19 x i8] c"invalid error code\00"
define i8* @OKN_STATUS_NAME(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %20 [
i32 1, label %5
i32 -1, label %6
i32 -2, label %7
i32 -3, label %8
i32 -4, label %9
i32 -5, label %10
i32 -6, label %11
i32 -7, label %12
i32 -8, label %13
i32 -10, label %14
i32 -20, label %15
i32 -50, label %16
i32 -51, label %17
i32 -52, label %18
i32 -100, label %19
]
5: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
br label %21
6: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %21
7: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %21
8: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %21
9: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %21
10: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %21
11: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %21
12: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %21
13: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %21
14: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %21
15: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %21
16: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %21
17: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %21
18: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %21
19: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %21
20: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %21
21: ; preds = %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
@.str = [12 x i8] c"OKN_SUCCESS\00"
@.str.1 = [19 x i8] c"OKN_ERROR_INTERNAL\00"
@.str.2 = [17 x i8] c"OKN_ERROR_MEMORY\00"
@.str.3 = [15 x i8] c"OKN_ERROR_NULL\00"
@.str.4 = [18 x i8] c"OKN_ERROR_NOEXIST\00"
@.str.5 = [17 x i8] c"OKN_ERROR_BOUNDS\00"
@.str.6 = [16 x i8] c"OKN_ERROR_LIMIT\00"
@.str.7 = [14 x i8] c"OKN_ERROR_REF\00"
@.str.8 = [15 x i8] c"OKN_ERROR_TYPE\00"
@.str.9 = [16 x i8] c"OKN_ERROR_PARSE\00"
@.str.10 = [16 x i8] c"OKN_ERROR_STATE\00"
@.str.11 = [15 x i8] c"OKN_ERROR_OPEN\00"
@.str.12 = [16 x i8] c"OKN_ERROR_CLOSE\00"
@.str.13 = [13 x i8] c"OKN_ERROR_IO\00"
@.str.14 = [16 x i8] c"OKN_ERROR_PARTY\00"
@.str.15 = [19 x i8] c"invalid error code\00"
define i8* @OKN_STATUS_NAME(i32 %0) {
switch i32 %0, label %16 [
i32 1, label %17
i32 -1, label %2
i32 -2, label %3
i32 -3, label %4
i32 -4, label %5
i32 -5, label %6
i32 -6, label %7
i32 -7, label %8
i32 -8, label %9
i32 -10, label %10
i32 -20, label %11
i32 -50, label %12
i32 -51, label %13
i32 -52, label %14
i32 -100, label %15
]
2: ; preds = %1
br label %17
3: ; preds = %1
br label %17
4: ; preds = %1
br label %17
5: ; preds = %1
br label %17
6: ; preds = %1
br label %17
7: ; preds = %1
br label %17
8: ; preds = %1
br label %17
9: ; preds = %1
br label %17
10: ; preds = %1
br label %17
11: ; preds = %1
br label %17
12: ; preds = %1
br label %17
13: ; preds = %1
br label %17
14: ; preds = %1
br label %17
15: ; preds = %1
br label %17
16: ; preds = %1
br label %17
17: ; preds = %1, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%18 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), %16 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), %15 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %18
}