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

/* Variables and functions */
int /*<<< orphan*/ *BIO_new(int /*<<< orphan*/);
int BIO_read(int /*<<< orphan*/ *, unsigned char *, int);
int /*<<< orphan*/ BIO_s_mem();
int /*<<< orphan*/ BIO_write(int /*<<< orphan*/ *, unsigned char *, int);
int /*<<< orphan*/ ERR_load_BIO_strings();
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
int /*<<< orphan*/ *SSL_CTX_new(int /*<<< orphan*/);
int /*<<< orphan*/ SSL_CTX_use_PrivateKey_file(int /*<<< orphan*/ *, char *,
                                               int /*<<< orphan*/);
int /*<<< orphan*/ SSL_CTX_use_certificate_file(int /*<<< orphan*/ *, char *,
                                                int /*<<< orphan*/);
scalar_t__ SSL_ERROR_WANT_READ;
scalar_t__ SSL_ERROR_WANT_WRITE;
int /*<<< orphan*/ SSL_FILETYPE_PEM;
int SSL_do_handshake(int /*<<< orphan*/ *);
scalar_t__ SSL_get_error(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ SSL_is_init_finished(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_library_init();
int /*<<< orphan*/ SSL_load_error_strings();
int /*<<< orphan*/ *SSL_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_set_accept_state(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_set_bio(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_set_connect_state(int /*<<< orphan*/ *);
char *SSL_state_string(int /*<<< orphan*/ *);
char *SSL_state_string_long(int /*<<< orphan*/ *);
int /*<<< orphan*/ TLSv1_method();
int /*<<< orphan*/ err();
int /*<<< orphan*/ *fopen(char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main(int argc, char **argv) {
  int r, c, step;
  unsigned char buf[4096];
  char *ifi;
  FILE *f;
  char fn[15];
  SSL_CTX *sctx, *cctx;
  SSL *server, *client;
  BIO *sinbio, *soutbio, *cinbio, *coutbio;
  if (argc != 3) {
    step = -1;
  } else {
    step = argv[1][0] - '0';
    ifi = argv[2];
  }
  SSL_library_init();
  SSL_load_error_strings();
  ERR_load_BIO_strings();
  OpenSSL_add_all_algorithms();
  if (!(sctx = SSL_CTX_new(TLSv1_method())))
    err();
  if (!SSL_CTX_use_certificate_file(sctx, "server.pem", SSL_FILETYPE_PEM))
    err();
  if (!SSL_CTX_use_PrivateKey_file(sctx, "server.key", SSL_FILETYPE_PEM))
    err();
  if (!(server = SSL_new(sctx)))
    err();
  sinbio = BIO_new(BIO_s_mem());
  soutbio = BIO_new(BIO_s_mem());
  SSL_set_bio(server, sinbio, soutbio);
  SSL_set_accept_state(server);
  if (!(cctx = SSL_CTX_new(TLSv1_method())))
    err();
  if (!(client = SSL_new(cctx)))
    err();
  cinbio = BIO_new(BIO_s_mem());
  coutbio = BIO_new(BIO_s_mem());
  SSL_set_bio(client, cinbio, coutbio);
  SSL_set_connect_state(client);
  c = 0;
  do {
    r = SSL_do_handshake(client);
    if (r == -1) {
      if ((SSL_get_error(client, r) != SSL_ERROR_WANT_WRITE) &&
          (SSL_get_error(client, r) != SSL_ERROR_WANT_READ))
        err();
    }
    r = BIO_read(coutbio, buf, 4096);
    if (r == -1)
      err();
    c++;
    if (c == step) {
      f = fopen(ifi, "rb");
      r = fread(buf, 1, 4096, f);
    } else {
      sprintf(fn, "packet-%i", c);
      f = fopen(fn, "wb");
      fwrite(buf, 1, r, f);
    }
    BIO_write(sinbio, buf, r);
    r = SSL_do_handshake(server);
    if (r == -1) {
      if ((SSL_get_error(server, r) != SSL_ERROR_WANT_WRITE) &&
          (SSL_get_error(server, r) != SSL_ERROR_WANT_READ))
        err();
    }
    r = BIO_read(soutbio, buf, 4096);
    if (r == -1)
      err();
    c++;
    if (c == step) {
      f = fopen(ifi, "rb");
      r = fread(buf, 1, 4096, f);
    } else {
      sprintf(fn, "packet-%i", c);
      f = fopen(fn, "wb");
      fwrite(buf, 1, r, f);
    }
    BIO_write(cinbio, buf, r);
    printf("server state: %s / %s\n", SSL_state_string(server),
           SSL_state_string_long(server));
    printf("client state: %s / %s\n", SSL_state_string(client),
           SSL_state_string_long(client));
  } while ((!SSL_is_init_finished(server) || !SSL_is_init_finished(client)) &&
           c < 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     12df <main+0x2f>
movl   $0xffffffff,-0x1c(%rbp)
jmp    12ff <main+0x4f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x1028(%rbp)
mov    $0x0,%al
call   1070 <SSL_library_init@plt>
mov    $0x0,%al
call   1150 <SSL_load_error_strings@plt>
mov    $0x0,%al
call   11b0 <ERR_load_BIO_strings@plt>
mov    $0x0,%al
call   10d0 <OpenSSL_add_all_algorithms@plt>
mov    $0x0,%al
call   10e0 <TLSv1_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,-0x1048(%rbp)
cmp    $0x0,%rax
jne    1341 <main+0x91>
mov    $0x0,%al
call   1110 <err@plt>
mov    -0x1048(%rbp),%rdi
mov    0x2c91(%rip),%rax
mov    (%rax),%edx
lea    0xca8(%rip),%rsi
call   10b0 <SSL_CTX_use_certificate_file@plt>
cmp    $0x0,%eax
jne    136d <main+0xbd>
mov    $0x0,%al
call   1110 <err@plt>
mov    -0x1048(%rbp),%rdi
mov    0x2c65(%rip),%rax
mov    (%rax),%edx
lea    0xc87(%rip),%rsi
call   1130 <SSL_CTX_use_PrivateKey_file@plt>
cmp    $0x0,%eax
jne    1399 <main+0xe9>
mov    $0x0,%al
call   1110 <err@plt>
mov    -0x1048(%rbp),%rdi
call   1090 <SSL_new@plt>
mov    %rax,-0x1058(%rbp)
cmp    $0x0,%rax
jne    13bd <main+0x10d>
mov    $0x0,%al
call   1110 <err@plt>
mov    $0x0,%al
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %rax,-0x1068(%rbp)
mov    $0x0,%al
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %rax,-0x1070(%rbp)
mov    -0x1058(%rbp),%rdi
mov    -0x1068(%rbp),%rsi
mov    -0x1070(%rbp),%rdx
call   11d0 <SSL_set_bio@plt>
mov    -0x1058(%rbp),%rdi
call   1100 <SSL_set_accept_state@plt>
mov    $0x0,%al
call   10e0 <TLSv1_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,-0x1050(%rbp)
cmp    $0x0,%rax
jne    1433 <main+0x183>
mov    $0x0,%al
call   1110 <err@plt>
mov    -0x1050(%rbp),%rdi
call   1090 <SSL_new@plt>
mov    %rax,-0x1060(%rbp)
cmp    $0x0,%rax
jne    1457 <main+0x1a7>
mov    $0x0,%al
call   1110 <err@plt>
mov    $0x0,%al
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %rax,-0x1078(%rbp)
mov    $0x0,%al
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %rax,-0x1080(%rbp)
mov    -0x1060(%rbp),%rdi
mov    -0x1078(%rbp),%rsi
mov    -0x1080(%rbp),%rdx
call   11d0 <SSL_set_bio@plt>
mov    -0x1060(%rbp),%rdi
call   10a0 <SSL_set_connect_state@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x1060(%rbp),%rdi
call   11a0 <SSL_do_handshake@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1511 <main+0x261>
mov    -0x1060(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <SSL_get_error@plt>
mov    0x2b13(%rip),%rcx
cmp    (%rcx),%rax
je     150c <main+0x25c>
mov    -0x1060(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <SSL_get_error@plt>
mov    0x2ad4(%rip),%rcx
cmp    (%rcx),%rax
je     150c <main+0x25c>
mov    $0x0,%al
call   1110 <err@plt>
jmp    1511 <main+0x261>
mov    -0x1080(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
mov    $0x1000,%edx
call   1050 <BIO_read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    153d <main+0x28d>
mov    $0x0,%al
call   1110 <err@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1591 <main+0x2e1>
mov    -0x1028(%rbp),%rdi
lea    0xab6(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x1030(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x1030(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1040 <fread@plt>
mov    %eax,-0x14(%rbp)
jmp    15dc <main+0x32c>
lea    -0x103f(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xa77(%rip),%rsi
call   1160 <sprintf@plt>
lea    -0x103f(%rbp),%rdi
lea    0xa6e(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x1030(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x1030(%rbp),%rcx
mov    $0x1,%esi
call   1170 <fwrite@plt>
mov    -0x1068(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1180 <BIO_write@plt>
mov    -0x1058(%rbp),%rdi
call   11a0 <SSL_do_handshake@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1655 <main+0x3a5>
mov    -0x1058(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <SSL_get_error@plt>
mov    0x29cf(%rip),%rcx
cmp    (%rcx),%rax
je     1650 <main+0x3a0>
mov    -0x1058(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <SSL_get_error@plt>
mov    0x2990(%rip),%rcx
cmp    (%rcx),%rax
je     1650 <main+0x3a0>
mov    $0x0,%al
call   1110 <err@plt>
jmp    1655 <main+0x3a5>
mov    -0x1070(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
mov    $0x1000,%edx
call   1050 <BIO_read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1681 <main+0x3d1>
mov    $0x0,%al
call   1110 <err@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    16d5 <main+0x425>
mov    -0x1028(%rbp),%rdi
lea    0x972(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x1030(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x1030(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1040 <fread@plt>
mov    %eax,-0x14(%rbp)
jmp    1720 <main+0x470>
lea    -0x103f(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0x933(%rip),%rsi
call   1160 <sprintf@plt>
lea    -0x103f(%rbp),%rdi
lea    0x92a(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x1030(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x1030(%rbp),%rcx
mov    $0x1,%esi
call   1170 <fwrite@plt>
mov    -0x1078(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1180 <BIO_write@plt>
mov    -0x1058(%rbp),%rdi
call   1190 <SSL_state_string@plt>
mov    %rax,-0x1090(%rbp)
mov    -0x1058(%rbp),%rdi
call   10c0 <SSL_state_string_long@plt>
mov    -0x1090(%rbp),%rsi
mov    %rax,%rdx
lea    0x8c0(%rip),%rdi
call   1060 <printf@plt>
mov    -0x1060(%rbp),%rdi
call   1190 <SSL_state_string@plt>
mov    %rax,-0x1088(%rbp)
mov    -0x1060(%rbp),%rdi
call   10c0 <SSL_state_string_long@plt>
mov    -0x1088(%rbp),%rsi
mov    %rax,%rdx
lea    0x8a2(%rip),%rdi
call   1060 <printf@plt>
mov    -0x1058(%rbp),%rdi
call   1080 <SSL_is_init_finished@plt>
cmp    $0x0,%eax
je     17d4 <main+0x524>
mov    -0x1060(%rbp),%rdi
call   1080 <SSL_is_init_finished@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1091(%rbp)
jne    17e1 <main+0x531>
cmpl   $0xa,-0x18(%rbp)
setl   %al
mov    %al,-0x1091(%rbp)
mov    -0x1091(%rbp),%al
test   $0x1,%al
jne    14ae <main+0x1fe>
xor    %eax,%eax
add    $0x10a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1058,%rsp
cmp    $0x3,%edi
jne    12dc <main+0x2c>
mov    0x8(%rsi),%rax
mov    0x10(%rsi),%rcx
mov    %rcx,(%rsp)
movsbl (%rax),%r14d
add    $0xffffffd0,%r14d
jmp    12e2 <main+0x32>
mov    $0xffffffff,%r14d
xor    %eax,%eax
call   1070 <SSL_library_init@plt>
xor    %eax,%eax
call   1150 <SSL_load_error_strings@plt>
xor    %eax,%eax
call   11b0 <ERR_load_BIO_strings@plt>
xor    %eax,%eax
call   10d0 <OpenSSL_add_all_algorithms@plt>
xor    %eax,%eax
call   10e0 <TLSv1_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    131b <main+0x6b>
xor    %eax,%eax
call   1110 <err@plt>
mov    0x2cbe(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0xcd4(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <SSL_CTX_use_certificate_file@plt>
test   %eax,%eax
jne    133f <main+0x8f>
xor    %eax,%eax
call   1110 <err@plt>
mov    0x0(%rbp),%edx
lea    0xcc2(%rip),%rsi
mov    %rbx,%rdi
call   1130 <SSL_CTX_use_PrivateKey_file@plt>
test   %eax,%eax
jne    135c <main+0xac>
xor    %eax,%eax
call   1110 <err@plt>
mov    %rbx,%rdi
call   1090 <SSL_new@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1373 <main+0xc3>
xor    %eax,%eax
call   1110 <err@plt>
xor    %eax,%eax
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %r13,%rdi
mov    %rbx,0x38(%rsp)
mov    %rbx,%rsi
mov    %rax,0x30(%rsp)
mov    %rax,%rdx
call   11d0 <SSL_set_bio@plt>
mov    %r13,%rdi
call   1100 <SSL_set_accept_state@plt>
xor    %eax,%eax
call   10e0 <TLSv1_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    13cf <main+0x11f>
xor    %eax,%eax
call   1110 <err@plt>
mov    %rbx,%rdi
call   1090 <SSL_new@plt>
mov    %rax,%r12
test   %rax,%rax
jne    13e6 <main+0x136>
xor    %eax,%eax
call   1110 <err@plt>
xor    %eax,%eax
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   11c0 <BIO_s_mem@plt>
mov    %eax,%edi
call   1120 <BIO_new@plt>
mov    %r12,%rdi
mov    %rbx,0x28(%rsp)
mov    %rbx,%rsi
mov    %rax,0x20(%rsp)
mov    %rax,%rdx
call   11d0 <SSL_set_bio@plt>
mov    %r12,%rdi
call   10a0 <SSL_set_connect_state@plt>
mov    %r14,%rbx
neg    %ebx
mov    $0x2,%r15d
lea    0x50(%rsp),%rbp
mov    %rbx,0x10(%rsp)
mov    %r13,0x8(%rsp)
jmp    146b <main+0x1bb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x7,%r13d
ja     16f2 <main+0x442>
add    $0x2,%r15d
mov    0x10(%rsp),%rbx
mov    %r14,%rbp
mov    0x8(%rsp),%r13
mov    %r12,%rdi
call   11a0 <SSL_do_handshake@plt>
cmp    $0xffffffff,%eax
jne    14c0 <main+0x210>
mov    %r12,%rdi
mov    $0xffffffff,%esi
call   1030 <SSL_get_error@plt>
mov    0x2b64(%rip),%rcx
cmp    (%rcx),%rax
je     14c0 <main+0x210>
mov    %r12,%rdi
mov    $0xffffffff,%esi
call   1030 <SSL_get_error@plt>
mov    0x2b2b(%rip),%rcx
cmp    (%rcx),%rax
je     14c0 <main+0x210>
xor    %eax,%eax
call   1110 <err@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1050 <BIO_read@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
jne    14e1 <main+0x231>
xor    %eax,%eax
call   1110 <err@plt>
lea    (%rbx,%r15,1),%eax
cmp    $0x1,%eax
jne    1520 <main+0x270>
mov    (%rsp),%rdi
lea    0xb21(%rip),%rsi
call   1140 <fopen@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
mov    %eax,%r14d
jmp    1576 <main+0x2c6>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x1(%r15),%edx
mov    %r15,0x18(%rsp)
mov    %rbx,%r15
mov    %r12,%rbx
mov    %r13,%r12
lea    0x41(%rsp),%r13
mov    %r13,%rdi
lea    0xad8(%rip),%rsi
call   1160 <sprintf@plt>
mov    %r13,%rdi
mov    %r12,%r13
mov    %rbx,%r12
mov    %r15,%rbx
mov    0x18(%rsp),%r15
lea    0xac5(%rip),%rsi
call   1140 <fopen@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %rax,%rcx
call   1170 <fwrite@plt>
mov    0x38(%rsp),%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1180 <BIO_write@plt>
mov    %r13,%rdi
call   11a0 <SSL_do_handshake@plt>
cmp    $0xffffffff,%eax
jne    15d0 <main+0x320>
mov    %r13,%rdi
mov    $0xffffffff,%esi
call   1030 <SSL_get_error@plt>
mov    0x2a49(%rip),%rcx
cmp    (%rcx),%rax
je     15d0 <main+0x320>
mov    %r13,%rdi
mov    $0xffffffff,%esi
call   1030 <SSL_get_error@plt>
mov    0x2a10(%rip),%rcx
cmp    (%rcx),%rax
je     15d0 <main+0x320>
xor    %eax,%eax
call   1110 <err@plt>
nopl   0x0(%rax)
mov    0x30(%rsp),%rdi
mov    %rbp,%r14
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1050 <BIO_read@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    15f3 <main+0x343>
xor    %eax,%eax
call   1110 <err@plt>
mov    %ebx,%eax
add    %r15d,%eax
je     1640 <main+0x390>
lea    0x41(%rsp),%rbx
mov    %rbx,%rdi
lea    0xa10(%rip),%rsi
mov    %r15d,%edx
call   1160 <sprintf@plt>
mov    %rbx,%rdi
lea    0xa08(%rip),%rsi
call   1140 <fopen@plt>
mov    %r14,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %rax,%rcx
call   1170 <fwrite@plt>
jmp    166a <main+0x3ba>
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%rdi
lea    0x9cb(%rip),%rsi
call   1140 <fopen@plt>
mov    %r14,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
mov    %eax,%ebp
lea    -0x2(%r15),%r13d
mov    0x28(%rsp),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1180 <BIO_write@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1190 <SSL_state_string@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   10c0 <SSL_state_string_long@plt>
lea    0x98a(%rip),%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1060 <printf@plt>
mov    %r12,%rdi
call   1190 <SSL_state_string@plt>
mov    %rax,%rbp
mov    %r12,%rdi
call   10c0 <SSL_state_string_long@plt>
lea    0x97c(%rip),%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1080 <SSL_is_init_finished@plt>
test   %eax,%eax
je     1450 <main+0x1a0>
mov    %r12,%rdi
call   1080 <SSL_is_init_finished@plt>
test   %eax,%eax
jne    16f2 <main+0x442>
cmp    $0x8,%r13d
jb     145a <main+0x1aa>
xor    %eax,%eax
add    $0x1058,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"server.pem\00"
@SSL_FILETYPE_PEM = global i32 0
@.str.1 = [11 x i8] c"server.key\00"
@SSL_ERROR_WANT_WRITE = global i64 0
@SSL_ERROR_WANT_READ = global i64 0
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [10 x i8] c"packet-%i\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [23 x i8] c"server state: %s / %s\0A\00"
@.str.6 = [23 x i8] c"client state: %s / %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [4096 x i8]
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca [15 x i8]
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 3
br i1 %22, label %23, label %24
23: ; preds = %2
store i32 -1, i32* %8
br label %35
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 48
store i32 %31, i32* %8
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
store i8* %34, i8** %10
br label %35
35: ; preds = %24, %23
%36 = call i32 (...) @SSL_library_init()
%37 = call i32 (...) @SSL_load_error_strings()
%38 = call i32 (...) @ERR_load_BIO_strings()
%39 = call i32 (...) @OpenSSL_add_all_algorithms()
%40 = call i32 (...) @TLSv1_method()
%41 = call i32* @SSL_CTX_new(i32 %40)
store i32* %41, i32** %13
%42 = icmp ne i32* %41, null
br i1 %42, label %45, label %43
43: ; preds = %35
%44 = call i32 (...) @err()
br label %45
45: ; preds = %43, %35
%46 = load i32*, i32** %13
%47 = load i32, i32* @SSL_FILETYPE_PEM
%48 = call i32 @SSL_CTX_use_certificate_file(i32* %46, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = icmp ne i32 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %45
%51 = call i32 (...) @err()
br label %52
52: ; preds = %50, %45
%53 = load i32*, i32** %13
%54 = load i32, i32* @SSL_FILETYPE_PEM
%55 = call i32 @SSL_CTX_use_PrivateKey_file(i32* %53, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = icmp ne i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %52
%58 = call i32 (...) @err()
br label %59
59: ; preds = %57, %52
%60 = load i32*, i32** %13
%61 = call i32* @SSL_new(i32* %60)
store i32* %61, i32** %15
%62 = icmp ne i32* %61, null
br i1 %62, label %65, label %63
63: ; preds = %59
%64 = call i32 (...) @err()
br label %65
65: ; preds = %63, %59
%66 = call i32 (...) @BIO_s_mem()
%67 = call i32* @BIO_new(i32 %66)
store i32* %67, i32** %17
%68 = call i32 (...) @BIO_s_mem()
%69 = call i32* @BIO_new(i32 %68)
store i32* %69, i32** %18
%70 = load i32*, i32** %15
%71 = load i32*, i32** %17
%72 = load i32*, i32** %18
%73 = call i32 @SSL_set_bio(i32* %70, i32* %71, i32* %72)
%74 = load i32*, i32** %15
%75 = call i32 @SSL_set_accept_state(i32* %74)
%76 = call i32 (...) @TLSv1_method()
%77 = call i32* @SSL_CTX_new(i32 %76)
store i32* %77, i32** %14
%78 = icmp ne i32* %77, null
br i1 %78, label %81, label %79
79: ; preds = %65
%80 = call i32 (...) @err()
br label %81
81: ; preds = %79, %65
%82 = load i32*, i32** %14
%83 = call i32* @SSL_new(i32* %82)
store i32* %83, i32** %16
%84 = icmp ne i32* %83, null
br i1 %84, label %87, label %85
85: ; preds = %81
%86 = call i32 (...) @err()
br label %87
87: ; preds = %85, %81
%88 = call i32 (...) @BIO_s_mem()
%89 = call i32* @BIO_new(i32 %88)
store i32* %89, i32** %19
%90 = call i32 (...) @BIO_s_mem()
%91 = call i32* @BIO_new(i32 %90)
store i32* %91, i32** %20
%92 = load i32*, i32** %16
%93 = load i32*, i32** %19
%94 = load i32*, i32** %20
%95 = call i32 @SSL_set_bio(i32* %92, i32* %93, i32* %94)
%96 = load i32*, i32** %16
%97 = call i32 @SSL_set_connect_state(i32* %96)
store i32 0, i32* %7
br label %98
98: ; preds = %228, %87
%99 = load i32*, i32** %16
%100 = call i32 @SSL_do_handshake(i32* %99)
store i32 %100, i32* %6
%101 = load i32, i32* %6
%102 = icmp eq i32 %101, -1
br i1 %102, label %103, label %118
103: ; preds = %98
%104 = load i32*, i32** %16
%105 = load i32, i32* %6
%106 = call i64 @SSL_get_error(i32* %104, i32 %105)
%107 = load i64, i64* @SSL_ERROR_WANT_WRITE
%108 = icmp ne i64 %106, %107
br i1 %108, label %109, label %117
109: ; preds = %103
%110 = load i32*, i32** %16
%111 = load i32, i32* %6
%112 = call i64 @SSL_get_error(i32* %110, i32 %111)
%113 = load i64, i64* @SSL_ERROR_WANT_READ
%114 = icmp ne i64 %112, %113
br i1 %114, label %115, label %117
115: ; preds = %109
%116 = call i32 (...) @err()
br label %117
117: ; preds = %115, %109, %103
br label %118
118: ; preds = %117, %98
%119 = load i32*, i32** %20
%120 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%121 = call i32 @BIO_read(i32* %119, i8* %120, i32 4096)
store i32 %121, i32* %6
%122 = load i32, i32* %6
%123 = icmp eq i32 %122, -1
br i1 %123, label %124, label %126
124: ; preds = %118
%125 = call i32 (...) @err()
br label %126
126: ; preds = %124, %118
%127 = load i32, i32* %7
%128 = add nsw i32 %127, 1
store i32 %128, i32* %7
%129 = load i32, i32* %7
%130 = load i32, i32* %8
%131 = icmp eq i32 %129, %130
br i1 %131, label %132, label %138
132: ; preds = %126
%133 = load i8*, i8** %10
%134 = call i32* @fopen(i8* %133, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %134, i32** %11
%135 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%136 = load i32*, i32** %11
%137 = call i32 @fread(i8* %135, i32 1, i32 4096, i32* %136)
store i32 %137, i32* %6
br label %148
138: ; preds = %126
%139 = getelementptr inbounds [15 x i8], [15 x i8]* %12, i64 0, i64 0
%140 = load i32, i32* %7
%141 = call i32 @sprintf(i8* %139, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %140)
%142 = getelementptr inbounds [15 x i8], [15 x i8]* %12, i64 0, i64 0
%143 = call i32* @fopen(i8* %142, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %143, i32** %11
%144 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%145 = load i32, i32* %6
%146 = load i32*, i32** %11
%147 = call i32 @fwrite(i8* %144, i32 1, i32 %145, i32* %146)
br label %148
148: ; preds = %138, %132
%149 = load i32*, i32** %17
%150 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%151 = load i32, i32* %6
%152 = call i32 @BIO_write(i32* %149, i8* %150, i32 %151)
%153 = load i32*, i32** %15
%154 = call i32 @SSL_do_handshake(i32* %153)
store i32 %154, i32* %6
%155 = load i32, i32* %6
%156 = icmp eq i32 %155, -1
br i1 %156, label %157, label %172
157: ; preds = %148
%158 = load i32*, i32** %15
%159 = load i32, i32* %6
%160 = call i64 @SSL_get_error(i32* %158, i32 %159)
%161 = load i64, i64* @SSL_ERROR_WANT_WRITE
%162 = icmp ne i64 %160, %161
br i1 %162, label %163, label %171
163: ; preds = %157
%164 = load i32*, i32** %15
%165 = load i32, i32* %6
%166 = call i64 @SSL_get_error(i32* %164, i32 %165)
%167 = load i64, i64* @SSL_ERROR_WANT_READ
%168 = icmp ne i64 %166, %167
br i1 %168, label %169, label %171
169: ; preds = %163
%170 = call i32 (...) @err()
br label %171
171: ; preds = %169, %163, %157
br label %172
172: ; preds = %171, %148
%173 = load i32*, i32** %18
%174 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%175 = call i32 @BIO_read(i32* %173, i8* %174, i32 4096)
store i32 %175, i32* %6
%176 = load i32, i32* %6
%177 = icmp eq i32 %176, -1
br i1 %177, label %178, label %180
178: ; preds = %172
%179 = call i32 (...) @err()
br label %180
180: ; preds = %178, %172
%181 = load i32, i32* %7
%182 = add nsw i32 %181, 1
store i32 %182, i32* %7
%183 = load i32, i32* %7
%184 = load i32, i32* %8
%185 = icmp eq i32 %183, %184
br i1 %185, label %186, label %192
186: ; preds = %180
%187 = load i8*, i8** %10
%188 = call i32* @fopen(i8* %187, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %188, i32** %11
%189 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%190 = load i32*, i32** %11
%191 = call i32 @fread(i8* %189, i32 1, i32 4096, i32* %190)
store i32 %191, i32* %6
br label %202
192: ; preds = %180
%193 = getelementptr inbounds [15 x i8], [15 x i8]* %12, i64 0, i64 0
%194 = load i32, i32* %7
%195 = call i32 @sprintf(i8* %193, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %194)
%196 = getelementptr inbounds [15 x i8], [15 x i8]* %12, i64 0, i64 0
%197 = call i32* @fopen(i8* %196, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %197, i32** %11
%198 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%199 = load i32, i32* %6
%200 = load i32*, i32** %11
%201 = call i32 @fwrite(i8* %198, i32 1, i32 %199, i32* %200)
br label %202
202: ; preds = %192, %186
%203 = load i32*, i32** %19
%204 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%205 = load i32, i32* %6
%206 = call i32 @BIO_write(i32* %203, i8* %204, i32 %205)
%207 = load i32*, i32** %15
%208 = call i8* @SSL_state_string(i32* %207)
%209 = load i32*, i32** %15
%210 = call i8* @SSL_state_string_long(i32* %209)
%211 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %208, i8* %210)
%212 = load i32*, i32** %16
%213 = call i8* @SSL_state_string(i32* %212)
%214 = load i32*, i32** %16
%215 = call i8* @SSL_state_string_long(i32* %214)
%216 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %213, i8* %215)
br label %217
217: ; preds = %202
%218 = load i32*, i32** %15
%219 = call i32 @SSL_is_init_finished(i32* %218)
%220 = icmp ne i32 %219, 0
br i1 %220, label %221, label %225
221: ; preds = %217
%222 = load i32*, i32** %16
%223 = call i32 @SSL_is_init_finished(i32* %222)
%224 = icmp ne i32 %223, 0
br i1 %224, label %228, label %225
225: ; preds = %221, %217
%226 = load i32, i32* %7
%227 = icmp slt i32 %226, 10
br label %228
228: ; preds = %225, %221
%229 = phi i1 [ false, %221 ], [ %227, %225 ]
br i1 %229, label %98, label %230
230: ; preds = %228
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"server.pem\00"
@SSL_FILETYPE_PEM = global i32 0
@.str.1 = [11 x i8] c"server.key\00"
@SSL_ERROR_WANT_WRITE = global i64 0
@SSL_ERROR_WANT_READ = global i64 0
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [10 x i8] c"packet-%i\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [23 x i8] c"server state: %s / %s\0A\00"
@.str.6 = [23 x i8] c"client state: %s / %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca [15 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, -48
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
br label %16
16: ; preds = %2, %8
%17 = phi i8* [ %15, %8 ], [ undef, %2 ]
%18 = phi i32 [ %13, %8 ], [ -1, %2 ]
%19 = tail call i32 (...) @SSL_library_init()
%20 = tail call i32 (...) @SSL_load_error_strings()
%21 = tail call i32 (...) @ERR_load_BIO_strings()
%22 = tail call i32 (...) @OpenSSL_add_all_algorithms()
%23 = tail call i32 (...) @TLSv1_method()
%24 = tail call i32* @SSL_CTX_new(i32 %23)
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %16
%27 = tail call i32 (...) @err()
br label %28
28: ; preds = %26, %16
%29 = load i32, i32* @SSL_FILETYPE_PEM
%30 = tail call i32 @SSL_CTX_use_certificate_file(i32* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = tail call i32 (...) @err()
br label %34
34: ; preds = %32, %28
%35 = load i32, i32* @SSL_FILETYPE_PEM
%36 = tail call i32 @SSL_CTX_use_PrivateKey_file(i32* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = tail call i32 (...) @err()
br label %40
40: ; preds = %38, %34
%41 = tail call i32* @SSL_new(i32* %24)
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = tail call i32 (...) @err()
br label %45
45: ; preds = %43, %40
%46 = tail call i32 (...) @BIO_s_mem()
%47 = tail call i32* @BIO_new(i32 %46)
%48 = tail call i32 (...) @BIO_s_mem()
%49 = tail call i32* @BIO_new(i32 %48)
%50 = tail call i32 @SSL_set_bio(i32* %41, i32* %47, i32* %49)
%51 = tail call i32 @SSL_set_accept_state(i32* %41)
%52 = tail call i32 (...) @TLSv1_method()
%53 = tail call i32* @SSL_CTX_new(i32 %52)
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %57
55: ; preds = %45
%56 = tail call i32 (...) @err()
br label %57
57: ; preds = %55, %45
%58 = tail call i32* @SSL_new(i32* %53)
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = tail call i32 (...) @err()
br label %62
62: ; preds = %60, %57
%63 = tail call i32 (...) @BIO_s_mem()
%64 = tail call i32* @BIO_new(i32 %63)
%65 = tail call i32 (...) @BIO_s_mem()
%66 = tail call i32* @BIO_new(i32 %65)
%67 = tail call i32 @SSL_set_bio(i32* %58, i32* %64, i32* %66)
%68 = tail call i32 @SSL_set_connect_state(i32* %58)
br label %69
69: ; preds = %146, %62
%70 = phi i32 [ 0, %62 ], [ %119, %146 ]
%71 = call i32 @SSL_do_handshake(i32* %58)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %83
73: ; preds = %69
%74 = call i64 @SSL_get_error(i32* %58, i32 -1)
%75 = load i64, i64* @SSL_ERROR_WANT_WRITE
%76 = icmp eq i64 %74, %75
br i1 %76, label %83, label %77
77: ; preds = %73
%78 = call i64 @SSL_get_error(i32* %58, i32 -1)
%79 = load i64, i64* @SSL_ERROR_WANT_READ
%80 = icmp eq i64 %78, %79
br i1 %80, label %83, label %81
81: ; preds = %77
%82 = call i32 (...) @err()
br label %83
83: ; preds = %73, %77, %81, %69
%84 = call i32 @BIO_read(i32* %66, i8* %5, i32 4096)
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 (...) @err()
br label %88
88: ; preds = %86, %83
%89 = or i32 %70, 1
%90 = icmp eq i32 %89, %18
br i1 %90, label %91, label %94
91: ; preds = %88
%92 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%93 = call i32 @fread(i8* %5, i32 1, i32 4096, i32* %92)
br label %98
94: ; preds = %88
%95 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %89)
%96 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%97 = call i32 @fwrite(i8* %5, i32 1, i32 %84, i32* %96)
br label %98
98: ; preds = %94, %91
%99 = phi i32 [ %93, %91 ], [ %84, %94 ]
%100 = call i32 @BIO_write(i32* %47, i8* %5, i32 %99)
%101 = call i32 @SSL_do_handshake(i32* %41)
%102 = icmp eq i32 %101, -1
br i1 %102, label %103, label %113
103: ; preds = %98
%104 = call i64 @SSL_get_error(i32* %41, i32 -1)
%105 = load i64, i64* @SSL_ERROR_WANT_WRITE
%106 = icmp eq i64 %104, %105
br i1 %106, label %113, label %107
107: ; preds = %103
%108 = call i64 @SSL_get_error(i32* %41, i32 -1)
%109 = load i64, i64* @SSL_ERROR_WANT_READ
%110 = icmp eq i64 %108, %109
br i1 %110, label %113, label %111
111: ; preds = %107
%112 = call i32 (...) @err()
br label %113
113: ; preds = %103, %107, %111, %98
%114 = call i32 @BIO_read(i32* %49, i8* %5, i32 4096)
%115 = icmp eq i32 %114, -1
br i1 %115, label %116, label %118
116: ; preds = %113
%117 = call i32 (...) @err()
br label %118
118: ; preds = %116, %113
%119 = add nuw nsw i32 %70, 2
%120 = icmp eq i32 %119, %18
br i1 %120, label %121, label %124
121: ; preds = %118
%122 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%123 = call i32 @fread(i8* %5, i32 1, i32 4096, i32* %122)
br label %128
124: ; preds = %118
%125 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %119)
%126 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%127 = call i32 @fwrite(i8* %5, i32 1, i32 %114, i32* %126)
br label %128
128: ; preds = %124, %121
%129 = phi i32 [ %123, %121 ], [ %114, %124 ]
%130 = call i32 @BIO_write(i32* %64, i8* %5, i32 %129)
%131 = call i8* @SSL_state_string(i32* %41)
%132 = call i8* @SSL_state_string_long(i32* %41)
%133 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %131, i8* %132)
%134 = call i8* @SSL_state_string(i32* %58)
%135 = call i8* @SSL_state_string_long(i32* %58)
%136 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %134, i8* %135)
%137 = call i32 @SSL_is_init_finished(i32* %41)
%138 = icmp eq i32 %137, 0
br i1 %138, label %144, label %139
139: ; preds = %128
%140 = call i32 @SSL_is_init_finished(i32* %58)
%141 = icmp eq i32 %140, 0
%142 = icmp ult i32 %70, 8
%143 = select i1 %141, i1 %142, i1 false
br i1 %143, label %146, label %147
144: ; preds = %128
%145 = icmp ult i32 %70, 8
br i1 %145, label %146, label %147
146: ; preds = %144, %139
br label %69
147: ; preds = %139, %144
ret i32 0
}