unsigned int mel_get_device_type(unsigned int dev_code) {
  unsigned int dtype = (0);
  switch (dev_code) {
  case 0x90:
    dtype = (1 << 0);
    break;
  case 0x98:
    dtype = (1 << 1);
    break;
  case 0x9C:
    dtype = (1 << 2);
    break;
  case 0x9D:
    dtype = (1 << 3);
    break;
  case 0xC2:
    dtype = (1 << 4);
    break;
  case 0xC5:
    dtype = (1 << 5);
    break;
  case 0xA8:
    dtype = (1 << 6);
    break;
  case 0xAE:
    dtype = (1 << 8);
    break;
  case 0xAF:
    dtype = (1 << 7);
    break;
  case 0xD8:
    dtype = (1 << 26);
    break;
  case 0xF0:
    dtype = (1 << 9);
    break;
  case 0xCC:
    dtype = (1 << 13);
    break;
  case 0xF1:
    dtype = (1 << 10);
    break;
  case 0xF2:
    dtype = (1 << 11);
    break;
  case 0xF4:
    dtype = (1 << 12);
    break;
  case 0xCD:
    dtype = (1 << 14);
    break;
  case 0xF8:
    dtype = (1 << 23);
    break;
  case 0xAB:
    dtype = (1 << 24);
    break;
  case 0xE8:
    dtype = (1 << 15);
    break;
  case 0xE9:
    dtype = (1 << 16);
    break;
  case 0xEA:
    dtype = (1 << 17);
    break;
  case 0xD0:
    dtype = (1 << 20);
    break;
  case 0xD1:
    dtype = (1 << 21);
    break;
  case 0xD2:
    dtype = (1 << 22);
    break;
  case 0xEB:
    dtype = (1 << 18);
    break;
  case 0xEC:
    dtype = (1 << 19);
    break;
  case 0xEE:
    dtype = (1 << 25);
    break;
  }
  return (dtype);
}


