#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*/ EXIT_FAILURE;
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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void configure_context(SSL_CTX *ctx) {
  if (SSL_CTX_use_certificate_file(ctx, "cert.pem", SSL_FILETYPE_PEM) <= 0) {
    ERR_print_errors_fp(stderr);
    exit(EXIT_FAILURE);
  }
  if (SSL_CTX_use_PrivateKey_file(ctx, "key.pem", SSL_FILETYPE_PEM) <= 0) {
    ERR_print_errors_fp(stderr);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<configure_context>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
lea    0xea0(%rip),%rsi
call   1030 <SSL_CTX_use_certificate_file@plt>
cmp    $0x0,%rax
jg     118b <configure_context+0x4b>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1060 <ERR_print_errors_fp@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e52(%rip),%rax
mov    (%rax),%edx
lea    0xe6a(%rip),%rsi
call   1040 <SSL_CTX_use_PrivateKey_file@plt>
cmp    $0x0,%rax
jg     11ca <configure_context+0x8a>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1060 <ERR_print_errors_fp@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configure_context>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e9a(%rip),%r14
mov    (%r14),%edx
lea    0xea8(%rip),%rsi
call   1030 <SSL_CTX_use_certificate_file@plt>
test   %rax,%rax
jle    1181 <configure_context+0x41>
mov    (%r14),%edx
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <SSL_CTX_use_PrivateKey_file@plt>
test   %rax,%rax
jle    1181 <configure_context+0x41>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1060 <ERR_print_errors_fp@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"cert.pem\00"
@SSL_FILETYPE_PEM = global i32 0
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [8 x i8] c"key.pem\00"
define void @configure_context(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @SSL_FILETYPE_PEM
%5 = call i64 @SSL_CTX_use_certificate_file(i32* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp sle i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @ERR_print_errors_fp(i32 %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
%13 = load i32*, i32** %2
%14 = load i32, i32* @SSL_FILETYPE_PEM
%15 = call i64 @SSL_CTX_use_PrivateKey_file(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = icmp sle i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = call i32 @ERR_print_errors_fp(i32 %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"cert.pem\00"
@SSL_FILETYPE_PEM = global i32 0
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [8 x i8] c"key.pem\00"
define void @configure_context(i32* %0) {
%2 = load i32, i32* @SSL_FILETYPE_PEM
%3 = tail call i64 @SSL_CTX_use_certificate_file(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp slt i64 %3, 1
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @ERR_print_errors_fp(i32 %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
%11 = load i32, i32* @SSL_FILETYPE_PEM
%12 = tail call i64 @SSL_CTX_use_PrivateKey_file(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = icmp slt i64 %12, 1
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = tail call i32 @ERR_print_errors_fp(i32 %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %10
ret void
}