#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*/ _LHASH;
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(int /*<<< orphan*/);
int /*<<< orphan*/ BIO_s_file();
int /*<<< orphan*/ BIO_set_fp(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                              int /*<<< orphan*/);
int /*<<< orphan*/ lh_stats_bio(int /*<<< orphan*/ const *,
                                int /*<<< orphan*/ *);
void lh_stats(const _LHASH *lh, FILE *fp) {
  BIO *bp;
  bp = BIO_new(BIO_s_file());
  if (bp == NULL)
    goto end;
  BIO_set_fp(bp, fp, BIO_NOCLOSE);
  lh_stats_bio(lh, bp);
  BIO_free(bp);
end:;
}


x86 assembly (clang, -O0):
<lh_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <BIO_s_file@plt>
mov    %eax,%edi
call   1030 <BIO_new@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1182 <lh_stats+0x32>
jmp    11ae <lh_stats+0x5e>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e57(%rip),%rax
mov    (%rax),%edx
call   1060 <BIO_set_fp@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <lh_stats_bio@plt>
mov    -0x18(%rbp),%rdi
call   1040 <BIO_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lh_stats>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <BIO_s_file@plt>
mov    %eax,%edi
call   1030 <BIO_new@plt>
test   %rax,%rax
je     119d <lh_stats+0x4d>
mov    %rax,%rbx
mov    0x2e70(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <BIO_set_fp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <lh_stats_bio@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <BIO_free@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@BIO_NOCLOSE = global i32 0
define void @lh_stats(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = call i32 (...) @BIO_s_file()
%7 = call i32* @BIO_new(i32 %6)
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
br label %21
11: ; preds = %2
%12 = load i32*, i32** %5
%13 = load i32*, i32** %4
%14 = load i32, i32* @BIO_NOCLOSE
%15 = call i32 @BIO_set_fp(i32* %12, i32* %13, i32 %14)
%16 = load i32*, i32** %3
%17 = load i32*, i32** %5
%18 = call i32 @lh_stats_bio(i32* %16, i32* %17)
%19 = load i32*, i32** %5
%20 = call i32 @BIO_free(i32* %19)
br label %21
21: ; preds = %11, %10
ret void
}

LLVM IR (-O2):
@BIO_NOCLOSE = global i32 0
define void @lh_stats(i32* %0, i32* %1) {
%3 = tail call i32 (...) @BIO_s_file()
%4 = tail call i32* @BIO_new(i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @BIO_NOCLOSE
%8 = tail call i32 @BIO_set_fp(i32* %4, i32* %1, i32 %7)
%9 = tail call i32 @lh_stats_bio(i32* %0, i32* %4)
%10 = tail call i32 @BIO_free(i32* %4)
br label %11
11: ; preds = %2, %6
ret void
}