#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 /*<<< orphan*/ BIO;

/* Variables and functions */
char *ASN1_tag2str(int);
int /*<<< orphan*/ BIO_indent(int /*<<< orphan*/ *, int, int);
scalar_t__ BIO_printf(int /*<<< orphan*/ *, char *, char const *);
int BIO_write(int /*<<< orphan*/ *, char const *, int);
int V_ASN1_APPLICATION;
int V_ASN1_CONSTRUCTED;
int V_ASN1_CONTEXT_SPECIFIC;
int V_ASN1_PRIVATE;
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, int indent) {
  char str[128];
  const char *p;
  if (constructed & V_ASN1_CONSTRUCTED)
    p = "cons: ";
  else
    p = "prim: ";
  if (BIO_write(bp, p, 6) < 6)
    goto err;
  BIO_indent(bp, indent, 128);
  p = str;
  if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
    snprintf(str, sizeof str, "priv [ %d ] ", tag);
  else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
    snprintf(str, sizeof str, "cont [ %d ]", tag);
  else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
    snprintf(str, sizeof str, "appl [ %d ]", tag);
  else if (tag > 30)
    snprintf(str, sizeof str, "<ASN1 %d>", tag);
  else
    p = ASN1_tag2str(tag);
  if (BIO_printf(bp, "%-18s", p) <= 0)
    goto err;
  return (1);
err:
  return (0);
}


