#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 */

/* Variables and functions */
int V_ASN1_NEG_ENUMERATED;
int V_ASN1_NEG_INTEGER;
const char *ASN1_tag2str(int tag) {
  static const char *tag2str[] = {"EOC",
                                  "BOOLEAN",
                                  "INTEGER",
                                  "BIT STRING",
                                  "OCTET STRING",
                                  "NULL",
                                  "OBJECT",
                                  "OBJECT DESCRIPTOR",
                                  "EXTERNAL",
                                  "REAL",
                                  "ENUMERATED",
                                  "<ASN1 11>",
                                  "UTF8STRING",
                                  "<ASN1 13>",
                                  "<ASN1 14>",
                                  "<ASN1 15>",
                                  "SEQUENCE",
                                  "SET",
                                  "NUMERICSTRING",
                                  "PRINTABLESTRING",
                                  "T61STRING",
                                  "VIDEOTEXSTRING",
                                  "IA5STRING",
                                  "UTCTIME",
                                  "GENERALIZEDTIME",
                                  "GRAPHICSTRING",
                                  "VISIBLESTRING",
                                  "GENERALSTRING",
                                  "UNIVERSALSTRING",
                                  "<ASN1 29>",
                                  "BMPSTRING"};
  if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
    tag &= ~0x100;
  if (tag < 0 || tag > 30)
    return "(unknown)";
  return tag2str[tag];
}


x86 assembly (clang, -O0):
<ASN1_tag2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ec7(%rip),%rcx
cmp    (%rcx),%eax
je     112b <ASN1_tag2str+0x2b>
mov    -0xc(%rbp),%eax
mov    0x2ec5(%rip),%rcx
cmp    (%rcx),%eax
jne    1136 <ASN1_tag2str+0x36>
mov    -0xc(%rbp),%eax
and    $0xfffffeff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     114a <ASN1_tag2str+0x4a>
cmpl   $0x1e,-0xc(%rbp)
jle    115a <ASN1_tag2str+0x5a>
lea    0xff9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    116d <ASN1_tag2str+0x6d>
movslq -0xc(%rbp),%rcx
lea    0x2ecb(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_tag2str>:
mov    0x2ed1(%rip),%rcx
mov    0x2eda(%rip),%rax
mov    %edi,%edx
and    $0xfffffeff,%edx
cmp    %edi,(%rax)
mov    %edi,%eax
cmove  %edx,%eax
cmp    %edi,(%rcx)
cmove  %edx,%eax
cmp    $0x1e,%eax
jbe    112f <ASN1_tag2str+0x2f>
lea    0x1098(%rip),%rax
ret
mov    %eax,%eax
lea    0xec8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@ASN1_tag2str.tag2str = internal global [31 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.30, i32 0, i32 0)]
@.str = [4 x i8] c"EOC\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 = [7 x i8] c"OBJECT\00"
@.str.7 = [18 x i8] c"OBJECT DESCRIPTOR\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 = [10 x i8] c"<ASN1 11>\00"
@.str.12 = [11 x i8] c"UTF8STRING\00"
@.str.13 = [10 x i8] c"<ASN1 13>\00"
@.str.14 = [10 x i8] c"<ASN1 14>\00"
@.str.15 = [10 x i8] c"<ASN1 15>\00"
@.str.16 = [9 x i8] c"SEQUENCE\00"
@.str.17 = [4 x i8] c"SET\00"
@.str.18 = [14 x i8] c"NUMERICSTRING\00"
@.str.19 = [16 x i8] c"PRINTABLESTRING\00"
@.str.20 = [10 x i8] c"T61STRING\00"
@.str.21 = [15 x i8] c"VIDEOTEXSTRING\00"
@.str.22 = [10 x i8] c"IA5STRING\00"
@.str.23 = [8 x i8] c"UTCTIME\00"
@.str.24 = [16 x i8] c"GENERALIZEDTIME\00"
@.str.25 = [14 x i8] c"GRAPHICSTRING\00"
@.str.26 = [14 x i8] c"VISIBLESTRING\00"
@.str.27 = [14 x i8] c"GENERALSTRING\00"
@.str.28 = [16 x i8] c"UNIVERSALSTRING\00"
@.str.29 = [10 x i8] c"<ASN1 29>\00"
@.str.30 = [10 x i8] c"BMPSTRING\00"
@V_ASN1_NEG_INTEGER = global i32 0
@V_ASN1_NEG_ENUMERATED = global i32 0
@.str.31 = [10 x i8] c"(unknown)\00"
define i8* @ASN1_tag2str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @V_ASN1_NEG_INTEGER
%6 = icmp eq i32 %4, %5
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = load i32, i32* @V_ASN1_NEG_ENUMERATED
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %7, %1
%12 = load i32, i32* %3
%13 = and i32 %12, -257
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %7
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 30
br i1 %19, label %20, label %21
20: ; preds = %17, %14
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.31, i64 0, i64 0), i8** %2
br label %26
21: ; preds = %17
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [31 x i8*], [31 x i8*]* @ASN1_tag2str.tag2str, i64 0, i64 %23
%25 = load i8*, i8** %24
store i8* %25, i8** %2
br label %26
26: ; preds = %21, %20
%27 = load i8*, i8** %2
ret i8* %27
}