x86 assembly (clang, -O0):
<mel_get_device_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff70,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x68,%eax
ja     1278 <mel_get_device_type+0x178>
mov    -0x10(%rbp),%rax
lea    0xed0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x2,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x4,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x8,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x10,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x20,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x40,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x100,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x80,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x4000000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x200,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x2000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x400,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x800,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x1000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x4000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x800000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x1000000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x8000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x10000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x20000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x100000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x200000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x400000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x40000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x80000,-0x8(%rbp)
jmp    1278 <mel_get_device_type+0x178>
movl   $0x2000000,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mel_get_device_type>:
xor    %eax,%eax
add    $0xffffff70,%edi
cmp    $0x68,%edi
ja     11a4 <mel_get_device_type+0xa4>
lea    0xee8(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x1,%eax
ret
mov    $0x2,%eax
ret
mov    $0x4,%eax
ret
mov    $0x8,%eax
ret
mov    $0x40,%eax
ret
mov    $0x1000000,%eax
ret
mov    $0x100,%eax
ret
mov    $0x80,%eax
ret
mov    $0x10,%eax
ret
mov    $0x20,%eax
ret
mov    $0x2000,%eax
ret
mov    $0x4000,%eax
ret
mov    $0x100000,%eax
ret
mov    $0x200000,%eax
ret
mov    $0x400000,%eax
ret
mov    $0x4000000,%eax
ret
mov    $0x8000,%eax
ret
mov    $0x10000,%eax
ret
mov    $0x20000,%eax
ret
mov    $0x40000,%eax
ret
mov    $0x80000,%eax
ret
mov    $0x2000000,%eax
ret
mov    $0x200,%eax
ret
mov    $0x400,%eax
ret
mov    $0x800,%eax
ret
mov    $0x1000,%eax
ret
mov    $0x800000,%eax
ret

LLVM IR (-O0):
define i32 @mel_get_device_type(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %32 [
i32 144, label %5
i32 152, label %6
i32 156, label %7
i32 157, label %8
i32 194, label %9
i32 197, label %10
i32 168, label %11
i32 174, label %12
i32 175, label %13
i32 216, label %14
i32 240, label %15
i32 204, label %16
i32 241, label %17
i32 242, label %18
i32 244, label %19
i32 205, label %20
i32 248, label %21
i32 171, label %22
i32 232, label %23
i32 233, label %24
i32 234, label %25
i32 208, label %26
i32 209, label %27
i32 210, label %28
i32 235, label %29
i32 236, label %30
i32 238, label %31
]
5: ; preds = %1
store i32 1, i32* %3
br label %32
6: ; preds = %1
store i32 2, i32* %3
br label %32
7: ; preds = %1
store i32 4, i32* %3
br label %32
8: ; preds = %1
store i32 8, i32* %3
br label %32
9: ; preds = %1
store i32 16, i32* %3
br label %32
10: ; preds = %1
store i32 32, i32* %3
br label %32
11: ; preds = %1
store i32 64, i32* %3
br label %32
12: ; preds = %1
store i32 256, i32* %3
br label %32
13: ; preds = %1
store i32 128, i32* %3
br label %32
14: ; preds = %1
store i32 67108864, i32* %3
br label %32
15: ; preds = %1
store i32 512, i32* %3
br label %32
16: ; preds = %1
store i32 8192, i32* %3
br label %32
17: ; preds = %1
store i32 1024, i32* %3
br label %32
18: ; preds = %1
store i32 2048, i32* %3
br label %32
19: ; preds = %1
store i32 4096, i32* %3
br label %32
20: ; preds = %1
store i32 16384, i32* %3
br label %32
21: ; preds = %1
store i32 8388608, i32* %3
br label %32
22: ; preds = %1
store i32 16777216, i32* %3
br label %32
23: ; preds = %1
store i32 32768, i32* %3
br label %32
24: ; preds = %1
store i32 65536, i32* %3
br label %32
25: ; preds = %1
store i32 131072, i32* %3
br label %32
26: ; preds = %1
store i32 1048576, i32* %3
br label %32
27: ; preds = %1
store i32 2097152, i32* %3
br label %32
28: ; preds = %1
store i32 4194304, i32* %3
br label %32
29: ; preds = %1
store i32 262144, i32* %3
br label %32
30: ; preds = %1
store i32 524288, i32* %3
br label %32
31: ; preds = %1
store i32 33554432, i32* %3
br label %32
32: ; preds = %1, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @mel_get_device_type(i32 %0) {
switch i32 %0, label %29 [
i32 144, label %2
i32 152, label %3
i32 156, label %4
i32 157, label %5
i32 194, label %6
i32 197, label %7
i32 168, label %8
i32 174, label %9
i32 175, label %10
i32 216, label %11
i32 240, label %12
i32 204, label %13
i32 241, label %14
i32 242, label %15
i32 244, label %16
i32 205, label %17
i32 248, label %18
i32 171, label %19
i32 232, label %20
i32 233, label %21
i32 234, label %22
i32 208, label %23
i32 209, label %24
i32 210, label %25
i32 235, label %26
i32 236, label %27
i32 238, label %28
]
2: ; preds = %1
br label %29
3: ; preds = %1
br label %29
4: ; preds = %1
br label %29
5: ; preds = %1
br label %29
6: ; preds = %1
br label %29
7: ; preds = %1
br label %29
8: ; preds = %1
br label %29
9: ; preds = %1
br label %29
10: ; preds = %1
br label %29
11: ; preds = %1
br label %29
12: ; preds = %1
br label %29
13: ; preds = %1
br label %29
14: ; preds = %1
br label %29
15: ; preds = %1
br label %29
16: ; preds = %1
br label %29
17: ; preds = %1
br label %29
18: ; preds = %1
br label %29
19: ; preds = %1
br label %29
20: ; preds = %1
br label %29
21: ; preds = %1
br label %29
22: ; preds = %1
br label %29
23: ; preds = %1
br label %29
24: ; preds = %1
br label %29
25: ; preds = %1
br label %29
26: ; preds = %1
br label %29
27: ; preds = %1
br label %29
28: ; preds = %1
br label %29
29: ; preds = %1, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%30 = phi i32 [ 0, %1 ], [ 33554432, %28 ], [ 524288, %27 ], [ 262144, %26 ], [ 4194304, %25 ], [ 2097152, %24 ], [ 1048576, %23 ], [ 131072, %22 ], [ 65536, %21 ], [ 32768, %20 ], [ 16777216, %19 ], [ 8388608, %18 ], [ 16384, %17 ], [ 4096, %16 ], [ 2048, %15 ], [ 1024, %14 ], [ 8192, %13 ], [ 512, %12 ], [ 67108864, %11 ], [ 128, %10 ], [ 256, %9 ], [ 64, %8 ], [ 32, %7 ], [ 16, %6 ], [ 8, %5 ], [ 4, %4 ], [ 2, %3 ], [ 1, %2 ]
ret i32 %30
}