#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 const *, ...);
int /*<<< orphan*/ BIO_snprintf(char *, int, char *, int);
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 asn1_print_info(BIO *bp, int tag, int xclass, int constructed, int indent) {
  static const char fmt[] = "%-18s";
  static const char fmt2[] = "%2d %-15s";
  char str[128];
  const char *p, *p2 = NULL;
  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)
    BIO_snprintf(str, sizeof str, "priv [ %d ] ", tag);
  else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
    BIO_snprintf(str, sizeof str, "cont [ %d ]", tag);
  else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
    BIO_snprintf(str, sizeof str, "appl [ %d ]", tag);
  else if (tag > 30)
    BIO_snprintf(str, sizeof str, "<ASN1 %d>", tag);
  else
    p = ASN1_tag2str(tag);
  if (p2 != NULL) {
    if (BIO_printf(bp, fmt2, tag, p2) <= 0)
      goto err;
  } else {
    if (BIO_printf(bp, fmt, 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)
movq   $0x0,-0xb0(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e57(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     119f <asn1_print_info+0x4f>
lea    0xe7d(%rip),%rax
mov    %rax,-0xa8(%rbp)
jmp    11ad <asn1_print_info+0x5d>
lea    0xe71(%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    11d0 <asn1_print_info+0x80>
jmp    135f <asn1_print_info+0x20f>
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    0x2dff(%rip),%rcx
and    (%rcx),%eax
mov    0x2df6(%rip),%rcx
cmp    (%rcx),%eax
jne    122a <asn1_print_info+0xda>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xdfe(%rip),%rdx
call   1060 <BIO_snprintf@plt>
jmp    12e8 <asn1_print_info+0x198>
mov    -0x18(%rbp),%eax
mov    0x2d9c(%rip),%rcx
and    (%rcx),%eax
mov    0x2d93(%rip),%rcx
cmp    (%rcx),%eax
jne    1265 <asn1_print_info+0x115>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xdd0(%rip),%rdx
call   1060 <BIO_snprintf@plt>
jmp    12e3 <asn1_print_info+0x193>
mov    -0x18(%rbp),%eax
mov    0x2d51(%rip),%rcx
and    (%rcx),%eax
mov    0x2d48(%rip),%rcx
cmp    (%rcx),%eax
jne    12a0 <asn1_print_info+0x150>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xda1(%rip),%rdx
call   1060 <BIO_snprintf@plt>
jmp    12de <asn1_print_info+0x18e>
cmpl   $0x1e,-0x14(%rbp)
jle    12ca <asn1_print_info+0x17a>
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xd83(%rip),%rdx
call   1060 <BIO_snprintf@plt>
jmp    12d9 <asn1_print_info+0x189>
mov    -0x14(%rbp),%edi
call   1050 <ASN1_tag2str@plt>
mov    %rax,-0xa8(%rbp)
jmp    12de <asn1_print_info+0x18e>
jmp    12e3 <asn1_print_info+0x193>
jmp    12e8 <asn1_print_info+0x198>
cmpq   $0x0,-0xb0(%rbp)
je     1326 <asn1_print_info+0x1d6>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0xb0(%rbp),%rcx
lea    0xcfb(%rip),%rsi
mov    $0x0,%al
call   1040 <BIO_printf@plt>
cmp    $0x0,%rax
jg     1321 <asn1_print_info+0x1d1>
jmp    135f <asn1_print_info+0x20f>
jmp    1353 <asn1_print_info+0x203>
mov    -0x10(%rbp),%rdi
mov    -0xa8(%rbp),%rdx
lea    0xcc8(%rip),%rsi
mov    $0x0,%al
call   1040 <BIO_printf@plt>
cmp    $0x0,%rax
jg     134e <asn1_print_info+0x1fe>
jmp    135f <asn1_print_info+0x20f>
jmp    1353 <asn1_print_info+0x203>
movl   $0x1,-0x4(%rbp)
jmp    1366 <asn1_print_info+0x216>
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    0xe95(%rip),%rax
lea    0xe87(%rip),%rsi
cmove  %rax,%rsi
mov    $0x6,%edx
call   1070 <BIO_write@plt>
cmp    $0x6,%eax
jl     122d <asn1_print_info+0xdd>
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    0xe58(%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    0xe4e(%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    0xe43(%rip),%rdx
jmp    11fc <asn1_print_info+0xac>
cmp    $0x1f,%r14d
jl     123d <asn1_print_info+0xed>
mov    %rsp,%rbp
lea    0xe3d(%rip),%rdx
mov    %rbp,%rdi
mov    $0x80,%esi
mov    %r14d,%ecx
call   1060 <BIO_snprintf@plt>
lea    0xded(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <BIO_printf@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jg     122f <asn1_print_info+0xdf>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14d,%edi
call   1050 <ASN1_tag2str@plt>
mov    %rax,%rbp
jmp    120c <asn1_print_info+0xbc>

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

LLVM IR (-O2):
@asn1_print_info.fmt = internal constant [6 x i8] c"%-18s\00"
@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"
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 @BIO_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 @BIO_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 @BIO_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 @BIO_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 = %19, %31, %37, %35, %25
%40 = phi i8* [ %7, %19 ], [ %7, %25 ], [ %7, %31 ], [ %7, %35 ], [ %38, %37 ]
%41 = call i64 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @asn1_print_info.fmt, 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
}