LLVM IR (-O2):
@reltable.ASN1_tag2str = internal unnamed_addr constant [31 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.3 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.4 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.7 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.8 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.10 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.12 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.13 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.14 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.15 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.16 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.17 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.18 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.19 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.20 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.21 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.22 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.23 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.24 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.25 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.26 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.27 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.28 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.29 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.30 to i64), i64 ptrtoint ([31 x i32]* @reltable.ASN1_tag2str to i64)) to i32)]
@.str = [4 x i8] c"EOC\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 = [7 x i8] c"OBJECT\00"
@.str.7 = [18 x i8] c"OBJECT DESCRIPTOR\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 = [10 x i8] c"<ASN1 11>\00"
@.str.12 = [11 x i8] c"UTF8STRING\00"
@.str.13 = [10 x i8] c"<ASN1 13>\00"
@.str.14 = [10 x i8] c"<ASN1 14>\00"
@.str.15 = [10 x i8] c"<ASN1 15>\00"
@.str.16 = [9 x i8] c"SEQUENCE\00"
@.str.17 = [4 x i8] c"SET\00"
@.str.18 = [14 x i8] c"NUMERICSTRING\00"
@.str.19 = [16 x i8] c"PRINTABLESTRING\00"
@.str.20 = [10 x i8] c"T61STRING\00"
@.str.21 = [15 x i8] c"VIDEOTEXSTRING\00"
@.str.22 = [10 x i8] c"IA5STRING\00"
@.str.23 = [8 x i8] c"UTCTIME\00"
@.str.24 = [16 x i8] c"GENERALIZEDTIME\00"
@.str.25 = [14 x i8] c"GRAPHICSTRING\00"
@.str.26 = [14 x i8] c"VISIBLESTRING\00"
@.str.27 = [14 x i8] c"GENERALSTRING\00"
@.str.28 = [16 x i8] c"UNIVERSALSTRING\00"
@.str.29 = [10 x i8] c"<ASN1 29>\00"
@.str.30 = [10 x i8] c"BMPSTRING\00"
@V_ASN1_NEG_INTEGER = global i32 0
@V_ASN1_NEG_ENUMERATED = global i32 0
@.str.31 = [10 x i8] c"(unknown)\00"
define i8* @ASN1_tag2str(i32 %0) {
%2 = load i32, i32* @V_ASN1_NEG_INTEGER
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @V_ASN1_NEG_ENUMERATED
%5 = icmp eq i32 %4, %0
%6 = select i1 %3, i1 true, i1 %5
%7 = and i32 %0, -257
%8 = select i1 %6, i32 %7, i32 %0
%9 = icmp ugt i32 %8, 30
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = zext i32 %8 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([31 x i32]* @reltable.ASN1_tag2str to i8*), i64 %12)
br label %14
14: ; preds = %1, %10
%15 = phi i8* [ %13, %10 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.31, i64 0, i64 0), %1 ]
ret i8* %15
}