#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*/ obj_txt;
typedef int /*<<< orphan*/ BIO;
typedef int /*<<< orphan*/ ASN1_OBJECT;

/* Variables and functions */
int /*<<< orphan*/ BIO_write(int /*<<< orphan*/ *, char *, int);
int OBJ_obj2txt(char *, int, int /*<<< orphan*/ const *, int /*<<< orphan*/);
int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj) {
  char obj_txt[128];
  int len = OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
  if (len >= sizeof(obj_txt))
    len = sizeof(obj_txt) - 1;
  BIO_write(bio, obj_txt, len);
  BIO_write(bio, "\n", 1);
  return 1;
}


x86 assembly (clang, -O0):
<TS_OBJ_print_bio>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x80,%esi
xor    %ecx,%ecx
call   1030 <OBJ_obj2txt@plt>
mov    %eax,-0x94(%rbp)
movslq -0x94(%rbp),%rax
cmp    $0x80,%rax
jb     116d <TS_OBJ_print_bio+0x4d>
movl   $0x7f,-0x94(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    -0x94(%rbp),%edx
call   1040 <BIO_write@plt>
mov    -0x8(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0x1,%edx
call   1040 <BIO_write@plt>
mov    $0x1,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TS_OBJ_print_bio>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
xor    %ecx,%ecx
call   1030 <OBJ_obj2txt@plt>
cmp    $0x7f,%eax
mov    $0x7f,%edx
cmovb  %eax,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <BIO_write@plt>
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <BIO_write@plt>
mov    $0x1,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @TS_OBJ_print_bio(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [128 x i8]
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = load i32*, i32** %4
%9 = call i32 @OBJ_obj2txt(i8* %7, i32 128, i32* %8, i32 0)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = icmp uge i64 %11, 128
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 127, i32* %6
br label %14
14: ; preds = %13, %2
%15 = load i32*, i32** %3
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%17 = load i32, i32* %6
%18 = call i32 @BIO_write(i32* %15, i8* %16, i32 %17)
%19 = load i32*, i32** %3
%20 = call i32 @BIO_write(i32* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 1
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i32 @TS_OBJ_print_bio(i32* %0, i32* %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @OBJ_obj2txt(i8* %4, i32 128, i32* %1, i32 0)
%6 = icmp ult i32 %5, 127
%7 = select i1 %6, i32 %5, i32 127
%8 = call i32 @BIO_write(i32* %0, i8* %4, i32 %7)
%9 = call i32 @BIO_write(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 1
}