#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;
int /*<<< orphan*/ SSL_CTX_set_ecdh_auto(int /*<<< orphan*/ *, int);
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) {
  SSL_CTX_set_ecdh_auto(ctx, 1);
  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    $0x1,%esi
call   1040 <SSL_CTX_set_ecdh_auto@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
lea    0xe82(%rip),%rsi
call   1030 <SSL_CTX_use_certificate_file@plt>
cmp    $0x0,%rax
jge    11a9 <configure_context+0x59>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1070 <ERR_print_errors_fp@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e34(%rip),%rax
mov    (%rax),%edx
lea    0xe4c(%rip),%rsi
call   1050 <SSL_CTX_use_PrivateKey_file@plt>
cmp    $0x0,%rax
jge    11e8 <configure_context+0x98>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1070 <ERR_print_errors_fp@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configure_context>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%esi
call   1040 <SSL_CTX_set_ecdh_auto@plt>
mov    0x2e80(%rip),%r14
mov    (%r14),%edx
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <SSL_CTX_use_certificate_file@plt>
test   %rax,%rax
js     119e <configure_context+0x4e>
mov    (%r14),%edx
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
call   1050 <SSL_CTX_use_PrivateKey_file@plt>
test   %rax,%rax
js     119e <configure_context+0x4e>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1070 <ERR_print_errors_fp@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
call   1060 <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 = call i32 @SSL_CTX_set_ecdh_auto(i32* %3, i32 1)
%5 = load i32*, i32** %2
%6 = load i32, i32* @SSL_FILETYPE_PEM
%7 = call i64 @SSL_CTX_use_certificate_file(i32* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @ERR_print_errors_fp(i32 %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load i32*, i32** %2
%16 = load i32, i32* @SSL_FILETYPE_PEM
%17 = call i64 @SSL_CTX_use_PrivateKey_file(i32* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = call i32 @ERR_print_errors_fp(i32 %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %14
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 = tail call i32 @SSL_CTX_set_ecdh_auto(i32* %0, i32 1)
%3 = load i32, i32* @SSL_FILETYPE_PEM
%4 = 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 %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @ERR_print_errors_fp(i32 %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = load i32, i32* @SSL_FILETYPE_PEM
%13 = 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 %12)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = tail call i32 @ERR_print_errors_fp(i32 %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %11
ret void
}