#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*/ printf(char *);
int /*<<< orphan*/ stderr;
SSL_CTX *create_context() {
  printf("3\n");
  const SSL_METHOD *method;
  SSL_CTX *ctx;
  method = SSLv23_server_method();
  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
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <SSLv23_server_method@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <SSL_CTX_new@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11bf <create_context+0x5f>
lea    0xe65(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   1080 <ERR_print_errors_fp@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_context>:
push   %rax
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <SSLv23_server_method@plt>
mov    %rax,%rdi
call   1050 <SSL_CTX_new@plt>
test   %rax,%rax
je     1183 <create_context+0x23>
pop    %rcx
ret
lea    0xe76(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1080 <ERR_print_errors_fp@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"3\0A\00"
@.str.1 = [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 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32* (...) @SSLv23_server_method()
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = call i32* @SSL_CTX_new(i32* %5)
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = icmp ne i32* %7, null
br i1 %8, label %15, label %9
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = call i32 @ERR_print_errors_fp(i32 %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = load i32*, i32** %2
ret i32* %16
}

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