int stab_xcoff_builtin_type(int typenum) {
  const char *name;
  if (typenum >= 0 || typenum < -34) {
    return 0;
  }
  switch (-typenum) {
  case 1:
    name = "int";
    break;
  case 2:
    name = "char";
  case 3:
    name = "short";
    break;
  case 4:
    name = "long";
  case 5:
    name = "unsigned char";
  case 6:
    name = "signed char";
  case 7:
    name = "unsigned short";
  case 8:
    name = "unsigned int";
  case 9:
    name = "unsigned";
  case 10:
    name = "unsigned long";
  case 11:
    name = "void";
  case 12:
    name = "float";
  case 13:
    name = "double";
  case 14:
    name = "long double";
  case 15:
    name = "integer";
  case 16:
    name = "boolean";
  case 17:
    name = "short real";
  case 18:
    name = "real";
  case 19:
    name = "stringptr";
  case 20:
    name = "character";
  case 21:
    name = "logical*1";
  case 22:
    name = "logical*2";
  case 23:
    name = "logical*4";
  case 24:
    name = "logical";
  case 25:
    name = "complex";
  case 26:
    name = "double complex";
  case 27:
    name = "integer*1";
  case 28:
    name = "integer*2";
  case 29:
    name = "integer*4";
  case 30:
    name = "wchar";
  case 31:
    name = "long long";
  case 32:
    name = "unsigned long long";
  case 33:
    name = "logical*8";
  case 34:
    name = "integer*8";
  }
  return name[0];
}


