#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*/ *SSL_CTX_new(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *TLS_server_method();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printSSLErr(char *);
int /*<<< orphan*/ stderr;
SSL_CTX *initServerCTX() {
  const SSL_METHOD *method = TLS_server_method();
  if (!method) {
    printSSLErr("initServerCTX() error: method is NULL");
  }
  SSL_CTX *ctx = SSL_CTX_new(method);
  if (!ctx) {
    printSSLErr("initServerCTX() error: ctx is NULL");
  }
  if (!ctx) {
    perror("initServerCTX() error\n");
    ERR_print_errors_fp(stderr);
  }
  return ctx;
}


x86 assembly (clang, -O0):
<initServerCTX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <TLS_server_method@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    117a <initServerCTX+0x2a>
lea    0xe8b(%rip),%rdi
call   1070 <printSSLErr@plt>
mov    -0x8(%rbp),%rdi
call   1040 <SSL_CTX_new@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119e <initServerCTX+0x4e>
lea    0xe8d(%rip),%rdi
call   1070 <printSSLErr@plt>
cmpq   $0x0,-0x10(%rbp)
jne    11c3 <initServerCTX+0x73>
lea    0xe99(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1060 <ERR_print_errors_fp@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initServerCTX>:
push   %rbx
xor    %eax,%eax
call   1030 <TLS_server_method@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    116c <initServerCTX+0x1c>
lea    0xe99(%rip),%rdi
call   1070 <printSSLErr@plt>
mov    %rbx,%rdi
call   1040 <SSL_CTX_new@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1181 <initServerCTX+0x31>
mov    %rbx,%rax
pop    %rbx
ret
lea    0xe9e(%rip),%rdi
call   1070 <printSSLErr@plt>
lea    0xeb5(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1060 <ERR_print_errors_fp@plt>
jmp    117c <initServerCTX+0x2c>

LLVM IR (-O0):
@.str = [38 x i8] c"initServerCTX() error: method is NULL\00"
@.str.1 = [35 x i8] c"initServerCTX() error: ctx is NULL\00"
@.str.2 = [23 x i8] c"initServerCTX() error\0A\00"
@stderr = global i32 0
define i32* @initServerCTX() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* (...) @TLS_server_method()
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp ne i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @printSSLErr(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = load i32*, i32** %1
%10 = call i32* @SSL_CTX_new(i32* %9)
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = icmp ne i32* %11, null
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = call i32 @printSSLErr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
%16 = load i32*, i32** %2
%17 = icmp ne i32* %16, null
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = call i32 @ERR_print_errors_fp(i32 %20)
br label %22
22: ; preds = %18, %15
%23 = load i32*, i32** %2
ret i32* %23
}

LLVM IR (-O2):
@.str = [38 x i8] c"initServerCTX() error: method is NULL\00"
@.str.1 = [35 x i8] c"initServerCTX() error: ctx is NULL\00"
@.str.2 = [23 x i8] c"initServerCTX() error\0A\00"
@stderr = global i32 0
define i32* @initServerCTX() {
%1 = tail call i32* (...) @TLS_server_method()
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @printSSLErr(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32* @SSL_CTX_new(i32* %1)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = tail call i32 @printSSLErr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 @ERR_print_errors_fp(i32 %11)
br label %13
13: ; preds = %5, %8
ret i32* %6
}