float Mepg2FrameRate(unsigned char code) {
  switch (code & 0x0f) {
  case 1:
    return (float)24000.0 / 1001;
  case 2:
    return 24;
  case 3:
    return 25;
  case 4:
    return (float)30000.0 / 1001;
  case 5:
    return 30;
  case 6:
    return 50;
  case 7:
    return (float)60000.0 / 1001;
  case 8:
    return 60;
  default:
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Mepg2FrameRate>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
and    $0xf,%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     11c7 <Mepg2FrameRate+0xc7>
mov    -0x10(%rbp),%rax
lea    0xef2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
movss  0xec7(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
movss  0xeb1(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
movss  0xe9b(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
movss  0xe85(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
movss  0xe6f(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
movss  0xe59(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
movss  0xe43(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <Mepg2FrameRate+0xcf>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mepg2FrameRate>:
and    $0xf,%edi
add    $0xffffffff,%edi
xorps  %xmm0,%xmm0
cmp    $0x7,%edi
ja     111d <Mepg2FrameRate+0x1d>
movslq %edi,%rax
lea    0xee8(%rip),%rcx
movss  (%rcx,%rax,4),%xmm0
ret

LLVM IR (-O0):
define float @Mepg2FrameRate(i8 zeroext %0) {
%2 = alloca float
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 15
switch i32 %6, label %15 [
i32 1, label %7
i32 2, label %8
i32 3, label %9
i32 4, label %10
i32 5, label %11
i32 6, label %12
i32 7, label %13
i32 8, label %14
]
7: ; preds = %1
store float 0x4037F9DCC0000000, float* %2
br label %16
8: ; preds = %1
store float 2.400000e+01, float* %2
br label %16
9: ; preds = %1
store float 2.500000e+01, float* %2
br label %16
10: ; preds = %1
store float 0x403DF853E0000000, float* %2
br label %16
11: ; preds = %1
store float 3.000000e+01, float* %2
br label %16
12: ; preds = %1
store float 5.000000e+01, float* %2
br label %16
13: ; preds = %1
store float 0x404DF853E0000000, float* %2
br label %16
14: ; preds = %1
store float 6.000000e+01, float* %2
br label %16
15: ; preds = %1
store float 0.000000e+00, float* %2
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %7
%17 = load float, float* %2
ret float %17
}

LLVM IR (-O2):
@switch.table.Mepg2FrameRate = [8 x float] [float 0x4037F9DCC0000000, float 2.400000e+01, float 2.500000e+01, float 0x403DF853E0000000, float 3.000000e+01, float 5.000000e+01, float 0x404DF853E0000000, float 6.000000e+01]
define float @Mepg2FrameRate(i8 zeroext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i32
%4 = add nsw i32 %3, -1
%5 = icmp ult i32 %4, 8
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds [8 x float], [8 x float]* @switch.table.Mepg2FrameRate, i64 0, i64 %7
%9 = load float, float* %8
br label %10
10: ; preds = %1, %6
%11 = phi float [ %9, %6 ], [ 0.000000e+00, %1 ]
ret float %11
}