x86 assembly (clang, -O0):
<stab_xcoff_builtin_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111b <stab_xcoff_builtin_type+0x1b>
cmpl   $0xffffffde,-0x8(%rbp)
jge    1127 <stab_xcoff_builtin_type+0x27>
movl   $0x0,-0x4(%rbp)
jmp    12dd <stab_xcoff_builtin_type+0x1dd>
mov    -0x8(%rbp),%eax
mov    $0xffffffff,%ecx
xor    %rcx,%rax
mov    %rax,-0x18(%rbp)
sub    $0x21,%eax
ja     12d3 <stab_xcoff_builtin_type+0x1d3>
mov    -0x18(%rbp),%rax
lea    0xeb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf54(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12d3 <stab_xcoff_builtin_type+0x1d3>
lea    0xf27(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xf2a(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12d3 <stab_xcoff_builtin_type+0x1d3>
lea    0xf3f(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef8(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeef(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef0(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef6(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef7(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xee2(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xedf(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xedc(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed7(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed0(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecf(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecc(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed0(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebe(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec0(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeaf(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb6(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stab_xcoff_builtin_type>:
xor    %eax,%eax
cmp    $0xffffffde,%edi
jb     112f <stab_xcoff_builtin_type+0x2f>
mov    $0xfffffffe,%eax
sub    %edi,%eax
cmp    $0x20,%eax
ja     1125 <stab_xcoff_builtin_type+0x25>
cltq
lea    0xef8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    112c <stab_xcoff_builtin_type+0x2c>
lea    0xed4(%rip),%rax
movsbl (%rax),%eax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"int\00"
@.str.1 = [5 x i8] c"char\00"
@.str.2 = [6 x i8] c"short\00"
@.str.3 = [5 x i8] c"long\00"
@.str.4 = [14 x i8] c"unsigned char\00"
@.str.5 = [12 x i8] c"signed char\00"
@.str.6 = [15 x i8] c"unsigned short\00"
@.str.7 = [13 x i8] c"unsigned int\00"
@.str.8 = [9 x i8] c"unsigned\00"
@.str.9 = [14 x i8] c"unsigned long\00"
@.str.10 = [5 x i8] c"void\00"
@.str.11 = [6 x i8] c"float\00"
@.str.12 = [7 x i8] c"double\00"
@.str.13 = [12 x i8] c"long double\00"
@.str.14 = [8 x i8] c"integer\00"
@.str.15 = [8 x i8] c"boolean\00"
@.str.16 = [11 x i8] c"short real\00"
@.str.17 = [5 x i8] c"real\00"
@.str.18 = [10 x i8] c"stringptr\00"
@.str.19 = [10 x i8] c"character\00"
@.str.20 = [10 x i8] c"logical*1\00"
@.str.21 = [10 x i8] c"logical*2\00"
@.str.22 = [10 x i8] c"logical*4\00"
@.str.23 = [8 x i8] c"logical\00"
@.str.24 = [8 x i8] c"complex\00"
@.str.25 = [15 x i8] c"double complex\00"
@.str.26 = [10 x i8] c"integer*1\00"
@.str.27 = [10 x i8] c"integer*2\00"
@.str.28 = [10 x i8] c"integer*4\00"
@.str.29 = [6 x i8] c"wchar\00"
@.str.30 = [10 x i8] c"long long\00"
@.str.31 = [19 x i8] c"unsigned long long\00"
@.str.32 = [10 x i8] c"logical*8\00"
@.str.33 = [10 x i8] c"integer*8\00"
define i32 @stab_xcoff_builtin_type(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, -34
br i1 %9, label %10, label %11
10: ; preds = %7, %1
store i32 0, i32* %2
br label %53
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sub nsw i32 0, %12
switch i32 %13, label %48 [
i32 1, label %14
i32 2, label %15
i32 3, label %16
i32 4, label %17
i32 5, label %18
i32 6, label %19
i32 7, label %20
i32 8, label %21
i32 9, label %22
i32 10, label %23
i32 11, label %24
i32 12, label %25
i32 13, label %26
i32 14, label %27
i32 15, label %28
i32 16, label %29
i32 17, label %30
i32 18, label %31
i32 19, label %32
i32 20, label %33
i32 21, label %34
i32 22, label %35
i32 23, label %36
i32 24, label %37
i32 25, label %38
i32 26, label %39
i32 27, label %40
i32 28, label %41
i32 29, label %42
i32 30, label %43
i32 31, label %44
i32 32, label %45
i32 33, label %46
i32 34, label %47
]
14: ; preds = %11
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %4
br label %48
15: ; preds = %11
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %4
br label %16
16: ; preds = %11, %15
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %4
br label %48
17: ; preds = %11
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %4
br label %18
18: ; preds = %11, %17
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %4
br label %19
19: ; preds = %11, %18
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8** %4
br label %20
20: ; preds = %11, %19
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8** %4
br label %21
21: ; preds = %11, %20
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8** %4
br label %22
22: ; preds = %11, %21
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8** %4
br label %23
23: ; preds = %11, %22
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8** %4
br label %24
24: ; preds = %11, %23
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8** %4
br label %25
25: ; preds = %11, %24
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8** %4
br label %26
26: ; preds = %11, %25
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8** %4
br label %27
27: ; preds = %11, %26
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8** %4
br label %28
28: ; preds = %11, %27
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %4
br label %29
29: ; preds = %11, %28
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8** %4
br label %30
30: ; preds = %11, %29
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8** %4
br label %31
31: ; preds = %11, %30
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i8** %4
br label %32
32: ; preds = %11, %31
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0), i8** %4
br label %33
33: ; preds = %11, %32
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0), i8** %4
br label %34
34: ; preds = %11, %33
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0), i8** %4
br label %35
35: ; preds = %11, %34
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.21, i64 0, i64 0), i8** %4
br label %36
36: ; preds = %11, %35
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i64 0, i64 0), i8** %4
br label %37
37: ; preds = %11, %36
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0), i8** %4
br label %38
38: ; preds = %11, %37
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.24, i64 0, i64 0), i8** %4
br label %39
39: ; preds = %11, %38
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.25, i64 0, i64 0), i8** %4
br label %40
40: ; preds = %11, %39
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.26, i64 0, i64 0), i8** %4
br label %41
41: ; preds = %11, %40
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.27, i64 0, i64 0), i8** %4
br label %42
42: ; preds = %11, %41
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.28, i64 0, i64 0), i8** %4
br label %43
43: ; preds = %11, %42
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i64 0, i64 0), i8** %4
br label %44
44: ; preds = %11, %43
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.30, i64 0, i64 0), i8** %4
br label %45
45: ; preds = %11, %44
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.31, i64 0, i64 0), i8** %4
br label %46
46: ; preds = %11, %45
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.32, i64 0, i64 0), i8** %4
br label %47
47: ; preds = %11, %46
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.33, i64 0, i64 0), i8** %4
br label %48
48: ; preds = %47, %11, %16, %14
%49 = load i8*, i8** %4
%50 = getelementptr inbounds i8, i8* %49, i64 0
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
store i32 %52, i32* %2
br label %53
53: ; preds = %48, %10
%54 = load i32, i32* %2
ret i32 %54
}

LLVM IR (-O2):
@.str = [4 x i8] c"int\00"
@.str.2 = [6 x i8] c"short\00"
@.str.33 = [10 x i8] c"integer*8\00"
@reltable.stab_xcoff_builtin_type = [33 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.33 to i64), i64 ptrtoint ([33 x i32]* @reltable.stab_xcoff_builtin_type to i64)) to i32)]
define i32 @stab_xcoff_builtin_type(i32 %0) {
%2 = icmp ult i32 %0, -34
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = sub i32 -2, %0
%5 = icmp ult i32 %4, 33
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([33 x i32]* @reltable.stab_xcoff_builtin_type to i8*), i64 %8)
br label %10
10: ; preds = %6, %3
%11 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %3 ], [ %9, %6 ]
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
br label %14
14: ; preds = %1, %10
%15 = phi i32 [ %13, %10 ], [ 0, %1 ]
ret i32 %15
}