#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");
  }
  return err;
}


x86 assembly (clang, -O0):
<error_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x63,%rax
ja     1286 <error_index+0x176>
mov    -0x10(%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>
lea    0x2da0(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_index>:
push   %rbx
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),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

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 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* getelementptr inbounds ([100 x i8], [100 x i8]* @error_index.err, i64 0, i64 0)
}