const char *ConvertMCError(char error) {
  switch (error) {
  case 0:
    return "No error";
  case 1:
    return "Invalid start to command";
  case 2:
    return "Invalid command";
  case 3:
    return "Invalid unit id";
  case 4:
    return "No dimmer available";
  case 5:
    return "No general-purpose clock available";
  case 126:
    return "Other failure";
  }
  return "Unknown error";
}


x86 assembly (clang, -O0):
<ConvertMCError>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1184 <ConvertMCError+0x84>
jmp    111e <ConvertMCError+0x1e>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1194 <ConvertMCError+0x94>
jmp    112f <ConvertMCError+0x2f>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11a4 <ConvertMCError+0xa4>
jmp    1140 <ConvertMCError+0x40>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     11b4 <ConvertMCError+0xb4>
jmp    1151 <ConvertMCError+0x51>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     11c4 <ConvertMCError+0xc4>
jmp    1162 <ConvertMCError+0x62>
mov    -0x10(%rbp),%eax
sub    $0x5,%eax
je     11d4 <ConvertMCError+0xd4>
jmp    1173 <ConvertMCError+0x73>
mov    -0x10(%rbp),%eax
sub    $0x7e,%eax
je     11e4 <ConvertMCError+0xe4>
jmp    11f4 <ConvertMCError+0xf4>
lea    0xe75(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ff <ConvertMCError+0xff>
lea    0xe6e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ff <ConvertMCError+0xff>
lea    0xe77(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ff <ConvertMCError+0xff>
lea    0xe77(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ff <ConvertMCError+0xff>
lea    0xe77(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ff <ConvertMCError+0xff>
lea    0xe7b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ff <ConvertMCError+0xff>
lea    0xe8e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ff <ConvertMCError+0xff>
lea    0xe8c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertMCError>:
cmp    $0x5,%edi
ja     1126 <ConvertMCError+0x26>
lea    0xf0c(%rip),%rax
mov    %edi,%ecx
lea    0xeeb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xefc(%rip),%rax
ret
cmp    $0x7e,%edi
jne    1153 <ConvertMCError+0x53>
lea    0xf5f(%rip),%rax
ret
lea    0xf00(%rip),%rax
ret
lea    0xf08(%rip),%rax
ret
lea    0xf10(%rip),%rax
ret
lea    0xf1c(%rip),%rax
ret
lea    0xf45(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"No error\00"
@.str.1 = [25 x i8] c"Invalid start to command\00"
@.str.2 = [16 x i8] c"Invalid command\00"
@.str.3 = [16 x i8] c"Invalid unit id\00"
@.str.4 = [20 x i8] c"No dimmer available\00"
@.str.5 = [35 x i8] c"No general-purpose clock available\00"
@.str.6 = [14 x i8] c"Other failure\00"
@.str.7 = [14 x i8] c"Unknown error\00"
define i8* @ConvertMCError(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %13 [
i32 0, label %6
i32 1, label %7
i32 2, label %8
i32 3, label %9
i32 4, label %10
i32 5, label %11
i32 126, label %12
]
6: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %14
7: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %14
8: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %14
9: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %14
10: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %14
11: ; preds = %1
store i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %14
12: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %14
13: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7, %6
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@.str = [9 x i8] c"No error\00"
@.str.1 = [25 x i8] c"Invalid start to command\00"
@.str.2 = [16 x i8] c"Invalid command\00"
@.str.3 = [16 x i8] c"Invalid unit id\00"
@.str.4 = [20 x i8] c"No dimmer available\00"
@.str.5 = [35 x i8] c"No general-purpose clock available\00"
@.str.6 = [14 x i8] c"Other failure\00"
@.str.7 = [14 x i8] c"Unknown error\00"
define i8* @ConvertMCError(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %9 [
i32 0, label %10
i32 1, label %3
i32 2, label %4
i32 3, label %5
i32 4, label %6
i32 5, label %7
i32 126, label %8
]
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3
%11 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}