#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ type;
  int flags;
  scalar_t__ length;
  scalar_t__ data;
};
typedef int /*<<< orphan*/ BIO;
typedef TYPE_1__ ASN1_STRING;
typedef int /*<<< orphan*/ ASN1_PCTX;

/* Variables and functions */
scalar_t__ BIO_dump_indent(int /*<<< orphan*/ *, char *, scalar_t__, int);
scalar_t__ BIO_printf(int /*<<< orphan*/ *, char *, int);
scalar_t__ BIO_puts(int /*<<< orphan*/ *, char *);
scalar_t__ V_ASN1_BIT_STRING;
int asn1_print_obstring_ctx(BIO *out, ASN1_STRING *str, int indent,
                            const ASN1_PCTX *pctx) {
  if (str->type == V_ASN1_BIT_STRING) {
    if (BIO_printf(out, " (%ld unused bits)\n", str->flags & 0x7) <= 0)
      return 0;
  } else if (BIO_puts(out, "\n") <= 0)
    return 0;
  if ((str->length > 0) &&
      BIO_dump_indent(out, (char *)str->data, str->length, indent + 2) <= 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<asn1_print_obstring_ctx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%rax
jne    1193 <asn1_print_obstring_ctx+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edx
and    $0x7,%edx
lea    0xe8d(%rip),%rsi
call   1030 <BIO_printf@plt>
cmp    $0x0,%rax
jg     118e <asn1_print_obstring_ctx+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    1209 <asn1_print_obstring_ctx+0xd9>
jmp    11be <asn1_print_obstring_ctx+0x8e>
mov    -0x10(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1050 <BIO_puts@plt>
cmp    $0x0,%rax
jg     11b9 <asn1_print_obstring_ctx+0x89>
movl   $0x0,-0x4(%rbp)
jmp    1209 <asn1_print_obstring_ctx+0xd9>
jmp    11be <asn1_print_obstring_ctx+0x8e>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jle    1202 <asn1_print_obstring_ctx+0xd2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
call   1040 <BIO_dump_indent@plt>
cmp    $0x0,%rax
jg     1202 <asn1_print_obstring_ctx+0xd2>
movl   $0x0,-0x4(%rbp)
jmp    1209 <asn1_print_obstring_ctx+0xd9>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_print_obstring_ctx>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    (%rsi),%rax
mov    0x2eb1(%rip),%rcx
cmp    (%rcx),%rax
jne    1168 <asn1_print_obstring_ctx+0x38>
mov    0x8(%rbp),%edx
and    $0x7,%edx
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <BIO_printf@plt>
test   %rax,%rax
jg     117c <asn1_print_obstring_ctx+0x4c>
jmp    11a4 <asn1_print_obstring_ctx+0x74>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1050 <BIO_puts@plt>
test   %rax,%rax
jle    11a4 <asn1_print_obstring_ctx+0x74>
mov    0x10(%rbp),%rdx
test   %rdx,%rdx
jle    119d <asn1_print_obstring_ctx+0x6d>
mov    0x18(%rbp),%rsi
add    $0x2,%r14d
mov    %rbx,%rdi
mov    %r14d,%ecx
call   1040 <BIO_dump_indent@plt>
test   %rax,%rax
jle    11a4 <asn1_print_obstring_ctx+0x74>
mov    $0x1,%eax
jmp    11a6 <asn1_print_obstring_ctx+0x76>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i32, i64, i64 }
@V_ASN1_BIT_STRING = global i64 0
@.str = [20 x i8] c" (%ld unused bits)\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @asn1_print_obstring_ctx(i32* %0, %struct.TYPE_3__* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca %struct.TYPE_3__*
%8 = alloca i32
%9 = alloca i32*
store i32* %0, i32** %6
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%10 = load %struct.TYPE_3__*, %struct.TYPE_3__** %7
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 0
%12 = load i64, i64* %11
%13 = load i64, i64* @V_ASN1_BIT_STRING
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %4
%16 = load i32*, i32** %6
%17 = load %struct.TYPE_3__*, %struct.TYPE_3__** %7
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %17, i32 0, i32 1
%19 = load i32, i32* %18
%20 = and i32 %19, 7
%21 = call i64 @BIO_printf(i32* %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = icmp sle i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %15
store i32 0, i32* %5
br label %51
24: ; preds = %15
br label %31
25: ; preds = %4
%26 = load i32*, i32** %6
%27 = call i64 @BIO_puts(i32* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp sle i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 0, i32* %5
br label %51
30: ; preds = %25
br label %31
31: ; preds = %30, %24
%32 = load %struct.TYPE_3__*, %struct.TYPE_3__** %7
%33 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %32, i32 0, i32 2
%34 = load i64, i64* %33
%35 = icmp sgt i64 %34, 0
br i1 %35, label %36, label %50
36: ; preds = %31
%37 = load i32*, i32** %6
%38 = load %struct.TYPE_3__*, %struct.TYPE_3__** %7
%39 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %38, i32 0, i32 3
%40 = load i64, i64* %39
%41 = inttoptr i64 %40 to i8*
%42 = load %struct.TYPE_3__*, %struct.TYPE_3__** %7
%43 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %42, i32 0, i32 2
%44 = load i64, i64* %43
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 2
%47 = call i64 @BIO_dump_indent(i32* %37, i8* %41, i64 %44, i32 %46)
%48 = icmp sle i64 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %36
store i32 0, i32* %5
br label %51
50: ; preds = %36, %31
store i32 1, i32* %5
br label %51
51: ; preds = %50, %49, %29, %23
%52 = load i32, i32* %5
ret i32 %52
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64, i32, i64, i64 }
@V_ASN1_BIT_STRING = global i64 0
@.str = [20 x i8] c" (%ld unused bits)\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @asn1_print_obstring_ctx(i32* %0, %struct.TYPE_3__* nocapture %1, i32 %2, i32* nocapture readnone %3) {
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = load i64, i64* @V_ASN1_BIT_STRING
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
%11 = load i32, i32* %10
%12 = and i32 %11, 7
%13 = tail call i64 @BIO_printf(i32* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = icmp slt i64 %13, 1
br i1 %14, label %30, label %18
15: ; preds = %4
%16 = tail call i64 @BIO_puts(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp slt i64 %16, 1
br i1 %17, label %30, label %18
18: ; preds = %15, %9
%19 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 2
%20 = load i64, i64* %19
%21 = icmp sgt i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 3
%24 = load i64, i64* %23
%25 = inttoptr i64 %24 to i8*
%26 = add nsw i32 %2, 2
%27 = tail call i64 @BIO_dump_indent(i32* %0, i8* %25, i64 %20, i32 %26)
%28 = icmp slt i64 %27, 1
br i1 %28, label %30, label %29
29: ; preds = %22, %18
br label %30
30: ; preds = %22, %15, %9, %29
%31 = phi i32 [ 1, %29 ], [ 0, %9 ], [ 0, %15 ], [ 0, %22 ]
ret i32 %31
}