#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_METHOD;
typedef int /*<<< orphan*/ SSL_CTX;

/* Variables and functions */
int /*<<< orphan*/ ERR_print_errors_fp(int /*<<< orphan*/);
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ *SSL_CTX_new(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *SSLv23_server_method();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
SSL_CTX *create_context() {
  const SSL_METHOD *method = SSLv23_server_method();
  SSL_CTX *ctx = SSL_CTX_new(method);
  if (!ctx) {
    perror("Unable to create SSL context");
    ERR_print_errors_fp(stderr);
    exit(EXIT_FAILURE);
  }
  return ctx;
}


x86 assembly (clang, -O0):
<create_context>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <SSLv23_server_method@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <SSL_CTX_new@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a3 <create_context+0x53>
lea    0xe7e(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1070 <ERR_print_errors_fp@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_context>:
push   %rax
xor    %eax,%eax
call   1030 <SSLv23_server_method@plt>
mov    %rax,%rdi
call   1040 <SSL_CTX_new@plt>
test   %rax,%rax
je     1167 <create_context+0x17>
pop    %rcx
ret
lea    0xe92(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1070 <ERR_print_errors_fp@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Unable to create SSL context\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define i32* @create_context() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* (...) @SSLv23_server_method()
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = call i32* @SSL_CTX_new(i32* %4)
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = icmp ne i32* %6, null
br i1 %7, label %14, label %8
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%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 = %0
%15 = load i32*, i32** %2
ret i32* %15
}

LLVM IR (-O2):
@.str = [29 x i8] c"Unable to create SSL context\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define i32* @create_context() {
%1 = tail call i32* (...) @SSLv23_server_method()
%2 = tail call i32* @SSL_CTX_new(i32* %1)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%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 = %0
ret i32* %2
}