int wlan_rate_to_rate(int idx) {
  switch (idx) {
  case 12:
    return 540;
  case 11:
    return 480;
  case 10:
    return 360;
  case 9:
    return 240;
  case 8:
    return 180;
  case 7:
    return 120;
  case 6:
    return 110;
  case 5:
    return 90;
  case 4:
    return 60;
  case 3:
    return 55;
  case 2:
    return 20;
  case 1:
    return 10;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<wlan_rate_to_rate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xb,%eax
ja     11c0 <wlan_rate_to_rate+0xc0>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x21c,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x1e0,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x168,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0xf0,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0xb4,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x78,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x6e,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x5a,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x3c,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x37,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x14,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0xa,-0x4(%rbp)
jmp    11c7 <wlan_rate_to_rate+0xc7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wlan_rate_to_rate>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0xb,%edi
ja     1117 <wlan_rate_to_rate+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @wlan_rate_to_rate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %17 [
i32 12, label %5
i32 11, label %6
i32 10, label %7
i32 9, label %8
i32 8, label %9
i32 7, label %10
i32 6, label %11
i32 5, label %12
i32 4, label %13
i32 3, label %14
i32 2, label %15
i32 1, label %16
]
5: ; preds = %1
store i32 540, i32* %2
br label %18
6: ; preds = %1
store i32 480, i32* %2
br label %18
7: ; preds = %1
store i32 360, i32* %2
br label %18
8: ; preds = %1
store i32 240, i32* %2
br label %18
9: ; preds = %1
store i32 180, i32* %2
br label %18
10: ; preds = %1
store i32 120, i32* %2
br label %18
11: ; preds = %1
store i32 110, i32* %2
br label %18
12: ; preds = %1
store i32 90, i32* %2
br label %18
13: ; preds = %1
store i32 60, i32* %2
br label %18
14: ; preds = %1
store i32 55, i32* %2
br label %18
15: ; preds = %1
store i32 20, i32* %2
br label %18
16: ; preds = %1
store i32 10, i32* %2
br label %18
17: ; preds = %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@switch.table.wlan_rate_to_rate = [12 x i32] [i32 10, i32 20, i32 55, i32 60, i32 90, i32 110, i32 120, i32 180, i32 240, i32 360, i32 480, i32 540]
define i32 @wlan_rate_to_rate(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 12
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [12 x i32], [12 x i32]* @switch.table.wlan_rate_to_rate, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}