const char *RMessageForError(int errorCode) {
  switch (errorCode) {
  case 0:
    return "no error";
  case 1:
    return "could not open file";
  case 2:
    return "error reading from file";
  case 3:
    return "error writing to file";
  case 4:
    return "out of memory";
  case 5:
    return "out of color cells";
  case 6:
    return "invalid or corrupted image file";
  case 7:
    return "the image format in the file is not supported and can't be loaded";
  case 8:
    return "image file does not contain requested image index";
  case 16:
    return "request for an invalid visual ID";
  case 17:
    return "failed to create standard colormap";
  case 127:
    return "internal X error";
  default:
  case 128:
    return "internal error";
  }
}


x86 assembly (clang, -O0):
<RMessageForError>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x80,%rax
ja     11ee <RMessageForError+0xee>
mov    -0x18(%rbp),%rax
lea    0xedb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x10cf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x10c8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x10cc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x10d4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x10da(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x10d8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x10db(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x10eb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x111d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x113f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x1150(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
lea    0x1163(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11fe <RMessageForError+0xfe>
jmp    11f3 <RMessageForError+0xf3>
lea    0x115f(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RMessageForError>:
cmp    $0x11,%edi
ja     1126 <RMessageForError+0x26>
lea    0xf3c(%rip),%rax
mov    %edi,%ecx
lea    0xeeb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xf2c(%rip),%rax
ret
cmp    $0x7f,%edi
jne    1133 <RMessageForError+0x33>
lea    0x105a(%rip),%rax
ret
lea    0x1063(%rip),%rax
ret
lea    0xf23(%rip),%rax
ret
lea    0xf33(%rip),%rax
ret
lea    0xf41(%rip),%rax
ret
lea    0xf47(%rip),%rax
ret
lea    0xf52(%rip),%rax
ret
lea    0xf6a(%rip),%rax
ret
lea    0xfa4(%rip),%rax
ret
lea    0xfce(%rip),%rax
ret
lea    0xfe7(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"no error\00"
@.str.1 = [20 x i8] c"could not open file\00"
@.str.2 = [24 x i8] c"error reading from file\00"
@.str.3 = [22 x i8] c"error writing to file\00"
@.str.4 = [14 x i8] c"out of memory\00"
@.str.5 = [19 x i8] c"out of color cells\00"
@.str.6 = [32 x i8] c"invalid or corrupted image file\00"
@.str.7 = [66 x i8] c"the image format in the file is not supported and can't be loaded\00"
@.str.8 = [50 x i8] c"image file does not contain requested image index\00"
@.str.9 = [33 x i8] c"request for an invalid visual ID\00"
@.str.10 = [35 x i8] c"failed to create standard colormap\00"
@.str.11 = [17 x i8] c"internal X error\00"
@.str.12 = [15 x i8] c"internal error\00"
define i8* @RMessageForError(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %17 [
i32 0, 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 16, label %14
i32 17, label %15
i32 127, label %16
i32 128, label %18
]
5: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
6: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %19
7: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %19
8: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %19
9: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %19
10: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %19
11: ; preds = %1
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %19
12: ; preds = %1
store i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %19
13: ; preds = %1
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %19
14: ; preds = %1
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %19
15: ; preds = %1
store i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %19
16: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %1
br label %18
18: ; preds = %1, %17
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %19
19: ; preds = %18, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [9 x i8] c"no error\00"
@.str.1 = [20 x i8] c"could not open file\00"
@.str.2 = [24 x i8] c"error reading from file\00"
@.str.3 = [22 x i8] c"error writing to file\00"
@.str.4 = [14 x i8] c"out of memory\00"
@.str.5 = [19 x i8] c"out of color cells\00"
@.str.6 = [32 x i8] c"invalid or corrupted image file\00"
@.str.7 = [66 x i8] c"the image format in the file is not supported and can't be loaded\00"
@.str.8 = [50 x i8] c"image file does not contain requested image index\00"
@.str.9 = [33 x i8] c"request for an invalid visual ID\00"
@.str.10 = [35 x i8] c"failed to create standard colormap\00"
@.str.11 = [17 x i8] c"internal X error\00"
@.str.12 = [15 x i8] c"internal error\00"
define i8* @RMessageForError(i32 %0) {
switch i32 %0, label %13 [
i32 0, label %14
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 16, label %10
i32 17, label %11
i32 127, label %12
]
2: ; preds = %1
br label %14
3: ; preds = %1
br label %14
4: ; preds = %1
br label %14
5: ; preds = %1
br label %14
6: ; preds = %1
br label %14
7: ; preds = %1
br label %14
8: ; preds = %1
br label %14
9: ; preds = %1
br label %14
10: ; preds = %1
br label %14
11: ; preds = %1
br label %14
12: ; preds = %1
br label %14
13: ; preds = %1
br label %14
14: ; preds = %1, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%15 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([66 x i8], [66 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([20 x i8], [20 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* %15
}