char *idstr(const int tagID) {
  switch (tagID) {
  case 0x00:
    return ("End-of-contents octets");
  case 0x01:
    return ("BOOLEAN");
  case 0x02:
    return ("INTEGER");
  case 0x03:
    return ("BIT STRING");
  case 0x04:
    return ("OCTET STRING");
  case 0x05:
    return ("NULL");
  case 0x06:
    return ("OBJECT IDENTIFIER");
  case 0x07:
    return ("ObjectDescriptor");
  case 0x08:
    return ("EXTERNAL");
  case 0x09:
    return ("REAL");
  case 0x0A:
    return ("ENUMERATED");
  case 0x0B:
    return ("EMBEDDED PDV");
  case 0x0C:
    return ("UTF8String");
  case 0x10:
    return ("SEQUENCE");
  case 0x11:
    return ("SET");
  case 0x12:
    return ("NumericString");
  case 0x13:
    return ("PrintableString");
  case 0x14:
    return ("TeletexString");
  case 0x15:
    return ("VideotexString");
  case 0x16:
    return ("IA5String");
  case 0x17:
    return ("UTCTime");
  case 0x18:
    return ("GeneralizedTime");
  case 0x19:
    return ("GraphicString");
  case 0x1A:
    return ("VisibleString");
  case 0x1B:
    return ("GeneralString");
  case 0x1C:
    return ("UniversalString");
  case 0x1E:
    return ("BMPString");
  default:
    return ("Unknown (Reserved)");
  }
}


x86 assembly (clang, -O0):
<idstr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x1e,%rax
ja     12dc <idstr+0x1dc>
mov    -0x18(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf49(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf50(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf48(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf40(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf3b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf38(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf2d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf2f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf30(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf29(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf19(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf16(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf11(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xf0a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xefe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xefc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xefc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xefa(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xef9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xef3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xeeb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xeeb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xee9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xee7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xee5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xee5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12e7 <idstr+0x1e7>
lea    0xedf(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<idstr>:
cmp    $0x1e,%edi
ja     1117 <idstr+0x17>
movslq %edi,%rax
lea    0x104d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0x1028(%rip),%rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"End-of-contents octets\00"
@.str.1 = [8 x i8] c"BOOLEAN\00"
@.str.2 = [8 x i8] c"INTEGER\00"
@.str.3 = [11 x i8] c"BIT STRING\00"
@.str.4 = [13 x i8] c"OCTET STRING\00"
@.str.5 = [5 x i8] c"NULL\00"
@.str.6 = [18 x i8] c"OBJECT IDENTIFIER\00"
@.str.7 = [17 x i8] c"ObjectDescriptor\00"
@.str.8 = [9 x i8] c"EXTERNAL\00"
@.str.9 = [5 x i8] c"REAL\00"
@.str.10 = [11 x i8] c"ENUMERATED\00"
@.str.11 = [13 x i8] c"EMBEDDED PDV\00"
@.str.12 = [11 x i8] c"UTF8String\00"
@.str.13 = [9 x i8] c"SEQUENCE\00"
@.str.14 = [4 x i8] c"SET\00"
@.str.15 = [14 x i8] c"NumericString\00"
@.str.16 = [16 x i8] c"PrintableString\00"
@.str.17 = [14 x i8] c"TeletexString\00"
@.str.18 = [15 x i8] c"VideotexString\00"
@.str.19 = [10 x i8] c"IA5String\00"
@.str.20 = [8 x i8] c"UTCTime\00"
@.str.21 = [16 x i8] c"GeneralizedTime\00"
@.str.22 = [14 x i8] c"GraphicString\00"
@.str.23 = [14 x i8] c"VisibleString\00"
@.str.24 = [14 x i8] c"GeneralString\00"
@.str.25 = [16 x i8] c"UniversalString\00"
@.str.26 = [10 x i8] c"BMPString\00"
@.str.27 = [19 x i8] c"Unknown (Reserved)\00"
define i8* @idstr(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %32 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 8, label %13
i32 9, label %14
i32 10, label %15
i32 11, label %16
i32 12, label %17
i32 16, label %18
i32 17, label %19
i32 18, label %20
i32 19, label %21
i32 20, label %22
i32 21, label %23
i32 22, label %24
i32 23, label %25
i32 24, label %26
i32 25, label %27
i32 26, label %28
i32 27, label %29
i32 28, label %30
i32 30, label %31
]
5: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %2
br label %33
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %33
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %33
8: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %33
9: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %33
10: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %33
11: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %33
12: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %33
13: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %33
14: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %33
15: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %33
16: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %33
17: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %33
18: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %33
19: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %33
20: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %33
21: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %33
22: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %33
23: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %33
24: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %33
25: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %33
26: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %33
27: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.22, i64 0, i64 0), i8** %2
br label %33
28: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0), i8** %2
br label %33
29: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0), i8** %2
br label %33
30: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0), i8** %2
br label %33
31: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.26, i64 0, i64 0), i8** %2
br label %33
32: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.27, i64 0, i64 0), i8** %2
br label %33
33: ; preds = %32, %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
%34 = load i8*, i8** %2
ret i8* %34
}

LLVM IR (-O2):
@.str = [23 x i8] c"End-of-contents octets\00"
@.str.1 = [8 x i8] c"BOOLEAN\00"
@.str.2 = [8 x i8] c"INTEGER\00"
@.str.3 = [11 x i8] c"BIT STRING\00"
@.str.4 = [13 x i8] c"OCTET STRING\00"
@.str.5 = [5 x i8] c"NULL\00"
@.str.6 = [18 x i8] c"OBJECT IDENTIFIER\00"
@.str.7 = [17 x i8] c"ObjectDescriptor\00"
@.str.8 = [9 x i8] c"EXTERNAL\00"
@.str.9 = [5 x i8] c"REAL\00"
@.str.10 = [11 x i8] c"ENUMERATED\00"
@.str.11 = [13 x i8] c"EMBEDDED PDV\00"
@.str.12 = [11 x i8] c"UTF8String\00"
@.str.13 = [9 x i8] c"SEQUENCE\00"
@.str.14 = [4 x i8] c"SET\00"
@.str.15 = [14 x i8] c"NumericString\00"
@.str.16 = [16 x i8] c"PrintableString\00"
@.str.17 = [14 x i8] c"TeletexString\00"
@.str.18 = [15 x i8] c"VideotexString\00"
@.str.19 = [10 x i8] c"IA5String\00"
@.str.20 = [8 x i8] c"UTCTime\00"
@.str.21 = [16 x i8] c"GeneralizedTime\00"
@.str.22 = [14 x i8] c"GraphicString\00"
@.str.23 = [14 x i8] c"VisibleString\00"
@.str.24 = [14 x i8] c"GeneralString\00"
@.str.25 = [16 x i8] c"UniversalString\00"
@.str.26 = [10 x i8] c"BMPString\00"
@.str.27 = [19 x i8] c"Unknown (Reserved)\00"
@reltable.idstr = [31 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.3 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.4 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.6 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.7 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.8 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.10 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.11 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.12 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.27 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.27 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.27 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.13 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.14 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.15 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.16 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.17 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.18 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.19 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.20 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.21 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.22 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.23 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.24 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.25 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.27 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.26 to i64), i64 ptrtoint ([31 x i32]* @reltable.idstr to i64)) to i32)]
define i8* @idstr(i32 %0) {
%2 = icmp ult i32 %0, 31
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([31 x i32]* @reltable.idstr to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.27, i64 0, i64 0), %1 ]
ret i8* %8
}