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

/* Variables and functions */
int /*<<< orphan*/ BIO_flush(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_printf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ SSL_SESSION_print(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ SSL_get_session(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_x509_certificate_info(int /*<<< orphan*/ *,
                                               int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int print_conn_info(BIO *bio, SSL *s) {
  if (bio == NULL || s == NULL)
    return 0;
  printf("-= Connection information =- \n");
  BIO_printf(bio, "--\n");
  SSL_SESSION_print(bio, SSL_get_session(s));
  print_x509_certificate_info(bio, s);
  BIO_flush(bio);
  return 1;
}


x86 assembly (clang, -O0):
<print_conn_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1186 <print_conn_info+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1192 <print_conn_info+0x32>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <print_conn_info+0x87>
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1050 <BIO_printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <SSL_get_session@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <SSL_SESSION_print@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <print_x509_certificate_info@plt>
mov    -0x10(%rbp),%rdi
call   1080 <BIO_flush@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_conn_info>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
je     11bb <print_conn_info+0x5b>
mov    %rsi,%r14
test   %rsi,%rsi
je     11bb <print_conn_info+0x5b>
mov    %rdi,%rbx
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
call   1050 <BIO_printf@plt>
mov    %r14,%rdi
call   1070 <SSL_get_session@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <SSL_SESSION_print@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <print_x509_certificate_info@plt>
mov    %rbx,%rdi
call   1080 <BIO_flush@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"-= Connection information =- \0A\00"
@.str.1 = [4 x i8] c"--\0A\00"
define i32 @print_conn_info(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = load i32*, i32** %4
%7 = icmp eq i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 0, i32* %3
br label %25
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%14 = load i32*, i32** %4
%15 = call i32 @BIO_printf(i32* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32*, i32** %4
%17 = load i32*, i32** %5
%18 = call i32 @SSL_get_session(i32* %17)
%19 = call i32 @SSL_SESSION_print(i32* %16, i32 %18)
%20 = load i32*, i32** %4
%21 = load i32*, i32** %5
%22 = call i32 @print_x509_certificate_info(i32* %20, i32* %21)
%23 = load i32*, i32** %4
%24 = call i32 @BIO_flush(i32* %23)
store i32 1, i32* %3
br label %25
25: ; preds = %12, %11
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"--\0A\00"
@str = [30 x i8] c"-= Connection information =- \00"
define i32 @print_conn_info(i32* %0, i32* %1) {
%3 = icmp eq i32* %0, null
%4 = icmp eq i32* %1, null
%5 = or i1 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @SSL_get_session(i32* %1)
%10 = tail call i32 @SSL_SESSION_print(i32* %0, i32 %9)
%11 = tail call i32 @print_x509_certificate_info(i32* %0, i32* %1)
%12 = tail call i32 @BIO_flush(i32* %0)
br label %13
13: ; preds = %2, %6
%14 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %14
}