int llz_framelen_choice(int sample_rate) {
  int frame_len;
  switch (sample_rate) {
  case 48000:
    frame_len = 1024;
    break;
  case 44100:
    frame_len = 1024;
    break;
  case 32000:
    frame_len = 1024;
    break;
  case 24000:
    frame_len = 512;
    break;
  case 22050:
    frame_len = 512;
    break;
  case 16000:
    frame_len = 512;
    break;
  case 12000:
    frame_len = 256;
    break;
  case 11025:
    frame_len = 256;
    break;
  case 8000:
    frame_len = 256;
    break;
  }
  return frame_len;
}


x86 assembly (clang, -O0):
<llz_framelen_choice>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1f40,%eax
je     1215 <llz_framelen_choice+0x115>
jmp    111d <llz_framelen_choice+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x2b11,%eax
je     1209 <llz_framelen_choice+0x109>
jmp    1130 <llz_framelen_choice+0x30>
mov    -0xc(%rbp),%eax
sub    $0x2ee0,%eax
je     11fd <llz_framelen_choice+0xfd>
jmp    1143 <llz_framelen_choice+0x43>
mov    -0xc(%rbp),%eax
sub    $0x3e80,%eax
je     11f1 <llz_framelen_choice+0xf1>
jmp    1156 <llz_framelen_choice+0x56>
mov    -0xc(%rbp),%eax
sub    $0x5622,%eax
je     11e5 <llz_framelen_choice+0xe5>
jmp    1169 <llz_framelen_choice+0x69>
mov    -0xc(%rbp),%eax
sub    $0x5dc0,%eax
je     11d9 <llz_framelen_choice+0xd9>
jmp    117c <llz_framelen_choice+0x7c>
mov    -0xc(%rbp),%eax
sub    $0x7d00,%eax
je     11cd <llz_framelen_choice+0xcd>
jmp    118f <llz_framelen_choice+0x8f>
mov    -0xc(%rbp),%eax
sub    $0xac44,%eax
je     11c1 <llz_framelen_choice+0xc1>
jmp    11a2 <llz_framelen_choice+0xa2>
mov    -0xc(%rbp),%eax
sub    $0xbb80,%eax
jne    121c <llz_framelen_choice+0x11c>
jmp    11b5 <llz_framelen_choice+0xb5>
movl   $0x400,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x400,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x400,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x200,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x200,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x200,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x100,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x100,-0x8(%rbp)
jmp    121c <llz_framelen_choice+0x11c>
movl   $0x100,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llz_framelen_choice>:
mov    $0x400,%eax
cmp    $0x3e7f,%edi
jg     112b <llz_framelen_choice+0x2b>
cmp    $0x1f40,%edi
je     1125 <llz_framelen_choice+0x25>
cmp    $0x2b11,%edi
je     1125 <llz_framelen_choice+0x25>
cmp    $0x2ee0,%edi
jne    1148 <llz_framelen_choice+0x48>
mov    $0x100,%eax
ret
cmp    $0x3e80,%edi
je     1143 <llz_framelen_choice+0x43>
cmp    $0x5622,%edi
je     1143 <llz_framelen_choice+0x43>
cmp    $0x5dc0,%edi
jne    1148 <llz_framelen_choice+0x48>
mov    $0x200,%eax
ret

LLVM IR (-O0):
define i32 @llz_framelen_choice(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %14 [
i32 48000, label %5
i32 44100, label %6
i32 32000, label %7
i32 24000, label %8
i32 22050, label %9
i32 16000, label %10
i32 12000, label %11
i32 11025, label %12
i32 8000, label %13
]
5: ; preds = %1
store i32 1024, i32* %3
br label %14
6: ; preds = %1
store i32 1024, i32* %3
br label %14
7: ; preds = %1
store i32 1024, i32* %3
br label %14
8: ; preds = %1
store i32 512, i32* %3
br label %14
9: ; preds = %1
store i32 512, i32* %3
br label %14
10: ; preds = %1
store i32 512, i32* %3
br label %14
11: ; preds = %1
store i32 256, i32* %3
br label %14
12: ; preds = %1
store i32 256, i32* %3
br label %14
13: ; preds = %1
store i32 256, i32* %3
br label %14
14: ; preds = %1, %13, %12, %11, %10, %9, %8, %7, %6, %5
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @llz_framelen_choice(i32 %0) {
switch i32 %0, label %8 [
i32 8000, label %7
i32 11025, label %6
i32 12000, label %5
i32 24000, label %2
i32 22050, label %3
i32 16000, label %4
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3, %2
%9 = phi i32 [ 256, %7 ], [ 256, %6 ], [ 256, %5 ], [ 512, %4 ], [ 512, %3 ], [ 512, %2 ], [ 1024, %1 ]
ret i32 %9
}