const char *binimage_flash_freq_to_str(unsigned char freq) {
  switch (freq) {
  case 0x0:
    return "40";
  case 0x1:
    return "26";
  case 0x2:
    return "20";
  case 0xf:
    return "80";
  default:
    return "";
  }
}


x86 assembly (clang, -O0):
<binimage_flash_freq_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0xf,%rax
ja     1170 <binimage_flash_freq_to_str+0x70>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf09(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117b <binimage_flash_freq_to_str+0x7b>
lea    0xefc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117b <binimage_flash_freq_to_str+0x7b>
lea    0xeef(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117b <binimage_flash_freq_to_str+0x7b>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117b <binimage_flash_freq_to_str+0x7b>
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<binimage_flash_freq_to_str>:
cmp    $0xf,%dil
ja     112f <binimage_flash_freq_to_str+0x2f>
lea    0xf33(%rip),%rax
mov    %edi,%ecx
lea    0xeea(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xf1d(%rip),%rax
ret
lea    0xf18(%rip),%rax
ret
lea    0xf12(%rip),%rax
ret
lea    0xf0b(%rip),%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"40\00"
@.str.1 = [3 x i8] c"26\00"
@.str.2 = [3 x i8] c"20\00"
@.str.3 = [3 x i8] c"80\00"
@.str.4 = [1 x i8] zeroinitializer
define i8* @binimage_flash_freq_to_str(i8 zeroext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
switch i32 %5, label %10 [
i32 0, label %6
i32 1, label %7
i32 2, label %8
i32 15, label %9
]
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %11
7: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %11
8: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %11
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %11
10: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %11
11: ; preds = %10, %9, %8, %7, %6
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"40\00"
@.str.1 = [3 x i8] c"26\00"
@.str.2 = [3 x i8] c"20\00"
@.str.3 = [3 x i8] c"80\00"
@.str.4 = [1 x i8] zeroinitializer
define i8* @binimage_flash_freq_to_str(i8 zeroext %0) {
switch i8 %0, label %5 [
i8 0, label %6
i8 1, label %2
i8 2, label %3
i8 15, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %7
}