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

/* Variables and functions */
int /*<<< orphan*/ ERR_print_errors_fp(int /*<<< orphan*/);
int /*<<< orphan*/ SSL_CTX_check_private_key(int /*<<< orphan*/ *);
scalar_t__ SSL_CTX_use_PrivateKey_file(int /*<<< orphan*/ *, char *,
                                       int /*<<< orphan*/);
scalar_t__ SSL_CTX_use_certificate_file(int /*<<< orphan*/ *, char *,
                                        int /*<<< orphan*/);
int /*<<< orphan*/ SSL_FILETYPE_PEM;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void loadCerts(SSL_CTX *ctx, char *CertFile, char *KeyFile) {
  int x = 0;
  if (SSL_CTX_use_certificate_file(ctx, CertFile, SSL_FILETYPE_PEM) <= 0) {
    ERR_print_errors_fp(stderr);
    abort();
  }
  if (SSL_CTX_use_PrivateKey_file(ctx, KeyFile, SSL_FILETYPE_PEM) <= 0) {
    ERR_print_errors_fp(stderr);
    abort();
  }
  if (!SSL_CTX_check_private_key(ctx)) {
    fprintf(stderr, "Private key does not match the public certificate\n");
    abort();
  }
}


x86 assembly (clang, -O0):
<loadCerts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e5e(%rip),%rax
mov    (%rax),%edx
call   1040 <SSL_CTX_use_certificate_file@plt>
cmp    $0x0,%rax
jg     11b0 <loadCerts+0x50>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   1080 <ERR_print_errors_fp@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2e29(%rip),%rax
mov    (%rax),%edx
call   1060 <SSL_CTX_use_PrivateKey_file@plt>
cmp    $0x0,%rax
jg     11e5 <loadCerts+0x85>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1080 <ERR_print_errors_fp@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1070 <SSL_CTX_check_private_key@plt>
cmp    $0x0,%eax
jne    1213 <loadCerts+0xb3>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
lea    0xdf9(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadCerts>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rbx
mov    0x2e76(%rip),%r15
mov    (%r15),%edx
call   1040 <SSL_CTX_use_certificate_file@plt>
test   %rax,%rax
jle    11a4 <loadCerts+0x44>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <SSL_CTX_use_PrivateKey_file@plt>
test   %rax,%rax
jle    11a4 <loadCerts+0x44>
mov    %rbx,%rdi
call   1070 <SSL_CTX_check_private_key@plt>
test   %eax,%eax
je     11b9 <loadCerts+0x59>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1080 <ERR_print_errors_fp@plt>
xor    %eax,%eax
call   1030 <abort@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@SSL_FILETYPE_PEM = global i32 0
@stderr = global i32 0
@.str = [51 x i8] c"Private key does not match the public certificate\0A\00"
define void @loadCerts(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 0, i32* %7
%8 = load i32*, i32** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* @SSL_FILETYPE_PEM
%11 = call i64 @SSL_CTX_use_certificate_file(i32* %8, i8* %9, i32 %10)
%12 = icmp sle i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = call i32 @ERR_print_errors_fp(i32 %14)
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %3
%18 = load i32*, i32** %4
%19 = load i8*, i8** %6
%20 = load i32, i32* @SSL_FILETYPE_PEM
%21 = call i64 @SSL_CTX_use_PrivateKey_file(i32* %18, i8* %19, i32 %20)
%22 = icmp sle i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load i32, i32* @stderr
%25 = call i32 @ERR_print_errors_fp(i32 %24)
%26 = call i32 (...) @abort()
unreachable
27: ; preds = %17
%28 = load i32*, i32** %4
%29 = call i32 @SSL_CTX_check_private_key(i32* %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%34 = call i32 (...) @abort()
unreachable
35: ; preds = %27
ret void
}

LLVM IR (-O2):
@SSL_FILETYPE_PEM = global i32 0
@stderr = global i32 0
@.str = [51 x i8] c"Private key does not match the public certificate\0A\00"
define void @loadCerts(i32* %0, i8* %1, i8* %2) {
%4 = load i32, i32* @SSL_FILETYPE_PEM
%5 = tail call i64 @SSL_CTX_use_certificate_file(i32* %0, i8* %1, i32 %4)
%6 = icmp slt i64 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @ERR_print_errors_fp(i32 %8)
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %3
%12 = load i32, i32* @SSL_FILETYPE_PEM
%13 = tail call i64 @SSL_CTX_use_PrivateKey_file(i32* %0, i8* %2, i32 %12)
%14 = icmp slt i64 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = tail call i32 @ERR_print_errors_fp(i32 %16)
%18 = tail call i32 (...) @abort()
unreachable
19: ; preds = %11
%20 = tail call i32 @SSL_CTX_check_private_key(i32* %0)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 (...) @abort()
unreachable
26: ; preds = %19
ret void
}