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

/* Variables and functions */
scalar_t__ BIO_printf(int /*<<< orphan*/ *, char *, char const *, char *);
char *OBJ_nid2ln(int /*<<< orphan*/);
int /*<<< orphan*/ OBJ_obj2nid(int /*<<< orphan*/ const *);
int /*<<< orphan*/ OBJ_obj2txt(char *, int, int /*<<< orphan*/ const *, int);
int asn1_print_oid_ctx(BIO *out, const ASN1_OBJECT *oid,
                       const ASN1_PCTX *pctx) {
  char objbuf[80];
  const char *ln;
  ln = OBJ_nid2ln(OBJ_obj2nid(oid));
  if (!ln)
    ln = "";
  OBJ_obj2txt(objbuf, sizeof objbuf, oid, 1);
  if (BIO_printf(out, "%s (%s)", ln, objbuf) <= 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<asn1_print_oid_ctx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <OBJ_obj2nid@plt>
mov    %eax,%edi
call   1050 <OBJ_nid2ln@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    1181 <asn1_print_oid_ctx+0x41>
lea    0xe8a(%rip),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x50,%esi
mov    $0x1,%ecx
call   1060 <OBJ_obj2txt@plt>
mov    -0x10(%rbp),%rdi
mov    -0x78(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    0xe55(%rip),%rsi
call   1040 <BIO_printf@plt>
cmp    $0x0,%rax
jg     11c6 <asn1_print_oid_ctx+0x86>
movl   $0x0,-0x4(%rbp)
jmp    11cd <asn1_print_oid_ctx+0x8d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_print_oid_ctx>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <OBJ_obj2nid@plt>
mov    %eax,%edi
call   1050 <OBJ_nid2ln@plt>
test   %rax,%rax
lea    0xe9d(%rip),%rbx
cmovne %rax,%rbx
mov    %rsp,%r12
mov    %r12,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
mov    $0x1,%ecx
call   1060 <OBJ_obj2txt@plt>
lea    0xe73(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1040 <BIO_printf@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
mov    %ecx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"%s (%s)\00"
define i32 @asn1_print_oid_ctx(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [80 x i8]
%9 = alloca i8*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%10 = load i32*, i32** %6
%11 = call i32 @OBJ_obj2nid(i32* %10)
%12 = call i8* @OBJ_nid2ln(i32 %11)
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = icmp ne i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %9
br label %16
16: ; preds = %15, %3
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%18 = load i32*, i32** %6
%19 = call i32 @OBJ_obj2txt(i8* %17, i32 80, i32* %18, i32 1)
%20 = load i32*, i32** %5
%21 = load i8*, i8** %9
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%23 = call i64 @BIO_printf(i32* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %22)
%24 = icmp sle i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %16
store i32 0, i32* %4
br label %27
26: ; preds = %16
store i32 1, i32* %4
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"%s (%s)\00"
define i32 @asn1_print_oid_ctx(i32* %0, i32* %1, i32* nocapture readnone %2) {
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @OBJ_obj2nid(i32* %1)
%7 = tail call i8* @OBJ_nid2ln(i32 %6)
%8 = icmp eq i8* %7, null
%9 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %7
%10 = call i32 @OBJ_obj2txt(i8* %5, i32 80, i32* %1, i32 1)
%11 = call i64 @BIO_printf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %5)
%12 = icmp sgt i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}