#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

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


x86 assembly (clang, -O0):
<error_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x63,%rax
ja     1286 <error_index+0x176>
mov    -0x18(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x2ef9(%rip),%rdi
lea    0x1042(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2ee1(%rip),%rdi
lea    0x1033(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2ec9(%rip),%rdi
lea    0x1029(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2eb1(%rip),%rdi
lea    0x102d(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2e99(%rip),%rdi
lea    0x1042(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2e81(%rip),%rdi
lea    0x103e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2e69(%rip),%rdi
lea    0x1026(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2e51(%rip),%rdi
lea    0x1026(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2e3e(%rip),%rdi
lea    0x102c(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2e2b(%rip),%rdi
lea    0x1031(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2e13(%rip),%rdi
lea    0x1019(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2dfb(%rip),%rdi
lea    0x1019(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2de3(%rip),%rdi
lea    0x1001(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2dcb(%rip),%rdi
lea    0x1000(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1299 <error_index+0x189>
lea    0x2db3(%rip),%rdi
lea    0xff8(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_index>:
push   %rax
cmp    $0x63,%edi
ja     1153 <error_index+0x43>
lea    0x1073(%rip),%rsi
mov    %edi,%eax
lea    0xeda(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x10ce(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x1126(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x1051(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x1056(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x1132(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x1060(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x1084(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x2ecb(%rip),%rdi
lea    0x10a0(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2eb8(%rip),%rdi
lea    0x10a6(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x10b2(%rip),%rsi
jmp    11a4 <error_index+0x94>
lea    0x10d8(%rip),%rsi
lea    0x2e95(%rip),%rdi
pop    %rax
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@error_index.err = internal global [100 x i8] zeroinitializer
@.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 %33 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
i32 5, label %11
i32 20, label %13
i32 21, label %15
i32 22, label %17
i32 23, label %19
i32 24, label %21
i32 25, label %23
i32 26, label %25
i32 27, label %27
i32 28, label %29
i32 99, label %31
]
5: ; preds = %1
%6 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %35
7: ; preds = %1
%8 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %35
9: ; preds = %1
%10 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %35
11: ; preds = %1
%12 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %35
13: ; preds = %1
%14 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %35
15: ; preds = %1
%16 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %35
17: ; preds = %1
%18 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %35
19: ; preds = %1
%20 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %1, %19
%22 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %23
23: ; preds = %1, %21
%24 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
br label %35
25: ; preds = %1
%26 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
br label %35
27: ; preds = %1
%28 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %35
29: ; preds = %1
%30 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %35
31: ; preds = %1
%32 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
br label %35
33: ; preds = %1
%34 = call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
br label %35
35: ; preds = %33, %31, %29, %27, %25, %23, %17, %15, %13, %11, %9, %7, %5
%36 = load i8*, i8** %2
ret i8* %36
}

LLVM IR (-O2):
@error_index.err = internal global [100 x i8] zeroinitializer
@.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 noalias i8* @error_index(i32 %0) {
switch i32 %0, label %17 [
i32 0, label %18
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 %10
i32 25, label %12
i32 26, label %13
i32 27, label %14
i32 28, label %15
i32 99, 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
%9 = tail call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %10
10: ; preds = %1, %8
%11 = tail call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %12
12: ; preds = %1, %10
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, %7, %6, %5, %4, %3, %2
%19 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), %17 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), %16 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %15 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %14 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), %13 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), %12 ], [ 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 ]
%20 = tail call i32 @strcpy(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0), i8* %19)
ret i8* undef
}