int cvmx_db_get_chipindex(int identifier) {
  switch (identifier & 0xffff00) {
  case 0x000d0600:
    return 8;
  case 0x000d0400:
    return 7;
  case 0x000d0300:
    return 5;
  case 0x000d0000:
    return 3;
  case 0x000d0100:
    return 1;
  case 0x000d0200:
    return 2;
  case 0x000d0700:
    return 10;
  case 0x000d9000:
    return 11;
  }
  switch (identifier) {
  case 0x0003177d:
    return 0;
  case 0x0004177d:
    return 0;
  case 0x0005177d:
    return 3;
  case 0x1001177d:
    return 3;
  case 0x0020177d:
    return 1;
  case 0x0030177d:
    return 2;
  case 0x0040177d:
    return 5;
  case 0x0050177d:
    return 7;
  case 0x0070177d:
    return 8;
  case 0x0080177d:
    return 10;
  case 0x0090177d:
    return 11;
  }
  return 3;
}


x86 assembly (clang, -O0):
<cvmx_db_get_chipindex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movzwl -0x7(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
sub    $0xd0000,%eax
je     11ca <cvmx_db_get_chipindex+0xca>
jmp    1121 <cvmx_db_get_chipindex+0x21>
mov    -0xc(%rbp),%eax
sub    $0xd0100,%eax
je     11d6 <cvmx_db_get_chipindex+0xd6>
jmp    1134 <cvmx_db_get_chipindex+0x34>
mov    -0xc(%rbp),%eax
sub    $0xd0200,%eax
je     11e2 <cvmx_db_get_chipindex+0xe2>
jmp    1147 <cvmx_db_get_chipindex+0x47>
mov    -0xc(%rbp),%eax
sub    $0xd0300,%eax
je     11be <cvmx_db_get_chipindex+0xbe>
jmp    115a <cvmx_db_get_chipindex+0x5a>
mov    -0xc(%rbp),%eax
sub    $0xd0400,%eax
je     11b2 <cvmx_db_get_chipindex+0xb2>
jmp    116d <cvmx_db_get_chipindex+0x6d>
mov    -0xc(%rbp),%eax
sub    $0xd0600,%eax
je     11a6 <cvmx_db_get_chipindex+0xa6>
jmp    1180 <cvmx_db_get_chipindex+0x80>
mov    -0xc(%rbp),%eax
sub    $0xd0700,%eax
je     11ee <cvmx_db_get_chipindex+0xee>
jmp    1193 <cvmx_db_get_chipindex+0x93>
mov    -0xc(%rbp),%eax
sub    $0xd9000,%eax
je     11fa <cvmx_db_get_chipindex+0xfa>
jmp    1206 <cvmx_db_get_chipindex+0x106>
movl   $0x8,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x7,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x5,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x3,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x1,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x2,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0xa,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0xb,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x3177d,%eax
je     12da <cvmx_db_get_chipindex+0x1da>
jmp    121c <cvmx_db_get_chipindex+0x11c>
mov    -0x10(%rbp),%eax
sub    $0x4177d,%eax
je     12e6 <cvmx_db_get_chipindex+0x1e6>
jmp    122f <cvmx_db_get_chipindex+0x12f>
mov    -0x10(%rbp),%eax
sub    $0x5177d,%eax
je     12f2 <cvmx_db_get_chipindex+0x1f2>
jmp    1242 <cvmx_db_get_chipindex+0x142>
mov    -0x10(%rbp),%eax
sub    $0x20177d,%eax
je     130a <cvmx_db_get_chipindex+0x20a>
jmp    1255 <cvmx_db_get_chipindex+0x155>
mov    -0x10(%rbp),%eax
sub    $0x30177d,%eax
je     1316 <cvmx_db_get_chipindex+0x216>
jmp    1268 <cvmx_db_get_chipindex+0x168>
mov    -0x10(%rbp),%eax
sub    $0x40177d,%eax
je     1322 <cvmx_db_get_chipindex+0x222>
jmp    127b <cvmx_db_get_chipindex+0x17b>
mov    -0x10(%rbp),%eax
sub    $0x50177d,%eax
je     132e <cvmx_db_get_chipindex+0x22e>
jmp    128e <cvmx_db_get_chipindex+0x18e>
mov    -0x10(%rbp),%eax
sub    $0x70177d,%eax
je     133a <cvmx_db_get_chipindex+0x23a>
jmp    12a1 <cvmx_db_get_chipindex+0x1a1>
mov    -0x10(%rbp),%eax
sub    $0x80177d,%eax
je     1346 <cvmx_db_get_chipindex+0x246>
jmp    12b4 <cvmx_db_get_chipindex+0x1b4>
mov    -0x10(%rbp),%eax
sub    $0x90177d,%eax
je     1352 <cvmx_db_get_chipindex+0x252>
jmp    12c7 <cvmx_db_get_chipindex+0x1c7>
mov    -0x10(%rbp),%eax
sub    $0x1001177d,%eax
je     12fe <cvmx_db_get_chipindex+0x1fe>
jmp    135e <cvmx_db_get_chipindex+0x25e>
movl   $0x0,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x0,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x3,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x3,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x1,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x2,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x5,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x7,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x8,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0xa,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0xb,-0x4(%rbp)
jmp    1365 <cvmx_db_get_chipindex+0x265>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvmx_db_get_chipindex>:
mov    %edi,%ecx
and    $0xffff00,%ecx
mov    $0x8,%eax
cmp    $0xd03ff,%ecx
jg     1137 <cvmx_db_get_chipindex+0x37>
cmp    $0xd01ff,%ecx
jg     1150 <cvmx_db_get_chipindex+0x50>
cmp    $0xd0000,%ecx
je     11f0 <cvmx_db_get_chipindex+0xf0>
cmp    $0xd0100,%ecx
jne    1180 <cvmx_db_get_chipindex+0x80>
mov    $0x1,%eax
ret
cmp    $0xd06ff,%ecx
jg     1166 <cvmx_db_get_chipindex+0x66>
cmp    $0xd0400,%ecx
je     11aa <cvmx_db_get_chipindex+0xaa>
cmp    $0xd0600,%ecx
jne    1180 <cvmx_db_get_chipindex+0x80>
ret
cmp    $0xd0200,%ecx
je     11d4 <cvmx_db_get_chipindex+0xd4>
cmp    $0xd0300,%ecx
jne    1180 <cvmx_db_get_chipindex+0x80>
mov    $0x5,%eax
ret
cmp    $0xd0700,%ecx
je     11f6 <cvmx_db_get_chipindex+0xf6>
cmp    $0xd9000,%ecx
jne    1180 <cvmx_db_get_chipindex+0x80>
mov    $0xb,%eax
ret
cmp    $0x40177c,%edi
jle    11b0 <cvmx_db_get_chipindex+0xb0>
cmp    $0x80177c,%edi
jg     11da <cvmx_db_get_chipindex+0xda>
cmp    $0x40177d,%edi
je     1160 <cvmx_db_get_chipindex+0x60>
cmp    $0x50177d,%edi
je     11aa <cvmx_db_get_chipindex+0xaa>
cmp    $0x70177d,%edi
je     114f <cvmx_db_get_chipindex+0x4f>
jmp    11f0 <cvmx_db_get_chipindex+0xf0>
mov    $0x7,%eax
ret
cmp    $0x5177c,%edi
jle    11fc <cvmx_db_get_chipindex+0xfc>
cmp    $0x5177d,%edi
je     11f0 <cvmx_db_get_chipindex+0xf0>
cmp    $0x20177d,%edi
je     1131 <cvmx_db_get_chipindex+0x31>
cmp    $0x30177d,%edi
jne    11f0 <cvmx_db_get_chipindex+0xf0>
mov    $0x2,%eax
ret
cmp    $0x80177d,%edi
je     11f6 <cvmx_db_get_chipindex+0xf6>
cmp    $0x90177d,%edi
je     117a <cvmx_db_get_chipindex+0x7a>
cmp    $0x1001177d,%edi
mov    $0x3,%eax
ret
mov    $0xa,%eax
ret
xor    %eax,%eax
cmp    $0x3177d,%edi
je     114f <cvmx_db_get_chipindex+0x4f>
cmp    $0x4177d,%edi
je     114f <cvmx_db_get_chipindex+0x4f>
jmp    11f0 <cvmx_db_get_chipindex+0xf0>

LLVM IR (-O0):
define i32 @cvmx_db_get_chipindex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 16776960
switch i32 %5, label %14 [
i32 853504, label %6
i32 852992, label %7
i32 852736, label %8
i32 851968, label %9
i32 852224, label %10
i32 852480, label %11
i32 853760, label %12
i32 888832, label %13
]
6: ; preds = %1
store i32 8, i32* %2
br label %28
7: ; preds = %1
store i32 7, i32* %2
br label %28
8: ; preds = %1
store i32 5, i32* %2
br label %28
9: ; preds = %1
store i32 3, i32* %2
br label %28
10: ; preds = %1
store i32 1, i32* %2
br label %28
11: ; preds = %1
store i32 2, i32* %2
br label %28
12: ; preds = %1
store i32 10, i32* %2
br label %28
13: ; preds = %1
store i32 11, i32* %2
br label %28
14: ; preds = %1
%15 = load i32, i32* %3
switch i32 %15, label %27 [
i32 202621, label %16
i32 268157, label %17
i32 333693, label %18
i32 268507005, label %19
i32 2103165, label %20
i32 3151741, label %21
i32 4200317, label %22
i32 5248893, label %23
i32 7346045, label %24
i32 8394621, label %25
i32 9443197, label %26
]
16: ; preds = %14
store i32 0, i32* %2
br label %28
17: ; preds = %14
store i32 0, i32* %2
br label %28
18: ; preds = %14
store i32 3, i32* %2
br label %28
19: ; preds = %14
store i32 3, i32* %2
br label %28
20: ; preds = %14
store i32 1, i32* %2
br label %28
21: ; preds = %14
store i32 2, i32* %2
br label %28
22: ; preds = %14
store i32 5, i32* %2
br label %28
23: ; preds = %14
store i32 7, i32* %2
br label %28
24: ; preds = %14
store i32 8, i32* %2
br label %28
25: ; preds = %14
store i32 10, i32* %2
br label %28
26: ; preds = %14
store i32 11, i32* %2
br label %28
27: ; preds = %14
store i32 3, i32* %2
br label %28
28: ; preds = %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %13, %12, %11, %10, %9, %8, %7, %6
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @cvmx_db_get_chipindex(i32 %0) {
%2 = and i32 %0, 16776960
switch i32 %2, label %10 [
i32 853504, label %21
i32 852992, label %3
i32 852736, label %4
i32 851968, label %5
i32 852224, label %6
i32 852480, label %7
i32 853760, label %8
i32 888832, label %9
]
3: ; preds = %1
br label %21
4: ; preds = %1
br label %21
5: ; preds = %1
br label %21
6: ; preds = %1
br label %21
7: ; preds = %1
br label %21
8: ; preds = %1
br label %21
9: ; preds = %1
br label %21
10: ; preds = %1
switch i32 %0, label %20 [
i32 202621, label %21
i32 268157, label %21
i32 333693, label %11
i32 268507005, label %12
i32 2103165, label %13
i32 3151741, label %14
i32 4200317, label %15
i32 5248893, label %16
i32 7346045, label %17
i32 8394621, label %18
i32 9443197, label %19
]
11: ; preds = %10
br label %21
12: ; preds = %10
br label %21
13: ; preds = %10
br label %21
14: ; preds = %10
br label %21
15: ; preds = %10
br label %21
16: ; preds = %10
br label %21
17: ; preds = %10
br label %21
18: ; preds = %10
br label %21
19: ; preds = %10
br label %21
20: ; preds = %10
br label %21
21: ; preds = %10, %10, %1, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %9, %8, %7, %6, %5, %4, %3
%22 = phi i32 [ 3, %20 ], [ 11, %19 ], [ 10, %18 ], [ 8, %17 ], [ 7, %16 ], [ 5, %15 ], [ 2, %14 ], [ 1, %13 ], [ 3, %12 ], [ 3, %11 ], [ 11, %9 ], [ 10, %8 ], [ 2, %7 ], [ 1, %6 ], [ 3, %5 ], [ 5, %4 ], [ 7, %3 ], [ 8, %1 ], [ 0, %10 ], [ 0, %10 ]
ret i32 %22
}