#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 */

/* Variables and functions */
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
int /*<<< orphan*/ OpenSSL_add_all_ciphers();
int /*<<< orphan*/ OpenSSL_add_all_digests();
int SSL_library_init();
int /*<<< orphan*/ SSL_load_error_strings();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int rsa_init(void) {
  int ret;
  ret = SSL_library_init();
  if (!ret) {
    fprintf(stderr, "Failure to init SSL library\n");
    return -1;
  }
  SSL_load_error_strings();
  OpenSSL_add_all_algorithms();
  OpenSSL_add_all_digests();
  OpenSSL_add_all_ciphers();
  return 0;
}


x86 assembly (clang, -O0):
<rsa_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <SSL_library_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    119d <rsa_init+0x3d>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c0 <rsa_init+0x60>
mov    $0x0,%al
call   1080 <SSL_load_error_strings@plt>
mov    $0x0,%al
call   1060 <OpenSSL_add_all_algorithms@plt>
mov    $0x0,%al
call   1040 <OpenSSL_add_all_digests@plt>
mov    $0x0,%al
call   1070 <OpenSSL_add_all_ciphers@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsa_init>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <SSL_library_init@plt>
test   %eax,%eax
je     118c <rsa_init+0x2c>
xor    %eax,%eax
call   1080 <SSL_load_error_strings@plt>
xor    %eax,%eax
call   1060 <OpenSSL_add_all_algorithms@plt>
xor    %eax,%eax
call   1040 <OpenSSL_add_all_digests@plt>
xor    %eax,%eax
call   1070 <OpenSSL_add_all_ciphers@plt>
jmp    11a6 <rsa_init+0x46>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Failure to init SSL library\0A\00"
define i32 @rsa_init() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @SSL_library_init()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %14
9: ; preds = %0
%10 = call i32 (...) @SSL_load_error_strings()
%11 = call i32 (...) @OpenSSL_add_all_algorithms()
%12 = call i32 (...) @OpenSSL_add_all_digests()
%13 = call i32 (...) @OpenSSL_add_all_ciphers()
store i32 0, i32* %1
br label %14
14: ; preds = %9, %6
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Failure to init SSL library\0A\00"
define i32 @rsa_init() {
%1 = tail call i32 (...) @SSL_library_init()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %11
6: ; preds = %0
%7 = tail call i32 (...) @SSL_load_error_strings()
%8 = tail call i32 (...) @OpenSSL_add_all_algorithms()
%9 = tail call i32 (...) @OpenSSL_add_all_digests()
%10 = tail call i32 (...) @OpenSSL_add_all_ciphers()
br label %11
11: ; preds = %6, %3
%12 = phi i32 [ 0, %6 ], [ -1, %3 ]
ret i32 %12
}