#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__ {
  char *lname;
  int /*<<< orphan*/ bitnum;
};
typedef TYPE_1__ BIT_STRING_BITNAME;
typedef int /*<<< orphan*/ BIO;
typedef int /*<<< orphan*/ ASN1_BIT_STRING;

/* Variables and functions */
scalar_t__ ASN1_BIT_STRING_get_bit(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ BIO_printf(int /*<<< orphan*/ *, char *, int, char *);
int /*<<< orphan*/ BIO_puts(int /*<<< orphan*/ *, char *);
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
                               BIT_STRING_BITNAME *tbl, int indent) {
  BIT_STRING_BITNAME *bnam;
  char first = 1;
  BIO_printf(out, "%*s", indent, "");
  for (bnam = tbl; bnam->lname; bnam++) {
    if (ASN1_BIT_STRING_get_bit(bs, bnam->bitnum)) {
      if (!first)
        BIO_puts(out, ", ");
      BIO_puts(out, bnam->lname);
      first = 0;
    }
  }
  BIO_puts(out, "\n");
  return 1;
}


x86 assembly (clang, -O0):
<ASN1_BIT_STRING_name_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movb   $0x1,-0x29(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xea7(%rip),%rsi
lea    0xea8(%rip),%rcx
call   1030 <BIO_printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     11d9 <ASN1_BIT_STRING_name_print+0xa9>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%esi
call   1050 <ASN1_BIT_STRING_get_bit@plt>
cmp    $0x0,%rax
je     11c3 <ASN1_BIT_STRING_name_print+0x93>
cmpb   $0x0,-0x29(%rbp)
jne    11af <ASN1_BIT_STRING_name_print+0x7f>
mov    -0x8(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1040 <BIO_puts@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   1040 <BIO_puts@plt>
movb   $0x0,-0x29(%rbp)
jmp    11c8 <ASN1_BIT_STRING_name_print+0x98>
mov    -0x28(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x28(%rbp)
jmp    116d <ASN1_BIT_STRING_name_print+0x3d>
mov    -0x8(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1040 <BIO_puts@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_BIT_STRING_name_print>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xeb8(%rip),%rsi
lea    0xeb9(%rip),%rax
mov    %ecx,%edx
mov    %rax,%rcx
call   1030 <BIO_printf@plt>
cmpq   $0x0,(%rbx)
je     11aa <ASN1_BIT_STRING_name_print+0x7a>
add    $0x10,%rbx
mov    $0x1,%bpl
lea    0xe97(%rip),%r12
jmp    1188 <ASN1_BIT_STRING_name_print+0x58>
nop
mov    -0x10(%rbx),%rsi
mov    %r14,%rdi
call   1040 <BIO_puts@plt>
xor    %ebp,%ebp
cmpq   $0x0,(%rbx)
lea    0x10(%rbx),%rbx
je     11aa <ASN1_BIT_STRING_name_print+0x7a>
mov    -0x8(%rbx),%esi
mov    %r15,%rdi
call   1050 <ASN1_BIT_STRING_get_bit@plt>
test   %rax,%rax
je     117e <ASN1_BIT_STRING_name_print+0x4e>
test   %bpl,%bpl
jne    1170 <ASN1_BIT_STRING_name_print+0x40>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <BIO_puts@plt>
jmp    1170 <ASN1_BIT_STRING_name_print+0x40>
lea    0xe56(%rip),%rsi
mov    %r14,%rdi
call   1040 <BIO_puts@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i8*, i32 }
@.str = [4 x i8] c"%*s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [3 x i8] c", \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @ASN1_BIT_STRING_name_print(i32* %0, i32* %1, %struct.TYPE_3__* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca %struct.TYPE_3__*
%8 = alloca i32
%9 = alloca %struct.TYPE_3__*
%10 = alloca i8
store i32* %0, i32** %5
store i32* %1, i32** %6
store %struct.TYPE_3__* %2, %struct.TYPE_3__** %7
store i32 %3, i32* %8
store i8 1, i8* %10
%11 = load i32*, i32** %5
%12 = load i32, i32* %8
%13 = call i32 @BIO_printf(i32* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%14 = load %struct.TYPE_3__*, %struct.TYPE_3__** %7
store %struct.TYPE_3__* %14, %struct.TYPE_3__** %9
br label %15
15: ; preds = %40, %4
%16 = load %struct.TYPE_3__*, %struct.TYPE_3__** %9
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %16, i32 0, i32 0
%18 = load i8*, i8** %17
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %43
20: ; preds = %15
%21 = load i32*, i32** %6
%22 = load %struct.TYPE_3__*, %struct.TYPE_3__** %9
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = call i64 @ASN1_BIT_STRING_get_bit(i32* %21, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %39
27: ; preds = %20
%28 = load i8, i8* %10
%29 = icmp ne i8 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = load i32*, i32** %5
%32 = call i32 @BIO_puts(i32* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %30, %27
%34 = load i32*, i32** %5
%35 = load %struct.TYPE_3__*, %struct.TYPE_3__** %9
%36 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %35, i32 0, i32 0
%37 = load i8*, i8** %36
%38 = call i32 @BIO_puts(i32* %34, i8* %37)
store i8 0, i8* %10
br label %39
39: ; preds = %33, %20
br label %40
40: ; preds = %39
%41 = load %struct.TYPE_3__*, %struct.TYPE_3__** %9
%42 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %41, i32 1
store %struct.TYPE_3__* %42, %struct.TYPE_3__** %9
br label %15
43: ; preds = %15
%44 = load i32*, i32** %5
%45 = call i32 @BIO_puts(i32* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i8*, i32 }
@.str = [4 x i8] c"%*s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [3 x i8] c", \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @ASN1_BIT_STRING_name_print(i32* %0, i32* %1, %struct.TYPE_3__* nocapture %2, i32 %3) {
%5 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i64 0, i32 0
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %29, label %9
9: ; preds = %4, %24
%10 = phi i8** [ %26, %24 ], [ %6, %4 ]
%11 = phi i8 [ %25, %24 ], [ 1, %4 ]
%12 = getelementptr inbounds i8*, i8** %10, i64 1
%13 = bitcast i8** %12 to i32*
%14 = load i32, i32* %13
%15 = tail call i64 @ASN1_BIT_STRING_get_bit(i32* %1, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %9
%18 = icmp eq i8 %11, 0
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 @BIO_puts(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
%22 = load i8*, i8** %10
%23 = tail call i32 @BIO_puts(i32* %0, i8* %22)
br label %24
24: ; preds = %9, %21
%25 = phi i8 [ 0, %21 ], [ %11, %9 ]
%26 = getelementptr inbounds i8*, i8** %10, i64 2
%27 = load i8*, i8** %26
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %9
29: ; preds = %24, %4
%30 = tail call i32 @BIO_puts(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 1
}