#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*/ *SSL_CTX_new(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *TLS_client_method();
int /*<<< orphan*/ printSSLErr(char *);
SSL_CTX *initClientCTX() {
  const SSL_METHOD *method = TLS_client_method();
  if (!method) {
    printSSLErr("initClientCTX() error: method is NULL");
  }
  SSL_CTX *ctx = SSL_CTX_new(method);
  if (!ctx) {
    printSSLErr("initClientCTX() error: ctx is NULL");
  }
  return ctx;
}


x86 assembly (clang, -O0):
<initClientCTX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <TLS_client_method@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115a <initClientCTX+0x2a>
lea    0xeab(%rip),%rdi
call   1050 <printSSLErr@plt>
mov    -0x8(%rbp),%rdi
call   1040 <SSL_CTX_new@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117e <initClientCTX+0x4e>
lea    0xead(%rip),%rdi
call   1050 <printSSLErr@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initClientCTX>:
push   %rbx
xor    %eax,%eax
call   1030 <TLS_client_method@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114c <initClientCTX+0x1c>
lea    0xeb9(%rip),%rdi
call   1050 <printSSLErr@plt>
mov    %rbx,%rdi
call   1040 <SSL_CTX_new@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1168 <initClientCTX+0x38>
lea    0xec3(%rip),%rdi
call   1050 <printSSLErr@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"initClientCTX() error: method is NULL\00"
@.str.1 = [35 x i8] c"initClientCTX() error: ctx is NULL\00"
define i32* @initClientCTX() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* (...) @TLS_client_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
ret i32* %16
}

LLVM IR (-O2):
@.str = [38 x i8] c"initClientCTX() error: method is NULL\00"
@.str.1 = [35 x i8] c"initClientCTX() error: ctx is NULL\00"
define i32* @initClientCTX() {
%1 = tail call i32* (...) @TLS_client_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 %10
8: ; preds = %5
%9 = tail call i32 @printSSLErr(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret i32* %6
}