int audio_out_format_bits(int format) {
  switch (format) {
  case 0x00000010:
  case 0x00000020:
  case 0x00000080:
  case 0x00000100:
    return 16;
  case 0x00008000:
  case 0x00010000:
  case 0x00020000:
  case 0x00040000:
  case 0x00100000:
    return 32;
  case 0x00000800:
  case 0x00001000:
  case 0x00002000:
  case 0x00004000:
    return 24;
  case 0x00000001:
  case 0x00000002:
  case 0x00000004:
  case 0x00000040:
  case 0x00000008:
  case 0x00000200:
  case 0x00000400:
  default:
    return 8;
  }
  return 8;
}


x86 assembly (clang, -O0):
<audio_out_format_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     128e <audio_out_format_bits+0x18e>
jmp    111e <audio_out_format_bits+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     128e <audio_out_format_bits+0x18e>
jmp    112f <audio_out_format_bits+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     128e <audio_out_format_bits+0x18e>
jmp    1140 <audio_out_format_bits+0x40>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
je     126a <audio_out_format_bits+0x16a>
jmp    1151 <audio_out_format_bits+0x51>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     126a <audio_out_format_bits+0x16a>
jmp    1162 <audio_out_format_bits+0x62>
mov    -0xc(%rbp),%eax
sub    $0x40,%eax
je     128e <audio_out_format_bits+0x18e>
jmp    1173 <audio_out_format_bits+0x73>
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
je     126a <audio_out_format_bits+0x16a>
jmp    1186 <audio_out_format_bits+0x86>
mov    -0xc(%rbp),%eax
sub    $0x100,%eax
je     126a <audio_out_format_bits+0x16a>
jmp    1199 <audio_out_format_bits+0x99>
mov    -0xc(%rbp),%eax
sub    $0x200,%eax
je     128e <audio_out_format_bits+0x18e>
jmp    11ac <audio_out_format_bits+0xac>
mov    -0xc(%rbp),%eax
sub    $0x400,%eax
je     128e <audio_out_format_bits+0x18e>
jmp    11bf <audio_out_format_bits+0xbf>
mov    -0xc(%rbp),%eax
sub    $0x800,%eax
je     1282 <audio_out_format_bits+0x182>
jmp    11d2 <audio_out_format_bits+0xd2>
mov    -0xc(%rbp),%eax
sub    $0x1000,%eax
je     1282 <audio_out_format_bits+0x182>
jmp    11e5 <audio_out_format_bits+0xe5>
mov    -0xc(%rbp),%eax
sub    $0x2000,%eax
je     1282 <audio_out_format_bits+0x182>
jmp    11f8 <audio_out_format_bits+0xf8>
mov    -0xc(%rbp),%eax
sub    $0x4000,%eax
je     1282 <audio_out_format_bits+0x182>
jmp    120b <audio_out_format_bits+0x10b>
mov    -0xc(%rbp),%eax
sub    $0x8000,%eax
je     1276 <audio_out_format_bits+0x176>
jmp    121e <audio_out_format_bits+0x11e>
mov    -0xc(%rbp),%eax
sub    $0x10000,%eax
je     1276 <audio_out_format_bits+0x176>
jmp    1231 <audio_out_format_bits+0x131>
mov    -0xc(%rbp),%eax
sub    $0x20000,%eax
je     1276 <audio_out_format_bits+0x176>
jmp    1244 <audio_out_format_bits+0x144>
mov    -0xc(%rbp),%eax
sub    $0x40000,%eax
je     1276 <audio_out_format_bits+0x176>
jmp    1257 <audio_out_format_bits+0x157>
mov    -0xc(%rbp),%eax
sub    $0x100000,%eax
je     1276 <audio_out_format_bits+0x176>
jmp    1293 <audio_out_format_bits+0x193>
movl   $0x10,-0x4(%rbp)
jmp    129a <audio_out_format_bits+0x19a>
movl   $0x20,-0x4(%rbp)
jmp    129a <audio_out_format_bits+0x19a>
movl   $0x18,-0x4(%rbp)
jmp    129a <audio_out_format_bits+0x19a>
jmp    1293 <audio_out_format_bits+0x193>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<audio_out_format_bits>:
cmp    $0x1fff,%edi
jle    112a <audio_out_format_bits+0x2a>
cmp    $0xffff,%edi
jle    114a <audio_out_format_bits+0x4a>
cmp    $0x3ffff,%edi
jg     1182 <audio_out_format_bits+0x82>
cmp    $0x10000,%edi
je     1192 <audio_out_format_bits+0x92>
cmp    $0x20000,%edi
je     1192 <audio_out_format_bits+0x92>
jmp    1198 <audio_out_format_bits+0x98>
mov    $0x10,%eax
cmp    $0xff,%edi
jg     1164 <audio_out_format_bits+0x64>
cmp    $0x10,%edi
je     1149 <audio_out_format_bits+0x49>
cmp    $0x20,%edi
je     1149 <audio_out_format_bits+0x49>
cmp    $0x80,%edi
jne    1198 <audio_out_format_bits+0x98>
ret
cmp    $0x2000,%edi
je     117c <audio_out_format_bits+0x7c>
cmp    $0x4000,%edi
je     117c <audio_out_format_bits+0x7c>
cmp    $0x8000,%edi
je     1192 <audio_out_format_bits+0x92>
jmp    1198 <audio_out_format_bits+0x98>
cmp    $0x100,%edi
je     1149 <audio_out_format_bits+0x49>
cmp    $0x800,%edi
je     117c <audio_out_format_bits+0x7c>
cmp    $0x1000,%edi
jne    1198 <audio_out_format_bits+0x98>
mov    $0x18,%eax
ret
cmp    $0x100000,%edi
je     1192 <audio_out_format_bits+0x92>
cmp    $0x40000,%edi
jne    1198 <audio_out_format_bits+0x98>
mov    $0x20,%eax
ret
mov    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @audio_out_format_bits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 16, label %5
i32 32, label %5
i32 128, label %5
i32 256, label %5
i32 32768, label %6
i32 65536, label %6
i32 131072, label %6
i32 262144, label %6
i32 1048576, label %6
i32 2048, label %7
i32 4096, label %7
i32 8192, label %7
i32 16384, label %7
i32 1, label %8
i32 2, label %8
i32 4, label %8
i32 64, label %8
i32 8, label %8
i32 512, label %8
i32 1024, label %8
]
5: ; preds = %1, %1, %1, %1
store i32 16, i32* %2
br label %10
6: ; preds = %1, %1, %1, %1, %1
store i32 32, i32* %2
br label %10
7: ; preds = %1, %1, %1, %1
store i32 24, i32* %2
br label %10
8: ; preds = %1, %1, %1, %1, %1, %1, %1
br label %9
9: ; preds = %1, %8
store i32 8, i32* %2
br label %10
10: ; preds = %9, %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @audio_out_format_bits(i32 %0) {
switch i32 %0, label %4 [
i32 16, label %5
i32 32, label %5
i32 128, label %5
i32 256, label %5
i32 32768, label %2
i32 65536, label %2
i32 131072, label %2
i32 262144, label %2
i32 1048576, label %2
i32 2048, label %3
i32 4096, label %3
i32 8192, label %3
i32 16384, label %3
]
2: ; preds = %1, %1, %1, %1, %1
br label %5
3: ; preds = %1, %1, %1, %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %1, %1, %1, %4, %3, %2
%6 = phi i32 [ 8, %4 ], [ 24, %3 ], [ 32, %2 ], [ 16, %1 ], [ 16, %1 ], [ 16, %1 ], [ 16, %1 ]
ret i32 %6
}