char *Baud2Str(unsigned char bin) {
  char *baudstr;
  unsigned char b;
  b = bin & 0x0f;
  switch (b) {
  case 6:
    baudstr = "9600 ";
    break;
  case 7:
    baudstr = "19.2k";
    break;
  case 8:
    baudstr = "38.4k";
    break;
  case 9:
    baudstr = "57.6k";
    break;
  case 10:
    baudstr = "115.2k";
    break;
  default:
    baudstr = "nobaud";
  }
  return (baudstr);
}


x86 assembly (clang, -O0):
<Baud2Str>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0xf,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
add    $0xfffffffa,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x4,%eax
ja     118c <Baud2Str+0x8c>
mov    -0x20(%rbp),%rax
lea    0xecd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1197 <Baud2Str+0x97>
lea    0xec7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1197 <Baud2Str+0x97>
lea    0xebd(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1197 <Baud2Str+0x97>
lea    0xeb3(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1197 <Baud2Str+0x97>
lea    0xea9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1197 <Baud2Str+0x97>
lea    0xea0(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Baud2Str>:
and    $0xf,%edi
add    $0xfffffffa,%edi
cmp    $0x4,%edi
ja     111d <Baud2Str+0x1d>
movslq %edi,%rax
lea    0xf13(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xefb(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"9600 \00"
@.str.1 = [6 x i8] c"19.2k\00"
@.str.2 = [6 x i8] c"38.4k\00"
@.str.3 = [6 x i8] c"57.6k\00"
@.str.4 = [7 x i8] c"115.2k\00"
@.str.5 = [7 x i8] c"nobaud\00"
define i8* @Baud2Str(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = and i32 %6, 15
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
switch i32 %10, label %16 [
i32 6, label %11
i32 7, label %12
i32 8, label %13
i32 9, label %14
i32 10, label %15
]
11: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %3
br label %17
12: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %17
13: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %17
14: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %17
15: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %17
16: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [6 x i8] c"9600 \00"
@.str.1 = [6 x i8] c"19.2k\00"
@.str.2 = [6 x i8] c"38.4k\00"
@.str.3 = [6 x i8] c"57.6k\00"
@.str.4 = [7 x i8] c"115.2k\00"
@.str.5 = [7 x i8] c"nobaud\00"
@reltable.Baud2Str = [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([5 x i32]* @reltable.Baud2Str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([5 x i32]* @reltable.Baud2Str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([5 x i32]* @reltable.Baud2Str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([5 x i32]* @reltable.Baud2Str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([5 x i32]* @reltable.Baud2Str to i64)) to i32)]
define i8* @Baud2Str(i8 zeroext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i32
%4 = add nsw i32 %3, -6
%5 = icmp ult i32 %4, 5
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([5 x i32]* @reltable.Baud2Str to i8*), i64 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), %1 ]
ret i8* %11
}