#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*/ X509;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ BIO_NOCLOSE;
int /*<<< orphan*/ *BIO_new_fp(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *load_cert(int /*<<< orphan*/ *, char *, int,
                              int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                              char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ protocol_checkcert(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void main() {
  X509 *cert;
  BIO *bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
  cert = load_cert(bio_err, "../test/client1cert.pem", 3, NULL, NULL,
                   "Certificate");
  if (cert == NULL)
    printf("Error");
  protocol_checkcert(NULL, cert);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
call   1030 <BIO_new_fp@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
mov    $0x3,%edx
xor    %eax,%eax
mov    %eax,%r8d
lea    0xe99(%rip),%r9
mov    %r8,%rcx
call   1060 <load_cert@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11a2 <main+0x62>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1050 <protocol_checkcert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
call   1030 <BIO_new_fp@plt>
lea    0xea1(%rip),%rsi
lea    0xeb2(%rip),%r9
mov    %rax,%rdi
mov    $0x3,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <load_cert@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    118c <main+0x4c>
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <protocol_checkcert@plt>

LLVM IR (-O0):
@stderr = global i32 0
@BIO_NOCLOSE = global i32 0
@.str = [24 x i8] c"../test/client1cert.pem\00"
@.str.1 = [12 x i8] c"Certificate\00"
@.str.2 = [6 x i8] c"Error\00"
define void @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = load i32, i32* @stderr
%4 = load i32, i32* @BIO_NOCLOSE
%5 = call i32* @BIO_new_fp(i32 %3, i32 %4)
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = call i32* @load_cert(i32* %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 3, i32* null, i32* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %1
%8 = load i32*, i32** %1
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = load i32*, i32** %1
%14 = call i32 @protocol_checkcert(i32* null, i32* %13)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@BIO_NOCLOSE = global i32 0
@.str = [24 x i8] c"../test/client1cert.pem\00"
@.str.1 = [12 x i8] c"Certificate\00"
@.str.2 = [6 x i8] c"Error\00"
define void @main() {
%1 = load i32, i32* @stderr
%2 = load i32, i32* @BIO_NOCLOSE
%3 = tail call i32* @BIO_new_fp(i32 %1, i32 %2)
%4 = tail call i32* @load_cert(i32* %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 3, i32* null, i32* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = tail call i32 @protocol_checkcert(i32* null, i32* %4)
ret void
}