#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*/ FILE;
typedef int /*<<< orphan*/ EC_GROUP;
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 ECPKParameters_print(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, int);
int /*<<< orphan*/ ECerror(int /*<<< orphan*/);
int /*<<< orphan*/ ERR_R_BUF_LIB;
int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off) {
  BIO *b;
  int ret;
  if ((b = BIO_new(BIO_s_file())) == NULL) {
    ECerror(ERR_R_BUF_LIB);
    return (0);
  }
  BIO_set_fp(b, fp, BIO_NOCLOSE);
  ret = ECPKParameters_print(b, x, off);
  BIO_free(b);
  return (ret);
}


x86 assembly (clang, -O0):
<ECPKParameters_print_fp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1080 <BIO_s_file@plt>
mov    %eax,%edi
call   1040 <BIO_new@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11a9 <ECPKParameters_print_fp+0x49>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1030 <ECerror@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <ECPKParameters_print_fp+0x81>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e28(%rip),%rax
mov    (%rax),%edx
call   1070 <BIO_set_fp@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <ECPKParameters_print@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <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):
<ECPKParameters_print_fp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
xor    %eax,%eax
call   1080 <BIO_s_file@plt>
mov    %eax,%edi
call   1040 <BIO_new@plt>
test   %rax,%rax
je     11b6 <ECPKParameters_print_fp+0x56>
mov    %rax,%rbx
mov    0x2e53(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <BIO_set_fp@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1050 <ECPKParameters_print@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <BIO_free@plt>
mov    %ebp,%eax
jmp    11c6 <ECPKParameters_print_fp+0x66>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1030 <ECerror@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@ERR_R_BUF_LIB = global i32 0
@BIO_NOCLOSE = global i32 0
define i32 @ECPKParameters_print_fp(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%10 = call i32 (...) @BIO_s_file()
%11 = call i32* @BIO_new(i32 %10)
store i32* %11, i32** %8
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i32, i32* @ERR_R_BUF_LIB
%15 = call i32 @ECerror(i32 %14)
store i32 0, i32* %4
br label %28
16: ; preds = %3
%17 = load i32*, i32** %8
%18 = load i32*, i32** %5
%19 = load i32, i32* @BIO_NOCLOSE
%20 = call i32 @BIO_set_fp(i32* %17, i32* %18, i32 %19)
%21 = load i32*, i32** %8
%22 = load i32*, i32** %6
%23 = load i32, i32* %7
%24 = call i32 @ECPKParameters_print(i32* %21, i32* %22, i32 %23)
store i32 %24, i32* %9
%25 = load i32*, i32** %8
%26 = call i32 @BIO_free(i32* %25)
%27 = load i32, i32* %9
store i32 %27, i32* %4
br label %28
28: ; preds = %16, %13
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
@ERR_R_BUF_LIB = global i32 0
@BIO_NOCLOSE = global i32 0
define i32 @ECPKParameters_print_fp(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 (...) @BIO_s_file()
%5 = tail call i32* @BIO_new(i32 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* @ERR_R_BUF_LIB
%9 = tail call i32 @ECerror(i32 %8)
br label %15
10: ; preds = %3
%11 = load i32, i32* @BIO_NOCLOSE
%12 = tail call i32 @BIO_set_fp(i32* %5, i32* %0, i32 %11)
%13 = tail call i32 @ECPKParameters_print(i32* %5, i32* %1, i32 %2)
%14 = tail call i32 @BIO_free(i32* %5)
br label %15
15: ; preds = %10, %7
%16 = phi i32 [ 0, %7 ], [ %13, %10 ]
ret i32 %16
}