#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;

/* Variables and functions */
int /*<<< orphan*/ OPENSSL_add_all_algorithms_conf();
int /*<<< orphan*/
PEM_write_RSAPrivateKey(int /*<<< orphan*/, int /*<<< orphan*/ *,
                        int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                        int /*<<< orphan*/, int /*<<< orphan*/ *,
                        int /*<<< orphan*/);
int /*<<< orphan*/ RSA_F4;
int /*<<< orphan*/ *RSA_generate_key(int, int /*<<< orphan*/,
                                     int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main(int argc, const char *argv[]) {
  OPENSSL_add_all_algorithms_conf();
  RSA *rsa = RSA_generate_key(1024, RSA_F4, NULL, NULL);
  PEM_write_RSAPrivateKey(stdout, rsa, NULL, NULL, 0, NULL, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <OPENSSL_add_all_algorithms_conf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
mov    $0x400,%edi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1050 <RSA_generate_key@plt>
mov    %rax,-0x18(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r9d
xor    %r8d,%r8d
mov    %r9,%rdx
mov    %r9,%rcx
movl   $0x0,(%rsp)
call   1040 <PEM_write_RSAPrivateKey@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <OPENSSL_add_all_algorithms_conf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    $0x400,%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <RSA_generate_key@plt>
mov    0x2e8a(%rip),%rcx
mov    (%rcx),%edi
movl   $0x0,(%rsp)
mov    %rax,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <PEM_write_RSAPrivateKey@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RSA_F4 = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @OPENSSL_add_all_algorithms_conf()
%8 = load i32, i32* @RSA_F4
%9 = call i32* @RSA_generate_key(i32 1024, i32 %8, i32* null, i32* null)
store i32* %9, i32** %6
%10 = load i32, i32* @stdout
%11 = load i32*, i32** %6
%12 = call i32 @PEM_write_RSAPrivateKey(i32 %10, i32* %11, i32* null, i32* null, i32 0, i32* null, i32 0)
ret i32 0
}

LLVM IR (-O2):
@RSA_F4 = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @OPENSSL_add_all_algorithms_conf()
%4 = load i32, i32* @RSA_F4
%5 = tail call i32* @RSA_generate_key(i32 1024, i32 %4, i32* null, i32* null)
%6 = load i32, i32* @stdout
%7 = tail call i32 @PEM_write_RSAPrivateKey(i32 %6, i32* %5, i32* null, i32* null, i32 0, i32* null, i32 0)
ret i32 0
}