#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 */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ addr;
typedef int /*<<< orphan*/ SSL_METHOD;
typedef int /*<<< orphan*/ SSL_CTX;
typedef int /*<<< orphan*/ SSL;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SSL_CTX_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *SSL_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_set_fd(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *SSLv3_server_method();
int accept(int, struct sockaddr *, int *);
int atoi(char *);
int /*<<< orphan*/ benchmark(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
char *inet_ntoa(int /*<<< orphan*/);
int listen_socket(int);
int /*<<< orphan*/ load_server_certificates(int /*<<< orphan*/ *, char *,
                                            char *);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ process(int /*<<< orphan*/ *);
int /*<<< orphan*/ *server_init(int /*<<< orphan*/ *, int, int);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  SSL_CTX *ctx;
  SSL_METHOD *method = SSLv3_server_method();
  int server_fd;
  char *portnum;
  char *file_cert;
  char *file_key;
  int want_client_cert = 0;
  int want_dhe = 0;
  int keep_running = 0;
  int use_ready_file = 0;
  int bench_send = 0;
  int bench_recv = 0;
  char *ready_file;
  int i;
  if (argc < 4) {
    printf("Usage: %s <portnum> <cert.pem> <key.pem> [opts]\n", argv[0]);
    exit(-1);
  }
  portnum = argv[1];
  file_cert = argv[2];
  file_key = argv[3];
  for (i = 4; i < argc; i++) {
    if (strcmp("tls-1.2", argv[i]) == 0) {
      method = SSLv3_server_method();
    } else if (strcmp("tls-1.1", argv[i]) == 0) {
      method = SSLv3_server_method();
    } else if (strcmp("tls-1.0", argv[i]) == 0) {
      method = SSLv3_server_method();
    } else if (strcmp("ssl-3.0", argv[i]) == 0) {
      method = SSLv3_server_method();
    } else if (strcmp("client-cert", argv[i]) == 0) {
      want_client_cert = 1;
    } else if (strcmp("keep-running", argv[i]) == 0) {
      keep_running = 1;
    } else if (strcmp("dhe", argv[i]) == 0) {
      want_dhe = 1;
    } else if (strcmp("ready-file", argv[i]) == 0) {
      use_ready_file = 1;
      ready_file = argv[++i];
    } else if (strcmp("bench-send", argv[i]) == 0) {
      bench_send = atoi(argv[++i]);
    } else if (strcmp("bench-recv", argv[i]) == 0) {
      bench_recv = atoi(argv[++i]);
    } else {
      printf("warning: unknown option: \"%s\"\n", argv[i]);
    }
  }
  if (use_ready_file)
    printf("readyfile: %s\n", ready_file);
  ctx = server_init(method, want_client_cert, want_dhe);
  load_server_certificates(ctx, file_cert, file_key);
  server_fd = listen_socket(atoi(portnum));
  if (use_ready_file) {
    FILE *f;
    f = fopen(ready_file, "w+");
    if (f != NULL) {
      fwrite("ready\n", 6, 1, f);
      fclose(f);
    }
  }
  do {
    struct sockaddr_in addr;
    socklen_t len = sizeof(addr);
    SSL *ssl;
    printf("[status] accepting connection\n");
    int client = accept(server_fd, (struct sockaddr *)&addr, &len);
    printf("[log] got connection from %s:%d\n", inet_ntoa(addr.sin_addr),
           ntohs(addr.sin_port));
    ssl = SSL_new(ctx);
    SSL_set_fd(ssl, client);
    if (bench_send > 0 || bench_recv > 0)
      benchmark(ssl, bench_send, bench_recv);
    else
      process(ssl);
  } while (keep_running);
  close(server_fd);
  SSL_CTX_free(ctx);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10e0 <SSLv3_server_method@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    12b7 <main+0x77>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1150 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
movl   $0x4,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1566 <main+0x326>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd30(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1320 <main+0xe0>
mov    $0x0,%al
call   10e0 <SSLv3_server_method@plt>
mov    %rax,-0x20(%rbp)
jmp    1553 <main+0x313>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd06(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1352 <main+0x112>
mov    $0x0,%al
call   10e0 <SSLv3_server_method@plt>
mov    %rax,-0x20(%rbp)
jmp    154e <main+0x30e>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xcdc(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1384 <main+0x144>
mov    $0x0,%al
call   10e0 <SSLv3_server_method@plt>
mov    %rax,-0x20(%rbp)
jmp    1549 <main+0x309>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xcb2(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    13b6 <main+0x176>
mov    $0x0,%al
call   10e0 <SSLv3_server_method@plt>
mov    %rax,-0x20(%rbp)
jmp    1544 <main+0x304>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc88(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    13e4 <main+0x1a4>
movl   $0x1,-0x44(%rbp)
jmp    153f <main+0x2ff>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc66(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1412 <main+0x1d2>
movl   $0x1,-0x4c(%rbp)
jmp    153a <main+0x2fa>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc45(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1440 <main+0x200>
movl   $0x1,-0x48(%rbp)
jmp    1535 <main+0x2f5>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc1b(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1486 <main+0x246>
movl   $0x1,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x60(%rbp)
jmp    1530 <main+0x2f0>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xbe0(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    14c9 <main+0x289>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1140 <atoi@plt>
mov    %eax,-0x54(%rbp)
jmp    152b <main+0x2eb>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xba8(%rip),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    150c <main+0x2cc>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1140 <atoi@plt>
mov    %eax,-0x58(%rbp)
jmp    1526 <main+0x2e6>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xb70(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    152b <main+0x2eb>
jmp    1530 <main+0x2f0>
jmp    1535 <main+0x2f5>
jmp    153a <main+0x2fa>
jmp    153f <main+0x2ff>
jmp    1544 <main+0x304>
jmp    1549 <main+0x309>
jmp    154e <main+0x30e>
jmp    1553 <main+0x313>
jmp    1558 <main+0x318>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12e2 <main+0xa2>
cmpl   $0x0,-0x50(%rbp)
je     1582 <main+0x342>
mov    -0x60(%rbp),%rsi
lea    0xb33(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
call   10c0 <server_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1030 <load_server_certificates@plt>
mov    -0x30(%rbp),%rdi
call   1140 <atoi@plt>
mov    %eax,%edi
call   10d0 <listen_socket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     160a <main+0x3ca>
mov    -0x60(%rbp),%rdi
lea    0xaef(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     1605 <main+0x3c5>
mov    -0x70(%rbp),%rcx
lea    0xad3(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
call   1160 <fwrite@plt>
mov    -0x70(%rbp),%rdi
call   1060 <fclose@plt>
jmp    160a <main+0x3ca>
jmp    160f <main+0x3cf>
movl   $0x8,-0x7c(%rbp)
lea    0xaaa(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x24(%rbp),%edi
lea    -0x78(%rbp),%rsi
lea    -0x7c(%rbp),%rdx
call   1130 <accept@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x74(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x98(%rbp)
mov    -0x78(%rbp),%edi
call   1100 <ntohs@plt>
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
lea    0xa85(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <SSL_new@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rdi
mov    -0x8c(%rbp),%esi
call   1050 <SSL_set_fd@plt>
cmpl   $0x0,-0x54(%rbp)
jg     169e <main+0x45e>
cmpl   $0x0,-0x58(%rbp)
jle    16b5 <main+0x475>
mov    -0x88(%rbp),%rdi
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%edx
call   10f0 <benchmark@plt>
jmp    16c1 <main+0x481>
mov    -0x88(%rbp),%rdi
call   1080 <process@plt>
jmp    16c6 <main+0x486>
cmpl   $0x0,-0x4c(%rbp)
jne    160f <main+0x3cf>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x18(%rbp),%rdi
call   1110 <SSL_CTX_free@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r12
mov    %edi,%r15d
xor    %eax,%eax
call   10f0 <SSLv3_server_method@plt>
cmp    $0x3,%r15d
jle    15f5 <main+0x3a5>
mov    %rax,%r14
mov    0x8(%r12),%rbp
mov    0x10(%r12),%rbx
mov    0x18(%r12),%rax
mov    %rax,0x18(%rsp)
mov    $0x1,%r13b
cmp    $0x4,%r15d
jne    12ba <main+0x6a>
xor    %edx,%edx
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,0x10(%rsp)
mov    0x18(%rsp),%r15
xor    %esi,%esi
jmp    14ba <main+0x26a>
mov    %rbx,0x28(%rsp)
mov    %rbp,0x30(%rsp)
mov    $0x4,%ebp
lea    0xd61(%rip),%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
jmp    1326 <main+0xd6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <SSLv3_server_method@plt>
mov    %rax,%r14
add    $0x1,%ebp
cmp    %r15d,%ebp
jge    1481 <main+0x231>
movslq %ebp,%r13
mov    (%r12,%r13,8),%rsi
mov    %rbx,%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1310 <main+0xc0>
mov    (%r12,%r13,8),%rsi
lea    0xcf4(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1310 <main+0xc0>
mov    (%r12,%r13,8),%rsi
lea    0xce7(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1310 <main+0xc0>
mov    (%r12,%r13,8),%rsi
lea    0xcda(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1310 <main+0xc0>
mov    (%r12,%r13,8),%rsi
lea    0xccd(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1412 <main+0x1c2>
mov    (%r12,%r13,8),%rsi
lea    0xcc0(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     141f <main+0x1cf>
mov    (%r12,%r13,8),%rsi
lea    0xcb8(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     142c <main+0x1dc>
mov    (%r12,%r13,8),%rsi
lea    0xca7(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1439 <main+0x1e9>
mov    (%r12,%r13,8),%rsi
lea    0xc9d(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1454 <main+0x204>
mov    (%r12,%r13,8),%rsi
lea    0xc93(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     146b <main+0x21b>
mov    (%r12,%r13,8),%rsi
lea    0xc89(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    131a <main+0xca>
movl   $0x1,0xc(%rsp)
jmp    131a <main+0xca>
movl   $0x1,0x10(%rsp)
jmp    131a <main+0xca>
movl   $0x1,0x8(%rsp)
jmp    131a <main+0xca>
lea    0x1(%r13),%ebp
mov    0x8(%r12,%r13,8),%rax
mov    %rax,0x38(%rsp)
movl   $0x1,0x14(%rsp)
jmp    131a <main+0xca>
lea    0x1(%r13),%ebp
mov    0x8(%r12,%r13,8),%rdi
call   1150 <atoi@plt>
mov    %eax,0x4(%rsp)
jmp    131a <main+0xca>
lea    0x1(%r13),%ebp
mov    0x8(%r12,%r13,8),%rdi
call   1150 <atoi@plt>
mov    %eax,(%rsp)
jmp    131a <main+0xca>
cmpl   $0x0,0x14(%rsp)
je     14a0 <main+0x250>
lea    0xc1f(%rip),%rdi
xor    %r13d,%r13d
mov    0x38(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    14a3 <main+0x253>
mov    $0x1,%r13b
mov    0x30(%rsp),%rbp
mov    0x28(%rsp),%rbx
mov    0x18(%rsp),%r15
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
call   10d0 <server_init@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <load_server_certificates@plt>
mov    %rbp,%rdi
call   1150 <atoi@plt>
mov    %eax,%edi
call   10e0 <listen_socket@plt>
mov    %eax,%ebp
test   %r13b,%r13b
jne    1523 <main+0x2d3>
lea    0xbcd(%rip),%rsi
mov    0x38(%rsp),%rdi
call   1130 <fopen@plt>
test   %rax,%rax
je     1523 <main+0x2d3>
mov    %rax,%r14
lea    0xbb7(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1170 <fwrite@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
cmpl   $0x0,0x4(%rsp)
setg   %al
cmpl   $0x0,(%rsp)
setg   %r13b
or     %al,%r13b
jmp    1550 <main+0x300>
nopl   0x0(%rax,%rax,1)
call   1090 <process@plt>
cmpl   $0x0,0x10(%rsp)
je     15d5 <main+0x385>
movl   $0x8,0x24(%rsp)
lea    0xb89(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
lea    0x40(%rsp),%rsi
lea    0x24(%rsp),%rdx
call   1140 <accept@plt>
mov    %eax,%r15d
mov    0x44(%rsp),%edi
call   1050 <inet_ntoa@plt>
mov    %rax,%rbx
mov    0x40(%rsp),%edi
call   1110 <ntohs@plt>
lea    0xb33(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
call   10b0 <SSL_new@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r15d,%esi
call   1060 <SSL_set_fd@plt>
mov    %r14,%rdi
test   %r13b,%r13b
je     1540 <main+0x2f0>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
call   1100 <benchmark@plt>
cmpl   $0x0,0x10(%rsp)
jne    1550 <main+0x300>
mov    %ebp,%edi
call   10a0 <close@plt>
mov    %r12,%rdi
call   1120 <SSL_CTX_free@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r12),%rsi
lea    0xa00(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [49 x i8] c"Usage: %s <portnum> <cert.pem> <key.pem> [opts]\0A\00"
@.str.1 = [8 x i8] c"tls-1.2\00"
@.str.2 = [8 x i8] c"tls-1.1\00"
@.str.3 = [8 x i8] c"tls-1.0\00"
@.str.4 = [8 x i8] c"ssl-3.0\00"
@.str.5 = [12 x i8] c"client-cert\00"
@.str.6 = [13 x i8] c"keep-running\00"
@.str.7 = [4 x i8] c"dhe\00"
@.str.8 = [11 x i8] c"ready-file\00"
@.str.9 = [11 x i8] c"bench-send\00"
@.str.10 = [11 x i8] c"bench-recv\00"
@.str.11 = [31 x i8] c"warning: unknown option: \22%s\22\0A\00"
@.str.12 = [15 x i8] c"readyfile: %s\0A\00"
@.str.13 = [3 x i8] c"w+\00"
@.str.14 = [7 x i8] c"ready\0A\00"
@.str.15 = [31 x i8] c"[status] accepting connection\0A\00"
@.str.16 = [33 x i8] c"[log] got connection from %s:%d\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 i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32*
%21 = alloca %struct.sockaddr_in
%22 = alloca i32
%23 = alloca i32*
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%25 = call i32* (...) @SSLv3_server_method()
store i32* %25, i32** %7
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 4
br i1 %27, label %28, label %34
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 -1)
unreachable
34: ; preds = %2
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
store i8* %37, i8** %9
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
store i8* %40, i8** %10
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 3
%43 = load i8*, i8** %42
store i8* %43, i8** %11
store i32 4, i32* %19
br label %44
44: ; preds = %179, %34
%45 = load i32, i32* %19
%46 = load i32, i32* %4
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %182
48: ; preds = %44
%49 = load i8**, i8*** %5
%50 = load i32, i32* %19
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32* (...) @SSLv3_server_method()
store i32* %57, i32** %7
br label %178
58: ; preds = %48
%59 = load i8**, i8*** %5
%60 = load i32, i32* %19
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %58
%67 = call i32* (...) @SSLv3_server_method()
store i32* %67, i32** %7
br label %177
68: ; preds = %58
%69 = load i8**, i8*** %5
%70 = load i32, i32* %19
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %73)
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %68
%77 = call i32* (...) @SSLv3_server_method()
store i32* %77, i32** %7
br label %176
78: ; preds = %68
%79 = load i8**, i8*** %5
%80 = load i32, i32* %19
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8*, i8** %79, i64 %81
%83 = load i8*, i8** %82
%84 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %83)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %78
%87 = call i32* (...) @SSLv3_server_method()
store i32* %87, i32** %7
br label %175
88: ; preds = %78
%89 = load i8**, i8*** %5
%90 = load i32, i32* %19
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8*, i8** %89, i64 %91
%93 = load i8*, i8** %92
%94 = call i64 @strcmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %93)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %88
store i32 1, i32* %12
br label %174
97: ; preds = %88
%98 = load i8**, i8*** %5
%99 = load i32, i32* %19
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8*, i8** %98, i64 %100
%102 = load i8*, i8** %101
%103 = call i64 @strcmp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %102)
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %97
store i32 1, i32* %14
br label %173
106: ; preds = %97
%107 = load i8**, i8*** %5
%108 = load i32, i32* %19
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8*, i8** %107, i64 %109
%111 = load i8*, i8** %110
%112 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %111)
%113 = icmp eq i64 %112, 0
br i1 %113, label %114, label %115
114: ; preds = %106
store i32 1, i32* %13
br label %172
115: ; preds = %106
%116 = load i8**, i8*** %5
%117 = load i32, i32* %19
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8*, i8** %116, i64 %118
%120 = load i8*, i8** %119
%121 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %120)
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %130
123: ; preds = %115
store i32 1, i32* %15
%124 = load i8**, i8*** %5
%125 = load i32, i32* %19
%126 = add nsw i32 %125, 1
store i32 %126, i32* %19
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8*, i8** %124, i64 %127
%129 = load i8*, i8** %128
store i8* %129, i8** %18
br label %171
130: ; preds = %115
%131 = load i8**, i8*** %5
%132 = load i32, i32* %19
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i8*, i8** %131, i64 %133
%135 = load i8*, i8** %134
%136 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %135)
%137 = icmp eq i64 %136, 0
br i1 %137, label %138, label %146
138: ; preds = %130
%139 = load i8**, i8*** %5
%140 = load i32, i32* %19
%141 = add nsw i32 %140, 1
store i32 %141, i32* %19
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds i8*, i8** %139, i64 %142
%144 = load i8*, i8** %143
%145 = call i32 @atoi(i8* %144)
store i32 %145, i32* %16
br label %170
146: ; preds = %130
%147 = load i8**, i8*** %5
%148 = load i32, i32* %19
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8*, i8** %147, i64 %149
%151 = load i8*, i8** %150
%152 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %151)
%153 = icmp eq i64 %152, 0
br i1 %153, label %154, label %162
154: ; preds = %146
%155 = load i8**, i8*** %5
%156 = load i32, i32* %19
%157 = add nsw i32 %156, 1
store i32 %157, i32* %19
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8*, i8** %155, i64 %158
%160 = load i8*, i8** %159
%161 = call i32 @atoi(i8* %160)
store i32 %161, i32* %17
br label %169
162: ; preds = %146
%163 = load i8**, i8*** %5
%164 = load i32, i32* %19
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8*, i8** %163, i64 %165
%167 = load i8*, i8** %166
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %167)
br label %169
169: ; preds = %162, %154
br label %170
170: ; preds = %169, %138
br label %171
171: ; preds = %170, %123
br label %172
172: ; preds = %171, %114
br label %173
173: ; preds = %172, %105
br label %174
174: ; preds = %173, %96
br label %175
175: ; preds = %174, %86
br label %176
176: ; preds = %175, %76
br label %177
177: ; preds = %176, %66
br label %178
178: ; preds = %177, %56
br label %179
179: ; preds = %178
%180 = load i32, i32* %19
%181 = add nsw i32 %180, 1
store i32 %181, i32* %19
br label %44
182: ; preds = %44
%183 = load i32, i32* %15
%184 = icmp ne i32 %183, 0
br i1 %184, label %185, label %188
185: ; preds = %182
%186 = load i8*, i8** %18
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i8* %186)
br label %188
188: ; preds = %185, %182
%189 = load i32*, i32** %7
%190 = load i32, i32* %12
%191 = load i32, i32* %13
%192 = call i32* @server_init(i32* %189, i32 %190, i32 %191)
store i32* %192, i32** %6
%193 = load i32*, i32** %6
%194 = load i8*, i8** %10
%195 = load i8*, i8** %11
%196 = call i32 @load_server_certificates(i32* %193, i8* %194, i8* %195)
%197 = load i8*, i8** %9
%198 = call i32 @atoi(i8* %197)
%199 = call i32 @listen_socket(i32 %198)
store i32 %199, i32* %8
%200 = load i32, i32* %15
%201 = icmp ne i32 %200, 0
br i1 %201, label %202, label %213
202: ; preds = %188
%203 = load i8*, i8** %18
%204 = call i32* @fopen(i8* %203, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
store i32* %204, i32** %20
%205 = load i32*, i32** %20
%206 = icmp ne i32* %205, null
br i1 %206, label %207, label %212
207: ; preds = %202
%208 = load i32*, i32** %20
%209 = call i32 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 6, i32 1, i32* %208)
%210 = load i32*, i32** %20
%211 = call i32 @fclose(i32* %210)
br label %212
212: ; preds = %207, %202
br label %213
213: ; preds = %212, %188
br label %214
214: ; preds = %245, %213
store i32 8, i32* %22
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0))
%216 = load i32, i32* %8
%217 = bitcast %struct.sockaddr_in* %21 to %struct.sockaddr*
%218 = call i32 @accept(i32 %216, %struct.sockaddr* %217, i32* %22)
store i32 %218, i32* %24
%219 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %21, i32 0, i32 1
%220 = load i32, i32* %219
%221 = call i8* @inet_ntoa(i32 %220)
%222 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %21, i32 0, i32 0
%223 = load i32, i32* %222
%224 = call i32 @ntohs(i32 %223)
%225 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.16, i64 0, i64 0), i8* %221, i32 %224)
%226 = load i32*, i32** %6
%227 = call i32* @SSL_new(i32* %226)
store i32* %227, i32** %23
%228 = load i32*, i32** %23
%229 = load i32, i32* %24
%230 = call i32 @SSL_set_fd(i32* %228, i32 %229)
%231 = load i32, i32* %16
%232 = icmp sgt i32 %231, 0
br i1 %232, label %236, label %233
233: ; preds = %214
%234 = load i32, i32* %17
%235 = icmp sgt i32 %234, 0
br i1 %235, label %236, label %241
236: ; preds = %233, %214
%237 = load i32*, i32** %23
%238 = load i32, i32* %16
%239 = load i32, i32* %17
%240 = call i32 @benchmark(i32* %237, i32 %238, i32 %239)
br label %244
241: ; preds = %233
%242 = load i32*, i32** %23
%243 = call i32 @process(i32* %242)
br label %244
244: ; preds = %241, %236
br label %245
245: ; preds = %244
%246 = load i32, i32* %14
%247 = icmp ne i32 %246, 0
br i1 %247, label %214, label %248
248: ; preds = %245
%249 = load i32, i32* %8
%250 = call i32 @close(i32 %249)
%251 = load i32*, i32** %6
%252 = call i32 @SSL_CTX_free(i32* %251)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [49 x i8] c"Usage: %s <portnum> <cert.pem> <key.pem> [opts]\0A\00"
@.str.1 = [8 x i8] c"tls-1.2\00"
@.str.2 = [8 x i8] c"tls-1.1\00"
@.str.3 = [8 x i8] c"tls-1.0\00"
@.str.4 = [8 x i8] c"ssl-3.0\00"
@.str.5 = [12 x i8] c"client-cert\00"
@.str.6 = [13 x i8] c"keep-running\00"
@.str.7 = [4 x i8] c"dhe\00"
@.str.8 = [11 x i8] c"ready-file\00"
@.str.9 = [11 x i8] c"bench-send\00"
@.str.10 = [11 x i8] c"bench-recv\00"
@.str.11 = [31 x i8] c"warning: unknown option: \22%s\22\0A\00"
@.str.12 = [15 x i8] c"readyfile: %s\0A\00"
@.str.13 = [3 x i8] c"w+\00"
@.str.14 = [7 x i8] c"ready\0A\00"
@.str.16 = [33 x i8] c"[log] got connection from %s:%d\0A\00"
@str = [30 x i8] c"[status] accepting connection\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = tail call i32* (...) @SSLv3_server_method()
%6 = icmp slt i32 %0, 4
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = icmp eq i32 %0, 4
br i1 %18, label %114, label %19
19: ; preds = %11, %98
%20 = phi i32* [ %107, %98 ], [ %5, %11 ]
%21 = phi i32 [ %106, %98 ], [ 0, %11 ]
%22 = phi i32 [ %105, %98 ], [ 0, %11 ]
%23 = phi i32 [ %108, %98 ], [ 4, %11 ]
%24 = phi i8* [ %103, %98 ], [ undef, %11 ]
%25 = phi i32 [ %102, %98 ], [ 0, %11 ]
%26 = phi i32 [ %101, %98 ], [ 0, %11 ]
%27 = phi i32 [ %100, %98 ], [ 0, %11 ]
%28 = phi i32 [ %99, %98 ], [ 0, %11 ]
%29 = sext i32 %23 to i64
%30 = getelementptr inbounds i8*, i8** %1, i64 %29
%31 = load i8*, i8** %30
%32 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %19
%35 = tail call i32* (...) @SSLv3_server_method()
br label %98
36: ; preds = %19
%37 = load i8*, i8** %30
%38 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = tail call i32* (...) @SSLv3_server_method()
br label %98
42: ; preds = %36
%43 = load i8*, i8** %30
%44 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = tail call i32* (...) @SSLv3_server_method()
br label %98
48: ; preds = %42
%49 = load i8*, i8** %30
%50 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = tail call i32* (...) @SSLv3_server_method()
br label %98
54: ; preds = %48
%55 = load i8*, i8** %30
%56 = tail call i64 @strcmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %98, label %58
58: ; preds = %54
%59 = load i8*, i8** %30
%60 = tail call i64 @strcmp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %98, label %62
62: ; preds = %58
%63 = load i8*, i8** %30
%64 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %98, label %66
66: ; preds = %62
%67 = load i8*, i8** %30
%68 = tail call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %67)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %66
%71 = add nsw i32 %23, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %1, i64 %72
%74 = load i8*, i8** %73
br label %98
75: ; preds = %66
%76 = load i8*, i8** %30
%77 = tail call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %76)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %85
79: ; preds = %75
%80 = add nsw i32 %23, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8*, i8** %1, i64 %81
%83 = load i8*, i8** %82
%84 = tail call i32 @atoi(i8* %83)
br label %98
85: ; preds = %75
%86 = load i8*, i8** %30
%87 = tail call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %86)
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %95
89: ; preds = %85
%90 = add nsw i32 %23, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8*, i8** %1, i64 %91
%93 = load i8*, i8** %92
%94 = tail call i32 @atoi(i8* %93)
br label %98
95: ; preds = %85
%96 = load i8*, i8** %30
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %96)
br label %98
98: ; preds = %62, %58, %54, %34, %46, %79, %95, %89, %70, %52, %40
%99 = phi i32 [ %28, %34 ], [ %28, %40 ], [ %28, %46 ], [ %28, %52 ], [ %28, %70 ], [ %28, %79 ], [ %28, %89 ], [ %28, %95 ], [ %28, %54 ], [ 1, %58 ], [ %28, %62 ]
%100 = phi i32 [ %27, %34 ], [ %27, %40 ], [ %27, %46 ], [ %27, %52 ], [ 1, %70 ], [ %27, %79 ], [ %27, %89 ], [ %27, %95 ], [ %27, %54 ], [ %27, %58 ], [ %27, %62 ]
%101 = phi i32 [ %26, %34 ], [ %26, %40 ], [ %26, %46 ], [ %26, %52 ], [ %26, %70 ], [ %84, %79 ], [ %26, %89 ], [ %26, %95 ], [ %26, %54 ], [ %26, %58 ], [ %26, %62 ]
%102 = phi i32 [ %25, %34 ], [ %25, %40 ], [ %25, %46 ], [ %25, %52 ], [ %25, %70 ], [ %25, %79 ], [ %94, %89 ], [ %25, %95 ], [ %25, %54 ], [ %25, %58 ], [ %25, %62 ]
%103 = phi i8* [ %24, %34 ], [ %24, %40 ], [ %24, %46 ], [ %24, %52 ], [ %74, %70 ], [ %24, %79 ], [ %24, %89 ], [ %24, %95 ], [ %24, %54 ], [ %24, %58 ], [ %24, %62 ]
%104 = phi i32 [ %23, %34 ], [ %23, %40 ], [ %23, %46 ], [ %23, %52 ], [ %71, %70 ], [ %80, %79 ], [ %90, %89 ], [ %23, %95 ], [ %23, %54 ], [ %23, %58 ], [ %23, %62 ]
%105 = phi i32 [ %22, %34 ], [ %22, %40 ], [ %22, %46 ], [ %22, %52 ], [ %22, %70 ], [ %22, %79 ], [ %22, %89 ], [ %22, %95 ], [ %22, %54 ], [ %22, %58 ], [ 1, %62 ]
%106 = phi i32 [ %21, %34 ], [ %21, %40 ], [ %21, %46 ], [ %21, %52 ], [ %21, %70 ], [ %21, %79 ], [ %21, %89 ], [ %21, %95 ], [ 1, %54 ], [ %21, %58 ], [ %21, %62 ]
%107 = phi i32* [ %35, %34 ], [ %41, %40 ], [ %47, %46 ], [ %53, %52 ], [ %20, %70 ], [ %20, %79 ], [ %20, %89 ], [ %20, %95 ], [ %20, %54 ], [ %20, %58 ], [ %20, %62 ]
%108 = add nsw i32 %104, 1
%109 = icmp slt i32 %108, %0
br i1 %109, label %19, label %110
110: ; preds = %98
%111 = icmp eq i32 %100, 0
br i1 %111, label %114, label %112
112: ; preds = %110
%113 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i8* %103)
br label %114
114: ; preds = %11, %112, %110
%115 = phi i1 [ false, %112 ], [ true, %110 ], [ true, %11 ]
%116 = phi i32* [ %107, %112 ], [ %107, %110 ], [ %5, %11 ]
%117 = phi i32 [ %106, %112 ], [ %106, %110 ], [ 0, %11 ]
%118 = phi i32 [ %105, %112 ], [ %105, %110 ], [ 0, %11 ]
%119 = phi i8* [ %103, %112 ], [ %103, %110 ], [ undef, %11 ]
%120 = phi i32 [ %102, %112 ], [ %102, %110 ], [ 0, %11 ]
%121 = phi i32 [ %101, %112 ], [ %101, %110 ], [ 0, %11 ]
%122 = phi i32 [ %99, %112 ], [ %99, %110 ], [ 0, %11 ]
%123 = tail call i32* @server_init(i32* %116, i32 %117, i32 %118)
%124 = tail call i32 @load_server_certificates(i32* %123, i8* %15, i8* %17)
%125 = tail call i32 @atoi(i8* %13)
%126 = tail call i32 @listen_socket(i32 %125)
br i1 %115, label %133, label %127
127: ; preds = %114
%128 = tail call i32* @fopen(i8* %119, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%129 = icmp eq i32* %128, null
br i1 %129, label %133, label %130
130: ; preds = %127
%131 = tail call i32 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 6, i32 1, i32* %128)
%132 = tail call i32 @fclose(i32* %128)
br label %133
133: ; preds = %127, %130, %114
%134 = bitcast %struct.sockaddr_in* %3 to i8*
%135 = bitcast i32* %4 to i8*
%136 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%137 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
%138 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%139 = icmp sgt i32 %121, 0
%140 = icmp sgt i32 %120, 0
%141 = select i1 %139, i1 true, i1 %140
%142 = icmp eq i32 %122, 0
br label %143
143: ; preds = %157, %133
store i32 8, i32* %4
%144 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%145 = call i32 @accept(i32 %126, %struct.sockaddr* %136, i32* %4)
%146 = load i32, i32* %137
%147 = call i8* @inet_ntoa(i32 %146)
%148 = load i32, i32* %138
%149 = call i32 @ntohs(i32 %148)
%150 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.16, i64 0, i64 0), i8* %147, i32 %149)
%151 = call i32* @SSL_new(i32* %123)
%152 = call i32 @SSL_set_fd(i32* %151, i32 %145)
br i1 %141, label %153, label %155
153: ; preds = %143
%154 = call i32 @benchmark(i32* %151, i32 %121, i32 %120)
br label %157
155: ; preds = %143
%156 = call i32 @process(i32* %151)
br label %157
157: ; preds = %155, %153
br i1 %142, label %158, label %143
158: ; preds = %157
%159 = call i32 @close(i32 %126)
%160 = call i32 @SSL_CTX_free(i32* %123)
ret i32 0
}