x86 assembly (clang, -O0):
<asn1_print_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e62(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1194 <asn1_print_info+0x44>
lea    0xe78(%rip),%rax
mov    %rax,-0xa8(%rbp)
jmp    11a2 <asn1_print_info+0x52>
lea    0xe6c(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
mov    $0x6,%edx
call   1070 <BIO_write@plt>
cmp    $0x6,%eax
jge    11c5 <asn1_print_info+0x75>
jmp    130f <asn1_print_info+0x1bf>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    $0x80,%edx
call   1030 <BIO_indent@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e0a(%rip),%rcx
and    (%rcx),%eax
mov    0x2e01(%rip),%rcx
cmp    (%rcx),%eax
jne    121f <asn1_print_info+0xcf>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xdf9(%rip),%rdx
call   1050 <snprintf@plt>
jmp    12dd <asn1_print_info+0x18d>
mov    -0x18(%rbp),%eax
mov    0x2da7(%rip),%rcx
and    (%rcx),%eax
mov    0x2d9e(%rip),%rcx
cmp    (%rcx),%eax
jne    125a <asn1_print_info+0x10a>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xdcb(%rip),%rdx
call   1050 <snprintf@plt>
jmp    12d8 <asn1_print_info+0x188>
mov    -0x18(%rbp),%eax
mov    0x2d5c(%rip),%rcx
and    (%rcx),%eax
mov    0x2d53(%rip),%rcx
cmp    (%rcx),%eax
jne    1295 <asn1_print_info+0x145>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xd9c(%rip),%rdx
call   1050 <snprintf@plt>
jmp    12d3 <asn1_print_info+0x183>
cmpl   $0x1e,-0x14(%rbp)
jle    12bf <asn1_print_info+0x16f>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xd7e(%rip),%rdx
call   1050 <snprintf@plt>
jmp    12ce <asn1_print_info+0x17e>
mov    -0x14(%rbp),%edi
call   1060 <ASN1_tag2str@plt>
mov    %rax,-0xa8(%rbp)
jmp    12d3 <asn1_print_info+0x183>
jmp    12d8 <asn1_print_info+0x188>
jmp    12dd <asn1_print_info+0x18d>
mov    -0x10(%rbp),%rdi
mov    -0xa8(%rbp),%rdx
lea    0xd4e(%rip),%rsi
call   1040 <BIO_printf@plt>
cmp    $0x0,%rax
jg     1303 <asn1_print_info+0x1b3>
jmp    130f <asn1_print_info+0x1bf>
movl   $0x1,-0x4(%rbp)
jmp    1316 <asn1_print_info+0x1c6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_print_info>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %r8d,%ebx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r15
mov    0x2e69(%rip),%rax
and    (%rax),%ecx
lea    0xe8f(%rip),%rax
lea    0xe81(%rip),%rsi
cmove  %rax,%rsi
mov    $0x6,%edx
call   1070 <BIO_write@plt>
cmp    $0x6,%eax
jl     122b <asn1_print_info+0xdb>
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x80,%edx
call   1030 <BIO_indent@plt>
mov    0x2e4c(%rip),%rax
not    %ebp
test   %ebp,(%rax)
jne    11be <asn1_print_info+0x6e>
mov    %rsp,%rbp
lea    0xe52(%rip),%rdx
jmp    11fc <asn1_print_info+0xac>
mov    0x2e0b(%rip),%rax
test   %ebp,(%rax)
jne    11d5 <asn1_print_info+0x85>
mov    %rsp,%rbp
lea    0xe48(%rip),%rdx
jmp    11fc <asn1_print_info+0xac>
mov    0x2de4(%rip),%rax
test   %ebp,(%rax)
jne    11ec <asn1_print_info+0x9c>
mov    %rsp,%rbp
lea    0xe3d(%rip),%rdx
jmp    11fc <asn1_print_info+0xac>
cmp    $0x1f,%r14d
jl     123b <asn1_print_info+0xeb>
mov    %rsp,%rbp
lea    0xe37(%rip),%rdx
mov    %rbp,%rdi
mov    $0x80,%esi
mov    %r14d,%ecx
call   1050 <snprintf@plt>
lea    0xe2a(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
call   1040 <BIO_printf@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jg     122d <asn1_print_info+0xdd>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14d,%edi
call   1060 <ASN1_tag2str@plt>
mov    %rax,%rbp
jmp    120c <asn1_print_info+0xbc>

LLVM IR (-O0):
@V_ASN1_CONSTRUCTED = global i32 0
@.str = [7 x i8] c"cons: \00"
@.str.1 = [7 x i8] c"prim: \00"
@V_ASN1_PRIVATE = global i32 0
@.str.2 = [13 x i8] c"priv [ %d ] \00"
@V_ASN1_CONTEXT_SPECIFIC = global i32 0
@.str.3 = [12 x i8] c"cont [ %d ]\00"
@V_ASN1_APPLICATION = global i32 0
@.str.4 = [12 x i8] c"appl [ %d ]\00"
@.str.5 = [10 x i8] c"<ASN1 %d>\00"
@.str.6 = [6 x i8] c"%-18s\00"
define i32 @asn1_print_info(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [128 x i8]
%13 = alloca i8*
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%14 = load i32, i32* %10
%15 = load i32, i32* @V_ASN1_CONSTRUCTED
%16 = and i32 %14, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %13
br label %20
19: ; preds = %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %13
br label %20
20: ; preds = %19, %18
%21 = load i32*, i32** %7
%22 = load i8*, i8** %13
%23 = call i32 @BIO_write(i32* %21, i8* %22, i32 6)
%24 = icmp slt i32 %23, 6
br i1 %24, label %25, label %26
25: ; preds = %20
br label %80
26: ; preds = %20
%27 = load i32*, i32** %7
%28 = load i32, i32* %11
%29 = call i32 @BIO_indent(i32* %27, i32 %28, i32 128)
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
store i8* %30, i8** %13
%31 = load i32, i32* %9
%32 = load i32, i32* @V_ASN1_PRIVATE
%33 = and i32 %31, %32
%34 = load i32, i32* @V_ASN1_PRIVATE
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %40
36: ; preds = %26
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%38 = load i32, i32* %8
%39 = call i32 @snprintf(i8* %37, i32 128, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %73
40: ; preds = %26
%41 = load i32, i32* %9
%42 = load i32, i32* @V_ASN1_CONTEXT_SPECIFIC
%43 = and i32 %41, %42
%44 = load i32, i32* @V_ASN1_CONTEXT_SPECIFIC
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %50
46: ; preds = %40
%47 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%48 = load i32, i32* %8
%49 = call i32 @snprintf(i8* %47, i32 128, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %48)
br label %72
50: ; preds = %40
%51 = load i32, i32* %9
%52 = load i32, i32* @V_ASN1_APPLICATION
%53 = and i32 %51, %52
%54 = load i32, i32* @V_ASN1_APPLICATION
%55 = icmp eq i32 %53, %54
br i1 %55, label %56, label %60
56: ; preds = %50
%57 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%58 = load i32, i32* %8
%59 = call i32 @snprintf(i8* %57, i32 128, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %58)
br label %71
60: ; preds = %50
%61 = load i32, i32* %8
%62 = icmp sgt i32 %61, 30
br i1 %62, label %63, label %67
63: ; preds = %60
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%65 = load i32, i32* %8
%66 = call i32 @snprintf(i8* %64, i32 128, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %65)
br label %70
67: ; preds = %60
%68 = load i32, i32* %8
%69 = call i8* @ASN1_tag2str(i32 %68)
store i8* %69, i8** %13
br label %70
70: ; preds = %67, %63
br label %71
71: ; preds = %70, %56
br label %72
72: ; preds = %71, %46
br label %73
73: ; preds = %72, %36
%74 = load i32*, i32** %7
%75 = load i8*, i8** %13
%76 = call i64 @BIO_printf(i32* %74, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %75)
%77 = icmp sle i64 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %73
br label %80
79: ; preds = %73
store i32 1, i32* %6
br label %81
80: ; preds = %78, %25
store i32 0, i32* %6
br label %81
81: ; preds = %80, %79
%82 = load i32, i32* %6
ret i32 %82
}

LLVM IR (-O2):
@V_ASN1_CONSTRUCTED = global i32 0
@.str = [7 x i8] c"cons: \00"
@.str.1 = [7 x i8] c"prim: \00"
@V_ASN1_PRIVATE = global i32 0
@.str.2 = [13 x i8] c"priv [ %d ] \00"
@V_ASN1_CONTEXT_SPECIFIC = global i32 0
@.str.3 = [12 x i8] c"cont [ %d ]\00"
@V_ASN1_APPLICATION = global i32 0
@.str.4 = [12 x i8] c"appl [ %d ]\00"
@.str.5 = [10 x i8] c"<ASN1 %d>\00"
@.str.6 = [6 x i8] c"%-18s\00"
define i32 @asn1_print_info(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = load i32, i32* @V_ASN1_CONSTRUCTED
%9 = and i32 %8, %3
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
%12 = tail call i32 @BIO_write(i32* %0, i8* %11, i32 6)
%13 = icmp slt i32 %12, 6
br i1 %13, label %43, label %14
14: ; preds = %5
%15 = tail call i32 @BIO_indent(i32* %0, i32 %4, i32 128)
%16 = load i32, i32* @V_ASN1_PRIVATE
%17 = and i32 %16, %2
%18 = icmp eq i32 %17, %16
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %39
21: ; preds = %14
%22 = load i32, i32* @V_ASN1_CONTEXT_SPECIFIC
%23 = and i32 %22, %2
%24 = icmp eq i32 %23, %22
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %1)
br label %39
27: ; preds = %21
%28 = load i32, i32* @V_ASN1_APPLICATION
%29 = and i32 %28, %2
%30 = icmp eq i32 %29, %28
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %1)
br label %39
33: ; preds = %27
%34 = icmp sgt i32 %1, 30
br i1 %34, label %35, label %37
35: ; preds = %33
%36 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %1)
br label %39
37: ; preds = %33
%38 = tail call i8* @ASN1_tag2str(i32 %1)
br label %39
39: ; preds = %25, %35, %37, %31, %19
%40 = phi i8* [ %7, %19 ], [ %7, %25 ], [ %7, %31 ], [ %7, %35 ], [ %38, %37 ]
%41 = call i64 @BIO_printf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %40)
%42 = icmp slt i64 %41, 1
br i1 %42, label %43, label %44
43: ; preds = %39, %5
br label %44
44: ; preds = %39, %43
%45 = phi i32 [ 0, %43 ], [ 1, %39 ]
ret i32 %45
}