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

/* Variables and functions */
int /*<<< orphan*/ EVP_PKEY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_new();
scalar_t__ EVP_PKEY_print_private(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  int, int /*<<< orphan*/ *);
scalar_t__ EVP_PKEY_set1_RSA(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int RSA_print(BIO *bio, const RSA *rsa, int indent) {
  EVP_PKEY *pkey = EVP_PKEY_new();
  int ret = pkey != NULL && EVP_PKEY_set1_RSA(pkey, (RSA *)rsa) &&
            EVP_PKEY_print_private(bio, pkey, indent, NULL);
  EVP_PKEY_free(pkey);
  return ret;
}


x86 assembly (clang, -O0):
<RSA_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1050 <EVP_PKEY_new@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x25(%rbp)
je     11ab <RSA_print+0x6b>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <EVP_PKEY_set1_RSA@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x25(%rbp)
je     11ab <RSA_print+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <EVP_PKEY_print_private@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <EVP_PKEY_free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RSA_print>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%r12
mov    %rdi,%r15
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <EVP_PKEY_new@plt>
mov    %rax,%rbx
test   %rax,%rax
je     118b <RSA_print+0x4b>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <EVP_PKEY_set1_RSA@plt>
test   %rax,%rax
je     118b <RSA_print+0x4b>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
call   1040 <EVP_PKEY_print_private@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %rbx,%rdi
call   1030 <EVP_PKEY_free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @RSA_print(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = call i32* (...) @EVP_PKEY_new()
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %23
12: ; preds = %3
%13 = load i32*, i32** %7
%14 = load i32*, i32** %5
%15 = call i64 @EVP_PKEY_set1_RSA(i32* %13, i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i32*, i32** %4
%19 = load i32*, i32** %7
%20 = load i32, i32* %6
%21 = call i64 @EVP_PKEY_print_private(i32* %18, i32* %19, i32 %20, i32* null)
%22 = icmp ne i64 %21, 0
br label %23
23: ; preds = %17, %12, %3
%24 = phi i1 [ false, %12 ], [ false, %3 ], [ %22, %17 ]
%25 = zext i1 %24 to i32
store i32 %25, i32* %8
%26 = load i32*, i32** %7
%27 = call i32 @EVP_PKEY_free(i32* %26)
%28 = load i32, i32* %8
ret i32 %28
}

LLVM IR (-O2):
define i32 @RSA_print(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32* (...) @EVP_PKEY_new()
%5 = icmp eq i32* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i64 @EVP_PKEY_set1_RSA(i32* %4, i32* %1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i64 @EVP_PKEY_print_private(i32* %0, i32* %4, i32 %2, i32* null)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3
%14 = phi i32 [ 0, %6 ], [ 0, %3 ], [ %12, %9 ]
%15 = tail call i32 @EVP_PKEY_free(i32* %4)
ret i32 %14
}