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

/* Variables and functions */
int /*<<< orphan*/ BIO_printf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ SSL_CTX_sess_accept(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CTX_sess_accept_good(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CTX_sess_connect(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CTX_sess_connect_good(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CTX_sess_hits(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CTX_sess_misses(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CTX_sess_number(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CTX_sess_timeouts(int /*<<< orphan*/ *);
void print_stats(BIO *bio, SSL_CTX *ctx) {
  BIO_printf(bio, "%4ld items in the session cache\n",
             SSL_CTX_sess_number(ctx));
  BIO_printf(bio, "%4d client connects (SSL_connect())\n",
             SSL_CTX_sess_connect(ctx));
  BIO_printf(bio, "%4d client connects that finished\n",
             SSL_CTX_sess_connect_good(ctx));
  BIO_printf(bio, "%4d server connects (SSL_accept())\n",
             SSL_CTX_sess_accept(ctx));
  BIO_printf(bio, "%4d server connects that finished\n",
             SSL_CTX_sess_accept_good(ctx));
  BIO_printf(bio, "%4d session cache hits\n", SSL_CTX_sess_hits(ctx));
  BIO_printf(bio, "%4d session cache misses\n", SSL_CTX_sess_misses(ctx));
  BIO_printf(bio, "%4d session cache timeouts\n", SSL_CTX_sess_timeouts(ctx));
}


x86 assembly (clang, -O0):
<print_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <SSL_CTX_sess_number@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%edx
lea    0xe42(%rip),%rsi
call   1060 <BIO_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <SSL_CTX_sess_connect@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%edx
lea    0xe40(%rip),%rsi
call   1060 <BIO_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <SSL_CTX_sess_connect_good@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%edx
lea    0xe42(%rip),%rsi
call   1060 <BIO_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <SSL_CTX_sess_accept@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%edx
lea    0xe42(%rip),%rsi
call   1060 <BIO_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <SSL_CTX_sess_accept_good@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
lea    0xe43(%rip),%rsi
call   1060 <BIO_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <SSL_CTX_sess_hits@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe43(%rip),%rsi
call   1060 <BIO_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <SSL_CTX_sess_misses@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xe38(%rip),%rsi
call   1060 <BIO_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <SSL_CTX_sess_timeouts@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xe2f(%rip),%rsi
call   1060 <BIO_printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_stats>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1090 <SSL_CTX_sess_number@plt>
lea    0xe57(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <BIO_printf@plt>
mov    %rbx,%rdi
call   10a0 <SSL_CTX_sess_connect@plt>
lea    0xe5f(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <BIO_printf@plt>
mov    %rbx,%rdi
call   1050 <SSL_CTX_sess_connect_good@plt>
lea    0xe6b(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <BIO_printf@plt>
mov    %rbx,%rdi
call   1030 <SSL_CTX_sess_accept@plt>
lea    0xe75(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <BIO_printf@plt>
mov    %rbx,%rdi
call   1040 <SSL_CTX_sess_accept_good@plt>
lea    0xe80(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <BIO_printf@plt>
mov    %rbx,%rdi
call   1070 <SSL_CTX_sess_hits@plt>
lea    0xe8a(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <BIO_printf@plt>
mov    %rbx,%rdi
call   10b0 <SSL_CTX_sess_misses@plt>
lea    0xe89(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <BIO_printf@plt>
mov    %rbx,%rdi
call   1080 <SSL_CTX_sess_timeouts@plt>
lea    0xe8a(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <BIO_printf@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"%4ld items in the session cache\0A\00"
@.str.1 = [37 x i8] c"%4d client connects (SSL_connect())\0A\00"
@.str.2 = [35 x i8] c"%4d client connects that finished\0A\00"
@.str.3 = [36 x i8] c"%4d server connects (SSL_accept())\0A\00"
@.str.4 = [35 x i8] c"%4d server connects that finished\0A\00"
@.str.5 = [24 x i8] c"%4d session cache hits\0A\00"
@.str.6 = [26 x i8] c"%4d session cache misses\0A\00"
@.str.7 = [28 x i8] c"%4d session cache timeouts\0A\00"
define void @print_stats(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i32 @SSL_CTX_sess_number(i32* %6)
%8 = call i32 @BIO_printf(i32* %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %3
%10 = load i32*, i32** %4
%11 = call i32 @SSL_CTX_sess_connect(i32* %10)
%12 = call i32 @BIO_printf(i32* %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32*, i32** %3
%14 = load i32*, i32** %4
%15 = call i32 @SSL_CTX_sess_connect_good(i32* %14)
%16 = call i32 @BIO_printf(i32* %13, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32*, i32** %3
%18 = load i32*, i32** %4
%19 = call i32 @SSL_CTX_sess_accept(i32* %18)
%20 = call i32 @BIO_printf(i32* %17, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %3
%22 = load i32*, i32** %4
%23 = call i32 @SSL_CTX_sess_accept_good(i32* %22)
%24 = call i32 @BIO_printf(i32* %21, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = load i32*, i32** %3
%26 = load i32*, i32** %4
%27 = call i32 @SSL_CTX_sess_hits(i32* %26)
%28 = call i32 @BIO_printf(i32* %25, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = load i32*, i32** %3
%30 = load i32*, i32** %4
%31 = call i32 @SSL_CTX_sess_misses(i32* %30)
%32 = call i32 @BIO_printf(i32* %29, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = load i32*, i32** %3
%34 = load i32*, i32** %4
%35 = call i32 @SSL_CTX_sess_timeouts(i32* %34)
%36 = call i32 @BIO_printf(i32* %33, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %35)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"%4ld items in the session cache\0A\00"
@.str.1 = [37 x i8] c"%4d client connects (SSL_connect())\0A\00"
@.str.2 = [35 x i8] c"%4d client connects that finished\0A\00"
@.str.3 = [36 x i8] c"%4d server connects (SSL_accept())\0A\00"
@.str.4 = [35 x i8] c"%4d server connects that finished\0A\00"
@.str.5 = [24 x i8] c"%4d session cache hits\0A\00"
@.str.6 = [26 x i8] c"%4d session cache misses\0A\00"
@.str.7 = [28 x i8] c"%4d session cache timeouts\0A\00"
define void @print_stats(i32* %0, i32* %1) {
%3 = tail call i32 @SSL_CTX_sess_number(i32* %1)
%4 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @SSL_CTX_sess_connect(i32* %1)
%6 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @SSL_CTX_sess_connect_good(i32* %1)
%8 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @SSL_CTX_sess_accept(i32* %1)
%10 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 @SSL_CTX_sess_accept_good(i32* %1)
%12 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = tail call i32 @SSL_CTX_sess_hits(i32* %1)
%14 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = tail call i32 @SSL_CTX_sess_misses(i32* %1)
%16 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = tail call i32 @SSL_CTX_sess_timeouts(i32* %1)
%18 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %17)
ret void
}