#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t hardware_convert_type(uint32_t revision) {
  uint32_t type;
  switch (revision) {
  case 0x2:
  case 0x3:
  case 0x4:
  case 0x5:
  case 0x6:
  case 0xd:
  case 0xe:
  case 0xf:
    type = 2;
    break;
  case 0x7:
  case 0x8:
  case 0x9:
    type = 1;
    break;
  case 0x10:
  case 0x13:
    type = 4;
    break;
  case 0x11:
  case 0x14:
    type = 6;
    break;
  case 0x12:
  case 0x15:
    type = 3;
    break;
  case 0x90092:
  case 0x90093:
    type = 8;
    break;
  case 0xa01040:
  case 0xa01041:
  case 0xa21041:
  case 0xa22042:
    type = 7;
    break;
  case 0xa02082:
  case 0xa22082:
    type = 9;
    break;
  case 0xa020d3:
    type = 10;
    break;
  default:
    type = 0;
    break;
  }
  return type;
}


x86 assembly (clang, -O0):
<hardware_convert_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffffe,%eax
sub    $0x5,%eax
jb     1237 <hardware_convert_type+0x137>
jmp    111e <hardware_convert_type+0x1e>
mov    -0xc(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0x3,%eax
jb     1243 <hardware_convert_type+0x143>
jmp    1132 <hardware_convert_type+0x32>
mov    -0xc(%rbp),%eax
add    $0xfffffff3,%eax
sub    $0x3,%eax
jb     1237 <hardware_convert_type+0x137>
jmp    1146 <hardware_convert_type+0x46>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
je     124f <hardware_convert_type+0x14f>
jmp    1157 <hardware_convert_type+0x57>
mov    -0xc(%rbp),%eax
sub    $0x11,%eax
je     125b <hardware_convert_type+0x15b>
jmp    1168 <hardware_convert_type+0x68>
mov    -0xc(%rbp),%eax
sub    $0x12,%eax
je     1267 <hardware_convert_type+0x167>
jmp    1179 <hardware_convert_type+0x79>
mov    -0xc(%rbp),%eax
sub    $0x13,%eax
je     124f <hardware_convert_type+0x14f>
jmp    118a <hardware_convert_type+0x8a>
mov    -0xc(%rbp),%eax
sub    $0x14,%eax
je     125b <hardware_convert_type+0x15b>
jmp    119b <hardware_convert_type+0x9b>
mov    -0xc(%rbp),%eax
sub    $0x15,%eax
je     1267 <hardware_convert_type+0x167>
jmp    11ac <hardware_convert_type+0xac>
mov    -0xc(%rbp),%eax
add    $0xfff6ff6e,%eax
sub    $0x2,%eax
jb     1273 <hardware_convert_type+0x173>
jmp    11c2 <hardware_convert_type+0xc2>
mov    -0xc(%rbp),%eax
add    $0xff5fefc0,%eax
sub    $0x2,%eax
jb     127f <hardware_convert_type+0x17f>
jmp    11d8 <hardware_convert_type+0xd8>
mov    -0xc(%rbp),%eax
sub    $0xa02082,%eax
je     128b <hardware_convert_type+0x18b>
jmp    11eb <hardware_convert_type+0xeb>
mov    -0xc(%rbp),%eax
sub    $0xa020d3,%eax
je     1297 <hardware_convert_type+0x197>
jmp    11fe <hardware_convert_type+0xfe>
mov    -0xc(%rbp),%eax
sub    $0xa21041,%eax
je     127f <hardware_convert_type+0x17f>
jmp    1211 <hardware_convert_type+0x111>
mov    -0xc(%rbp),%eax
sub    $0xa22042,%eax
je     127f <hardware_convert_type+0x17f>
jmp    1224 <hardware_convert_type+0x124>
mov    -0xc(%rbp),%eax
sub    $0xa22082,%eax
je     128b <hardware_convert_type+0x18b>
jmp    12a3 <hardware_convert_type+0x1a3>
movl   $0x2,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x1,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x4,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x6,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x3,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x8,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x7,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x9,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0xa,-0x8(%rbp)
jmp    12aa <hardware_convert_type+0x1aa>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hardware_convert_type>:
cmp    $0x90091,%edi
jg     112a <hardware_convert_type+0x2a>
add    $0xfffffffe,%edi
cmp    $0x13,%edi
ja     11aa <hardware_convert_type+0xaa>
mov    $0x2,%eax
lea    0xee0(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
ret
cmp    $0xa02081,%edi
jle    1154 <hardware_convert_type+0x54>
cmp    $0xa21040,%edi
jle    1176 <hardware_convert_type+0x76>
cmp    $0xa21041,%edi
je     116a <hardware_convert_type+0x6a>
cmp    $0xa22042,%edi
je     116a <hardware_convert_type+0x6a>
cmp    $0xa22082,%edi
je     11a4 <hardware_convert_type+0xa4>
jmp    11aa <hardware_convert_type+0xaa>
lea    -0x90092(%rdi),%eax
cmp    $0x2,%eax
jb     119e <hardware_convert_type+0x9e>
add    $0xff5fefc0,%edi
cmp    $0x2,%edi
jae    11aa <hardware_convert_type+0xaa>
mov    $0x7,%eax
ret
mov    $0x1,%eax
ret
cmp    $0xa02082,%edi
je     11a4 <hardware_convert_type+0xa4>
cmp    $0xa020d3,%edi
jne    11aa <hardware_convert_type+0xaa>
mov    $0xa,%eax
ret
mov    $0x4,%eax
ret
mov    $0x6,%eax
ret
mov    $0x3,%eax
ret
mov    $0x8,%eax
ret
mov    $0x9,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @hardware_convert_type(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %14 [
i32 2, label %5
i32 3, label %5
i32 4, label %5
i32 5, label %5
i32 6, label %5
i32 13, label %5
i32 14, label %5
i32 15, label %5
i32 7, label %6
i32 8, label %6
i32 9, label %6
i32 16, label %7
i32 19, label %7
i32 17, label %8
i32 20, label %8
i32 18, label %9
i32 21, label %9
i32 589970, label %10
i32 589971, label %10
i32 10489920, label %11
i32 10489921, label %11
i32 10620993, label %11
i32 10625090, label %11
i32 10494082, label %12
i32 10625154, label %12
i32 10494163, label %13
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1
store i32 2, i32* %3
br label %15
6: ; preds = %1, %1, %1
store i32 1, i32* %3
br label %15
7: ; preds = %1, %1
store i32 4, i32* %3
br label %15
8: ; preds = %1, %1
store i32 6, i32* %3
br label %15
9: ; preds = %1, %1
store i32 3, i32* %3
br label %15
10: ; preds = %1, %1
store i32 8, i32* %3
br label %15
11: ; preds = %1, %1, %1, %1
store i32 7, i32* %3
br label %15
12: ; preds = %1, %1
store i32 9, i32* %3
br label %15
13: ; preds = %1
store i32 10, i32* %3
br label %15
14: ; preds = %1
store i32 0, i32* %3
br label %15
15: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @hardware_convert_type(i32 %0) {
switch i32 %0, label %10 [
i32 2, label %11
i32 3, label %11
i32 4, label %11
i32 5, label %11
i32 6, label %11
i32 13, label %11
i32 14, label %11
i32 15, label %11
i32 7, label %2
i32 8, label %2
i32 9, label %2
i32 16, label %3
i32 19, label %3
i32 17, label %4
i32 20, label %4
i32 18, label %5
i32 21, label %5
i32 589970, label %6
i32 589971, label %6
i32 10489920, label %7
i32 10489921, label %7
i32 10620993, label %7
i32 10625090, label %7
i32 10494082, label %8
i32 10625154, label %8
i32 10494163, label %9
]
2: ; preds = %1, %1, %1
br label %11
3: ; preds = %1, %1
br label %11
4: ; preds = %1, %1
br label %11
5: ; preds = %1, %1
br label %11
6: ; preds = %1, %1
br label %11
7: ; preds = %1, %1, %1, %1
br label %11
8: ; preds = %1, %1
br label %11
9: ; preds = %1
br label %11
10: ; preds = %1
br label %11
11: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %10, %9, %8, %7, %6, %5, %4, %3, %2
%12 = phi i32 [ 0, %10 ], [ 10, %9 ], [ 9, %8 ], [ 7, %7 ], [ 8, %6 ], [ 3, %5 ], [ 6, %4 ], [ 4, %3 ], [ 1, %2 ], [ 2, %1 ], [ 2, %1 ], [ 2, %1 ], [ 2, %1 ], [ 2, %1 ], [ 2, %1 ], [ 2, %1 ], [ 2, %1 ]
ret i32 %12
}