#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__ {
  int /*<<< orphan*/ algorithm;
};
typedef TYPE_1__ X509_ALGOR;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int BIO_printf(int /*<<< orphan*/ *, char *, char *);
int NID_undef;
char *OBJ_nid2ln(int);
int OBJ_obj2nid(int /*<<< orphan*/);
int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg) {
  int i = OBJ_obj2nid(alg->algorithm);
  return BIO_printf(bio, "Hash Algorithm: %s\n",
                    (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
}


x86 assembly (clang, -O0):
<TS_X509_ALGOR_print_bio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <OBJ_obj2nid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%eax
jne    1178 <TS_X509_ALGOR_print_bio+0x48>
lea    0xea5(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1184 <TS_X509_ALGOR_print_bio+0x54>
mov    -0x14(%rbp),%edi
call   1050 <OBJ_nid2ln@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe6d(%rip),%rsi
call   1040 <BIO_printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TS_X509_ALGOR_print_bio>:
push   %rbx
mov    %rdi,%rbx
mov    (%rsi),%edi
call   1030 <OBJ_obj2nid@plt>
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
jne    114f <TS_X509_ALGOR_print_bio+0x1f>
lea    0xec7(%rip),%rdx
jmp    1159 <TS_X509_ALGOR_print_bio+0x29>
mov    %eax,%edi
call   1050 <OBJ_nid2ln@plt>
mov    %rax,%rdx
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <BIO_printf@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@.str = [20 x i8] c"Hash Algorithm: %s\0A\00"
@NID_undef = global i32 0
@.str.1 = [8 x i8] c"UNKNOWN\00"
define i32 @TS_X509_ALGOR_print_bio(i32* %0, %struct.TYPE_3__* %1) {
%3 = alloca i32*
%4 = alloca %struct.TYPE_3__*
%5 = alloca i32
store i32* %0, i32** %3
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %4
%6 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @OBJ_obj2nid(i32 %8)
store i32 %9, i32* %5
%10 = load i32*, i32** %3
%11 = load i32, i32* %5
%12 = load i32, i32* @NID_undef
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %2
br label %18
15: ; preds = %2
%16 = load i32, i32* %5
%17 = call i8* @OBJ_nid2ln(i32 %16)
br label %18
18: ; preds = %15, %14
%19 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %14 ], [ %17, %15 ]
%20 = call i32 @BIO_printf(i32* %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@.str = [20 x i8] c"Hash Algorithm: %s\0A\00"
@NID_undef = global i32 0
@.str.1 = [8 x i8] c"UNKNOWN\00"
define i32 @TS_X509_ALGOR_print_bio(i32* %0, %struct.TYPE_3__* nocapture %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = tail call i32 @OBJ_obj2nid(i32 %4)
%6 = load i32, i32* @NID_undef
%7 = icmp eq i32 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i8* @OBJ_nid2ln(i32 %5)
br label %10
10: ; preds = %2, %8
%11 = phi i8* [ %9, %8 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %2 ]
%12 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11)
ret i32 %12
}