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

/* Variables and functions */
int /*<<< orphan*/ BIO_NOCLOSE;
int /*<<< orphan*/ BIO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BIO_new_fp(int /*<<< orphan*/ *, int /*<<< orphan*/);
int X509V3_EXT_print(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int, int);
int X509V3_EXT_print_fp(FILE *fp, X509_EXTENSION *ext, int flag, int indent) {
  BIO *bio_tmp;
  int ret;
  if (!(bio_tmp = BIO_new_fp(fp, BIO_NOCLOSE)))
    return 0;
  ret = X509V3_EXT_print(bio_tmp, ext, flag, indent);
  BIO_free(bio_tmp);
  return ret;
}


x86 assembly (clang, -O0):
<X509V3_EXT_print_fp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
call   1030 <BIO_new_fp@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1172 <X509V3_EXT_print_fp+0x42>
movl   $0x0,-0x4(%rbp)
jmp    1197 <X509V3_EXT_print_fp+0x67>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <X509V3_EXT_print@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <BIO_free@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509V3_EXT_print_fp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <BIO_new_fp@plt>
test   %rax,%rax
je     1175 <X509V3_EXT_print_fp+0x45>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1040 <X509V3_EXT_print@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1050 <BIO_free@plt>
mov    %ebx,%eax
jmp    1177 <X509V3_EXT_print_fp+0x47>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BIO_NOCLOSE = global i32 0
define i32 @X509V3_EXT_print_fp(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%12 = load i32*, i32** %6
%13 = load i32, i32* @BIO_NOCLOSE
%14 = call i32* @BIO_new_fp(i32* %12, i32 %13)
store i32* %14, i32** %10
%15 = icmp ne i32* %14, null
br i1 %15, label %17, label %16
16: ; preds = %4
store i32 0, i32* %5
br label %26
17: ; preds = %4
%18 = load i32*, i32** %10
%19 = load i32*, i32** %7
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = call i32 @X509V3_EXT_print(i32* %18, i32* %19, i32 %20, i32 %21)
store i32 %22, i32* %11
%23 = load i32*, i32** %10
%24 = call i32 @BIO_free(i32* %23)
%25 = load i32, i32* %11
store i32 %25, i32* %5
br label %26
26: ; preds = %17, %16
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
@BIO_NOCLOSE = global i32 0
define i32 @X509V3_EXT_print_fp(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = load i32, i32* @BIO_NOCLOSE
%6 = tail call i32* @BIO_new_fp(i32* %0, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = tail call i32 @X509V3_EXT_print(i32* %6, i32* %1, i32 %2, i32 %3)
%10 = tail call i32 @BIO_free(i32* %6)
br label %11
11: ; preds = %4, %8
%12 = phi i32 [ %9, %8 ], [ 0, %4 ]
ret i32 %12
}