int sample_rate_idx(int rate) {
  if (92017 <= rate)
    return 0;
  else if (75132 <= rate)
    return 1;
  else if (55426 <= rate)
    return 2;
  else if (46009 <= rate)
    return 3;
  else if (37566 <= rate)
    return 4;
  else if (27713 <= rate)
    return 5;
  else if (23004 <= rate)
    return 6;
  else if (18783 <= rate)
    return 7;
  else if (13856 <= rate)
    return 8;
  else if (11502 <= rate)
    return 9;
  else if (9391 <= rate)
    return 10;
  else
    return 11;
}


x86 assembly (clang, -O0):
<sample_rate_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    $0x16771,%eax
cmp    -0x8(%rbp),%eax
jg     1121 <sample_rate_idx+0x21>
movl   $0x0,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x1257c,%eax
cmp    -0x8(%rbp),%eax
jg     113b <sample_rate_idx+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0xd882,%eax
cmp    -0x8(%rbp),%eax
jg     1155 <sample_rate_idx+0x55>
movl   $0x2,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0xb3b9,%eax
cmp    -0x8(%rbp),%eax
jg     116f <sample_rate_idx+0x6f>
movl   $0x3,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x92be,%eax
cmp    -0x8(%rbp),%eax
jg     1189 <sample_rate_idx+0x89>
movl   $0x4,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x6c41,%eax
cmp    -0x8(%rbp),%eax
jg     11a3 <sample_rate_idx+0xa3>
movl   $0x5,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x59dc,%eax
cmp    -0x8(%rbp),%eax
jg     11bd <sample_rate_idx+0xbd>
movl   $0x6,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x495f,%eax
cmp    -0x8(%rbp),%eax
jg     11d7 <sample_rate_idx+0xd7>
movl   $0x7,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x3620,%eax
cmp    -0x8(%rbp),%eax
jg     11f1 <sample_rate_idx+0xf1>
movl   $0x8,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x2cee,%eax
cmp    -0x8(%rbp),%eax
jg     120b <sample_rate_idx+0x10b>
movl   $0x9,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
mov    $0x24af,%eax
cmp    -0x8(%rbp),%eax
jg     1225 <sample_rate_idx+0x125>
movl   $0xa,-0x4(%rbp)
jmp    122c <sample_rate_idx+0x12c>
movl   $0xb,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample_rate_idx>:
xor    %eax,%eax
cmp    $0x16770,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x1,%eax
cmp    $0x1257b,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x2,%eax
cmp    $0xd881,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x3,%eax
cmp    $0xb3b8,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x4,%eax
cmp    $0x92bd,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x5,%eax
cmp    $0x6c40,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x6,%eax
cmp    $0x59db,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x7,%eax
cmp    $0x495e,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x8,%eax
cmp    $0x361f,%edi
jg     1191 <sample_rate_idx+0x91>
mov    $0x9,%eax
cmp    $0x2ced,%edi
jg     1191 <sample_rate_idx+0x91>
xor    %eax,%eax
cmp    $0x24af,%edi
setge  %al
xor    $0xb,%eax
ret

LLVM IR (-O0):
define i32 @sample_rate_idx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 92017, %4
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %48
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sle i32 75132, %8
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %2
br label %48
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp sle i32 55426, %12
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 2, i32* %2
br label %48
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp sle i32 46009, %16
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 3, i32* %2
br label %48
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp sle i32 37566, %20
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 4, i32* %2
br label %48
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp sle i32 27713, %24
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 5, i32* %2
br label %48
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp sle i32 23004, %28
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 6, i32* %2
br label %48
31: ; preds = %27
%32 = load i32, i32* %3
%33 = icmp sle i32 18783, %32
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 7, i32* %2
br label %48
35: ; preds = %31
%36 = load i32, i32* %3
%37 = icmp sle i32 13856, %36
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 8, i32* %2
br label %48
39: ; preds = %35
%40 = load i32, i32* %3
%41 = icmp sle i32 11502, %40
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 9, i32* %2
br label %48
43: ; preds = %39
%44 = load i32, i32* %3
%45 = icmp sle i32 9391, %44
br i1 %45, label %46, label %47
46: ; preds = %43
store i32 10, i32* %2
br label %48
47: ; preds = %43
store i32 11, i32* %2
br label %48
48: ; preds = %47, %46, %42, %38, %34, %30, %26, %22, %18, %14, %10, %6
%49 = load i32, i32* %2
ret i32 %49
}

LLVM IR (-O2):
define i32 @sample_rate_idx(i32 %0) {
%2 = icmp sgt i32 %0, 92016
br i1 %2, label %24, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 75131
br i1 %4, label %24, label %5
5: ; preds = %3
%6 = icmp sgt i32 %0, 55425
br i1 %6, label %24, label %7
7: ; preds = %5
%8 = icmp sgt i32 %0, 46008
br i1 %8, label %24, label %9
9: ; preds = %7
%10 = icmp sgt i32 %0, 37565
br i1 %10, label %24, label %11
11: ; preds = %9
%12 = icmp sgt i32 %0, 27712
br i1 %12, label %24, label %13
13: ; preds = %11
%14 = icmp sgt i32 %0, 23003
br i1 %14, label %24, label %15
15: ; preds = %13
%16 = icmp sgt i32 %0, 18782
br i1 %16, label %24, label %17
17: ; preds = %15
%18 = icmp sgt i32 %0, 13855
br i1 %18, label %24, label %19
19: ; preds = %17
%20 = icmp sgt i32 %0, 11501
br i1 %20, label %24, label %21
21: ; preds = %19
%22 = icmp sgt i32 %0, 9390
%23 = select i1 %22, i32 10, i32 11
br label %24
24: ; preds = %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
%25 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 2, %5 ], [ 3, %7 ], [ 4, %9 ], [ 5, %11 ], [ 6, %13 ], [ 7, %15 ], [ 8, %17 ], [ 9, %19 ], [ %23, %21 ]
ret i32 %25
}