float Mepg2AspectRatio(unsigned char code, long width, long height) {
  switch (code & 0x0f) {
  case 1:
    return 1;
  case 2:
    return (float)4.0 / 3;
  case 3:
    return (float)16.0 / 9;
  case 4:
    return (float)221 / 100;
  case 5:
    return (float)12 / 11;
  case 6:
    return (float)10 / 11;
  case 7:
    return (float)16 / 11;
  case 8:
    return (float)40 / 33;
  case 0x0f:
    return ((float)width) / ((float)height);
  default:
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Mepg2AspectRatio>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movzbl -0x5(%rbp),%eax
and    $0xf,%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xe,%eax
ja     11e9 <Mepg2AspectRatio+0xe9>
mov    -0x20(%rbp),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xed5(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
movss  0xebf(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
movss  0xea9(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
movss  0xe93(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
movss  0xe7d(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
movss  0xe67(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
movss  0xe51(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
movss  0xe3b(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
cvtsi2ssq -0x10(%rbp),%xmm0
cvtsi2ssq -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f1 <Mepg2AspectRatio+0xf1>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mepg2AspectRatio>:
and    $0xf,%edi
add    $0xffffffff,%edi
cmp    $0xe,%edi
ja     1162 <Mepg2AspectRatio+0x62>
movss  0xeed(%rip),%xmm0
lea    0xf06(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movss  0xef1(%rip),%xmm0
ret
movss  0xee4(%rip),%xmm0
ret
movss  0xed7(%rip),%xmm0
ret
movss  0xeca(%rip),%xmm0
ret
movss  0xebd(%rip),%xmm0
ret
movss  0xeb0(%rip),%xmm0
ret
movss  0xea3(%rip),%xmm0
ret
xorps  %xmm0,%xmm0
ret
xorps  %xmm0,%xmm0
cvtsi2ss %rsi,%xmm0
cvtsi2ss %rdx,%xmm1
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @Mepg2AspectRatio(i8 zeroext %0, i64 %1, i64 %2) {
%4 = alloca float
%5 = alloca i8
%6 = alloca i64
%7 = alloca i64
store i8 %0, i8* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
switch i32 %10, label %25 [
i32 1, label %11
i32 2, label %12
i32 3, label %13
i32 4, label %14
i32 5, label %15
i32 6, label %16
i32 7, label %17
i32 8, label %18
i32 15, label %19
]
11: ; preds = %3
store float 1.000000e+00, float* %4
br label %26
12: ; preds = %3
store float 0x3FF5555560000000, float* %4
br label %26
13: ; preds = %3
store float 0x3FFC71C720000000, float* %4
br label %26
14: ; preds = %3
store float 0x4001AE1480000000, float* %4
br label %26
15: ; preds = %3
store float 0x3FF1745D20000000, float* %4
br label %26
16: ; preds = %3
store float 0x3FED1745E0000000, float* %4
br label %26
17: ; preds = %3
store float 0x3FF745D180000000, float* %4
br label %26
18: ; preds = %3
store float 0x3FF364D940000000, float* %4
br label %26
19: ; preds = %3
%20 = load i64, i64* %6
%21 = sitofp i64 %20 to float
%22 = load i64, i64* %7
%23 = sitofp i64 %22 to float
%24 = fdiv float %21, %23
store float %24, float* %4
br label %26
25: ; preds = %3
store float 0.000000e+00, float* %4
br label %26
26: ; preds = %25, %19, %18, %17, %16, %15, %14, %13, %12, %11
%27 = load float, float* %4
ret float %27
}

LLVM IR (-O2):
define float @Mepg2AspectRatio(i8 zeroext %0, i64 %1, i64 %2) {
%4 = and i8 %0, 15
%5 = zext i8 %4 to i32
switch i32 %5, label %17 [
i32 1, label %18
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 5, label %9
i32 6, label %10
i32 7, label %11
i32 8, label %12
i32 15, label %13
]
6: ; preds = %3
br label %18
7: ; preds = %3
br label %18
8: ; preds = %3
br label %18
9: ; preds = %3
br label %18
10: ; preds = %3
br label %18
11: ; preds = %3
br label %18
12: ; preds = %3
br label %18
13: ; preds = %3
%14 = sitofp i64 %1 to float
%15 = sitofp i64 %2 to float
%16 = fdiv float %14, %15
br label %18
17: ; preds = %3
br label %18
18: ; preds = %3, %17, %13, %12, %11, %10, %9, %8, %7, %6
%19 = phi float [ 0.000000e+00, %17 ], [ %16, %13 ], [ 0x3FF364D940000000, %12 ], [ 0x3FF745D180000000, %11 ], [ 0x3FED1745E0000000, %10 ], [ 0x3FF1745D20000000, %9 ], [ 0x4001AE1480000000, %8 ], [ 0x3FFC71C720000000, %7 ], [ 0x3FF5555560000000, %6 ], [ 1.000000e+00, %3 ]
ret float %19
}