int audio_out_format_bits(int format) {
  switch (format) {
  case 0x00000010:
  case 0x00000020:
  case 0x00000080:
  case 0x00000100:
    return 16;
  case 0x00001000:
    return 32;
  case 0x00002000:
    return 32;
  case 0x00004000:
    return 32;
  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     1228 <audio_out_format_bits+0x128>
jmp    111e <audio_out_format_bits+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     1228 <audio_out_format_bits+0x128>
jmp    112f <audio_out_format_bits+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     1228 <audio_out_format_bits+0x128>
jmp    1140 <audio_out_format_bits+0x40>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
je     11f8 <audio_out_format_bits+0xf8>
jmp    1151 <audio_out_format_bits+0x51>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     11f8 <audio_out_format_bits+0xf8>
jmp    1162 <audio_out_format_bits+0x62>
mov    -0xc(%rbp),%eax
sub    $0x40,%eax
je     1228 <audio_out_format_bits+0x128>
jmp    1173 <audio_out_format_bits+0x73>
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
je     11f8 <audio_out_format_bits+0xf8>
jmp    1186 <audio_out_format_bits+0x86>
mov    -0xc(%rbp),%eax
sub    $0x100,%eax
je     11f8 <audio_out_format_bits+0xf8>
jmp    1199 <audio_out_format_bits+0x99>
mov    -0xc(%rbp),%eax
sub    $0x200,%eax
je     1228 <audio_out_format_bits+0x128>
jmp    11ac <audio_out_format_bits+0xac>
mov    -0xc(%rbp),%eax
sub    $0x400,%eax
je     1228 <audio_out_format_bits+0x128>
jmp    11bf <audio_out_format_bits+0xbf>
mov    -0xc(%rbp),%eax
sub    $0x1000,%eax
je     1204 <audio_out_format_bits+0x104>
jmp    11d2 <audio_out_format_bits+0xd2>
mov    -0xc(%rbp),%eax
sub    $0x2000,%eax
je     1210 <audio_out_format_bits+0x110>
jmp    11e5 <audio_out_format_bits+0xe5>
mov    -0xc(%rbp),%eax
sub    $0x4000,%eax
je     121c <audio_out_format_bits+0x11c>
jmp    122d <audio_out_format_bits+0x12d>
movl   $0x10,-0x4(%rbp)
jmp    1234 <audio_out_format_bits+0x134>
movl   $0x20,-0x4(%rbp)
jmp    1234 <audio_out_format_bits+0x134>
movl   $0x20,-0x4(%rbp)
jmp    1234 <audio_out_format_bits+0x134>
movl   $0x20,-0x4(%rbp)
jmp    1234 <audio_out_format_bits+0x134>
jmp    122d <audio_out_format_bits+0x12d>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<audio_out_format_bits>:
mov    $0x10,%eax
cmp    $0xff,%edi
jle    1127 <audio_out_format_bits+0x27>
cmp    $0x1fff,%edi
jg     113a <audio_out_format_bits+0x3a>
cmp    $0x100,%edi
je     1139 <audio_out_format_bits+0x39>
cmp    $0x1000,%edi
je     114a <audio_out_format_bits+0x4a>
jmp    1150 <audio_out_format_bits+0x50>
cmp    $0x10,%edi
je     1139 <audio_out_format_bits+0x39>
cmp    $0x20,%edi
je     1139 <audio_out_format_bits+0x39>
cmp    $0x80,%edi
jne    1150 <audio_out_format_bits+0x50>
ret
cmp    $0x2000,%edi
je     114a <audio_out_format_bits+0x4a>
cmp    $0x4000,%edi
jne    1150 <audio_out_format_bits+0x50>
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 %10 [
i32 16, label %5
i32 32, label %5
i32 128, label %5
i32 256, label %5
i32 4096, label %6
i32 8192, label %7
i32 16384, label %8
i32 1, label %9
i32 2, label %9
i32 4, label %9
i32 64, label %9
i32 8, label %9
i32 512, label %9
i32 1024, label %9
]
5: ; preds = %1, %1, %1, %1
store i32 16, i32* %2
br label %11
6: ; preds = %1
store i32 32, i32* %2
br label %11
7: ; preds = %1
store i32 32, i32* %2
br label %11
8: ; preds = %1
store i32 32, i32* %2
br label %11
9: ; preds = %1, %1, %1, %1, %1, %1, %1
br label %10
10: ; preds = %1, %9
store i32 8, i32* %2
br label %11
11: ; preds = %10, %8, %7, %6, %5
%12 = load i32, i32* %2
ret i32 %12
}

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