#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 */
const char *get_965_prim_type(uint32_t data) {
  uint32_t primtype = (data >> 10) & 0x1f;
  switch (primtype) {
  case 0x01:
    return "point list";
  case 0x02:
    return "line list";
  case 0x03:
    return "line strip";
  case 0x04:
    return "tri list";
  case 0x05:
    return "tri strip";
  case 0x06:
    return "tri fan";
  case 0x07:
    return "quad list";
  case 0x08:
    return "quad strip";
  case 0x09:
    return "line list adj";
  case 0x0a:
    return "line strip adj";
  case 0x0b:
    return "tri list adj";
  case 0x0c:
    return "tri strip adj";
  case 0x0d:
    return "tri strip reverse";
  case 0x0e:
    return "polygon";
  case 0x0f:
    return "rect list";
  case 0x10:
    return "line loop";
  case 0x11:
    return "point list bf";
  case 0x12:
    return "line strip cont";
  case 0x13:
    return "line strip bf";
  case 0x14:
    return "line strip cont bf";
  case 0x15:
    return "tri fan no stipple";
  default:
    return "fail";
  }
}


x86 assembly (clang, -O0):
<get_965_prim_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0xa,%eax
and    $0x1f,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x14,%eax
ja     128c <get_965_prim_type+0x18c>
mov    -0x18(%rbp),%rax
lea    0xecd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf11(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xf0c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xf06(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xf01(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xefa(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xef4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xeec(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xee6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xedf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xed3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xecd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1297 <get_965_prim_type+0x197>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_965_prim_type>:
shr    $0xa,%edi
and    $0x1f,%edi
add    $0xffffffff,%edi
cmp    $0x14,%edi
ja     1120 <get_965_prim_type+0x20>
movslq %edi,%rax
lea    0xff8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xfe1(%rip),%rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"point list\00"
@.str.1 = [10 x i8] c"line list\00"
@.str.2 = [11 x i8] c"line strip\00"
@.str.3 = [9 x i8] c"tri list\00"
@.str.4 = [10 x i8] c"tri strip\00"
@.str.5 = [8 x i8] c"tri fan\00"
@.str.6 = [10 x i8] c"quad list\00"
@.str.7 = [11 x i8] c"quad strip\00"
@.str.8 = [14 x i8] c"line list adj\00"
@.str.9 = [15 x i8] c"line strip adj\00"
@.str.10 = [13 x i8] c"tri list adj\00"
@.str.11 = [14 x i8] c"tri strip adj\00"
@.str.12 = [18 x i8] c"tri strip reverse\00"
@.str.13 = [8 x i8] c"polygon\00"
@.str.14 = [10 x i8] c"rect list\00"
@.str.15 = [10 x i8] c"line loop\00"
@.str.16 = [14 x i8] c"point list bf\00"
@.str.17 = [16 x i8] c"line strip cont\00"
@.str.18 = [14 x i8] c"line strip bf\00"
@.str.19 = [19 x i8] c"line strip cont bf\00"
@.str.20 = [19 x i8] c"tri fan no stipple\00"
@.str.21 = [5 x i8] c"fail\00"
define i8* @get_965_prim_type(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = ashr i32 %5, 10
%7 = and i32 %6, 31
store i32 %7, i32* %4
%8 = load i32, i32* %4
switch i32 %8, label %30 [
i32 1, label %9
i32 2, label %10
i32 3, label %11
i32 4, label %12
i32 5, label %13
i32 6, label %14
i32 7, label %15
i32 8, label %16
i32 9, label %17
i32 10, label %18
i32 11, label %19
i32 12, label %20
i32 13, label %21
i32 14, label %22
i32 15, label %23
i32 16, label %24
i32 17, label %25
i32 18, label %26
i32 19, label %27
i32 20, label %28
i32 21, label %29
]
9: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
br label %31
10: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %31
11: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %31
12: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %31
13: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %31
14: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %31
15: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %31
16: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %31
17: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %31
18: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %31
19: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %31
20: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %31
21: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %31
22: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %31
23: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %31
24: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %31
25: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %31
26: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %31
27: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %31
28: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %31
29: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %31
30: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %31
31: ; preds = %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@.str = [11 x i8] c"point list\00"
@.str.1 = [10 x i8] c"line list\00"
@.str.2 = [11 x i8] c"line strip\00"
@.str.3 = [9 x i8] c"tri list\00"
@.str.4 = [10 x i8] c"tri strip\00"
@.str.5 = [8 x i8] c"tri fan\00"
@.str.6 = [10 x i8] c"quad list\00"
@.str.7 = [11 x i8] c"quad strip\00"
@.str.8 = [14 x i8] c"line list adj\00"
@.str.9 = [15 x i8] c"line strip adj\00"
@.str.10 = [13 x i8] c"tri list adj\00"
@.str.11 = [14 x i8] c"tri strip adj\00"
@.str.12 = [18 x i8] c"tri strip reverse\00"
@.str.13 = [8 x i8] c"polygon\00"
@.str.14 = [10 x i8] c"rect list\00"
@.str.15 = [10 x i8] c"line loop\00"
@.str.16 = [14 x i8] c"point list bf\00"
@.str.17 = [16 x i8] c"line strip cont\00"
@.str.18 = [14 x i8] c"line strip bf\00"
@.str.19 = [19 x i8] c"line strip cont bf\00"
@.str.20 = [19 x i8] c"tri fan no stipple\00"
@.str.21 = [5 x i8] c"fail\00"
@reltable.get_965_prim_type = [21 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.2 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.3 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.4 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.5 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.6 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.7 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.8 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.9 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.10 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.11 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.12 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.13 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.14 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.15 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.16 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.17 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.18 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.19 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.20 to i64), i64 ptrtoint ([21 x i32]* @reltable.get_965_prim_type to i64)) to i32)]
define i8* @get_965_prim_type(i32 %0) {
%2 = lshr i32 %0, 10
%3 = and i32 %2, 31
%4 = add nsw i32 %3, -1
%5 = icmp ult i32 %4, 21
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([21 x i32]* @reltable.get_965_prim_type to i8*), i64 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), %1 ]
ret i8* %11
}