char *error_index(int e) {
  switch (e) {
  case 0:
    return "No error";
    break;
  case 1:
    return "Out of memory";
    break;
  case 2:
    return "The text must end with a \\0";
    break;
  case 5:
    return "You can't free the text if you don't copy it";
    break;
  case 20:
    return "Cannot create files";
    break;
  case 21:
    return "Error writing the index";
    break;
  case 22:
    return "Error writing the index";
    break;
  case 23:
    return "Cannot open index; break";
  case 24:
    return "Cannot open text; break";
  case 25:
    return "Error reading the index";
    break;
  case 26:
    return "Error reading the index";
    break;
  case 27:
    return "Error reading the text";
    break;
  case 28:
    return "Error reading the text";
    break;
  case 99:
    return "Not implemented";
    break;
  default:
    return "Unknown error";
  }
}


x86 assembly (clang, -O0):
<error_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x63,%rax
ja     120c <error_index+0x10c>
mov    -0x18(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x105d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1056(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1054(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1060(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x107d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1081(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1071(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1079(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1082(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x108a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x107a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1082(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1072(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1079(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <error_index+0x117>
lea    0x1079(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_index>:
cmp    $0x63,%edi
ja     1146 <error_index+0x46>
lea    0x1084(%rip),%rax
mov    %edi,%ecx
lea    0xeeb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0x10df(%rip),%rax
ret
lea    0x1120(%rip),%rax
ret
lea    0x1130(%rip),%rax
ret
lea    0x105c(%rip),%rax
ret
lea    0x1062(%rip),%rax
ret
lea    0x113f(%rip),%rax
ret
lea    0x106e(%rip),%rax
ret
lea    0x1093(%rip),%rax
ret
lea    0x10b7(%rip),%rax
ret
lea    0x10c8(%rip),%rax
ret
lea    0x1107(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"No error\00"
@.str.1 = [14 x i8] c"Out of memory\00"
@.str.2 = [28 x i8] c"The text must end with a \\0\00"
@.str.3 = [45 x i8] c"You can't free the text if you don't copy it\00"
@.str.4 = [20 x i8] c"Cannot create files\00"
@.str.5 = [24 x i8] c"Error writing the index\00"
@.str.6 = [25 x i8] c"Cannot open index; break\00"
@.str.7 = [24 x i8] c"Cannot open text; break\00"
@.str.8 = [24 x i8] c"Error reading the index\00"
@.str.9 = [23 x i8] c"Error reading the text\00"
@.str.10 = [16 x i8] c"Not implemented\00"
@.str.11 = [14 x i8] c"Unknown error\00"
define i8* @error_index(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %19 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 5, label %8
i32 20, label %9
i32 21, label %10
i32 22, label %11
i32 23, label %12
i32 24, label %13
i32 25, label %14
i32 26, label %15
i32 27, label %16
i32 28, label %17
i32 99, label %18
]
5: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %20
6: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %20
7: ; preds = %1
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %20
8: ; preds = %1
store i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %20
9: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %20
10: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %20
11: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %20
12: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %20
13: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %20
14: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %20
15: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %20
16: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %20
17: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %20
18: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %20
19: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %20
20: ; preds = %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [9 x i8] c"No error\00"
@.str.1 = [14 x i8] c"Out of memory\00"
@.str.2 = [28 x i8] c"The text must end with a \\0\00"
@.str.3 = [45 x i8] c"You can't free the text if you don't copy it\00"
@.str.4 = [20 x i8] c"Cannot create files\00"
@.str.5 = [24 x i8] c"Error writing the index\00"
@.str.6 = [25 x i8] c"Cannot open index; break\00"
@.str.7 = [24 x i8] c"Cannot open text; break\00"
@.str.8 = [24 x i8] c"Error reading the index\00"
@.str.9 = [23 x i8] c"Error reading the text\00"
@.str.10 = [16 x i8] c"Not implemented\00"
@.str.11 = [14 x i8] c"Unknown error\00"
define i8* @error_index(i32 %0) {
switch i32 %0, label %15 [
i32 0, label %16
i32 1, label %2
i32 2, label %3
i32 5, label %4
i32 20, label %5
i32 21, label %6
i32 22, label %7
i32 23, label %8
i32 24, label %9
i32 25, label %10
i32 26, label %11
i32 27, label %12
i32 28, label %13
i32 99, label %14
]
2: ; preds = %1
br label %16
3: ; preds = %1
br label %16
4: ; preds = %1
br label %16
5: ; preds = %1
br label %16
6: ; preds = %1
br label %16
7: ; preds = %1
br label %16
8: ; preds = %1
br label %16
9: ; preds = %1
br label %16
10: ; preds = %1
br label %16
11: ; preds = %1
br label %16
12: ; preds = %1
br label %16
13: ; preds = %1
br label %16
14: ; preds = %1
br label %16
15: ; preds = %1
br label %16
16: ; preds = %1, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%17 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), %15 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), %14 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %13 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %12 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), %11 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), %10 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([14 x i8], [14 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* %17
}