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

/* Variables and functions */
scalar_t__ BIO_do_accept(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_free_all(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BIO_new_accept(char *);
int /*<<< orphan*/ *BIO_new_ssl(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *BIO_pop(int /*<<< orphan*/ *);
int BIO_read(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ BIO_set_accept_bios(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ ERR_print_errors_fp(int /*<<< orphan*/);
int /*<<< orphan*/ SSL_CONF_CTX_finish(int /*<<< orphan*/ *);
int /*<<< orphan*/ *SSL_CONF_CTX_new();
int /*<<< orphan*/ SSL_CONF_CTX_set_flags(int /*<<< orphan*/ *,
                                          int /*<<< orphan*/);
int /*<<< orphan*/ SSL_CONF_CTX_set_ssl_ctx(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CONF_FLAG_CERTIFICATE;
int /*<<< orphan*/ SSL_CONF_FLAG_SERVER;
int SSL_CONF_cmd_argv(int /*<<< orphan*/ *, int *, char ***);
int /*<<< orphan*/ *SSL_CTX_new(int /*<<< orphan*/);
int /*<<< orphan*/ TLS_server_method();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *port = "*:4433";
  BIO *ssl_bio, *tmp;
  SSL_CTX *ctx;
  SSL_CONF_CTX *cctx;
  char buf[512];
  BIO *in = NULL;
  int ret = 1, i;
  char **args = argv + 1;
  int nargs = argc - 1;
  ctx = SSL_CTX_new(TLS_server_method());
  cctx = SSL_CONF_CTX_new();
  SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_SERVER);
  SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CERTIFICATE);
  SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
  while (*args && **args == '-') {
    int rv;
    rv = SSL_CONF_cmd_argv(cctx, &nargs, &args);
    if (rv == -3) {
      fprintf(stderr, "Missing argument for %s\n", *args);
      goto err;
    }
    if (rv < 0) {
      fprintf(stderr, "Error in command %s\n", *args);
      ERR_print_errors_fp(stderr);
      goto err;
    }
    if (rv > 0)
      continue;
    if (strcmp(*args, "-port") == 0) {
      port = args[1];
      if (port == NULL) {
        fprintf(stderr, "Missing -port argument\n");
        goto err;
      }
      args += 2;
      nargs -= 2;
      continue;
    } else {
      fprintf(stderr, "Unknown argument %s\n", *args);
      goto err;
    }
  }
  if (!SSL_CONF_CTX_finish(cctx)) {
    fprintf(stderr, "Finish error\n");
    ERR_print_errors_fp(stderr);
    goto err;
  }
  ssl_bio = BIO_new_ssl(ctx, 0);
  if ((in = BIO_new_accept(port)) == NULL)
    goto err;
  BIO_set_accept_bios(in, ssl_bio);
again:
  if (BIO_do_accept(in) <= 0)
    goto err;
  for (;;) {
    i = BIO_read(in, buf, 512);
    if (i == 0) {
      printf("Done\n");
      tmp = BIO_pop(in);
      BIO_free_all(tmp);
      goto again;
    }
    if (i < 0)
      goto err;
    fwrite(buf, 1, i, stdout);
    fflush(stdout);
  }
  ret = 0;
err:
  if (ret) {
    ERR_print_errors_fp(stderr);
  }
  BIO_free(in);
  exit(ret);
  return (!ret);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xd80(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x248(%rbp)
movl   $0x1,-0x24c(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x258(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x25c(%rbp)
mov    $0x0,%al
call   1030 <TLS_server_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1120 <SSL_CONF_CTX_new@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x2d04(%rip),%rax
mov    (%rax),%esi
call   1080 <SSL_CONF_CTX_set_flags@plt>
mov    -0x38(%rbp),%rdi
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
call   1080 <SSL_CONF_CTX_set_flags@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1130 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    -0x258(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x261(%rbp)
je     1334 <main+0xd4>
mov    -0x258(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x261(%rbp)
mov    -0x261(%rbp),%al
test   $0x1,%al
jne    1347 <main+0xe7>
jmp    148c <main+0x22c>
mov    -0x38(%rbp),%rdi
lea    -0x25c(%rbp),%rsi
lea    -0x258(%rbp),%rdx
call   10e0 <SSL_CONF_cmd_argv@plt>
mov    %eax,-0x260(%rbp)
cmpl   $0xfffffffd,-0x260(%rbp)
jne    1397 <main+0x137>
mov    0x2c60(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xc7c(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15c0 <main+0x360>
cmpl   $0x0,-0x260(%rbp)
jge    13d8 <main+0x178>
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xc62(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2c0c(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    15c0 <main+0x360>
cmpl   $0x0,-0x260(%rbp)
jle    13ea <main+0x18a>
jmp    1302 <main+0xa2>
mov    -0x258(%rbp),%rax
mov    (%rax),%rdi
lea    0xc3a(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1466 <main+0x206>
mov    -0x258(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1440 <main+0x1e0>
mov    0x2bad(%rip),%rax
mov    (%rax),%edi
lea    0xc07(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15c0 <main+0x360>
mov    -0x258(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x258(%rbp)
mov    -0x25c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x25c(%rbp)
jmp    1302 <main+0xa2>
mov    0x2b6b(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xbd3(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15c0 <main+0x360>
mov    -0x38(%rbp),%rdi
call   1040 <SSL_CONF_CTX_finish@plt>
cmp    $0x0,%eax
jne    14c8 <main+0x268>
mov    0x2b33(%rip),%rax
mov    (%rax),%edi
lea    0xbba(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2b1c(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    15c0 <main+0x360>
mov    -0x30(%rbp),%rdi
xor    %esi,%esi
call   10a0 <BIO_new_ssl@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <BIO_new_accept@plt>
mov    %rax,-0x248(%rbp)
cmp    $0x0,%rax
jne    14f6 <main+0x296>
jmp    15c0 <main+0x360>
mov    -0x248(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <BIO_set_accept_bios@plt>
mov    -0x248(%rbp),%rdi
call   1140 <BIO_do_accept@plt>
cmp    $0x0,%rax
jg     1521 <main+0x2c1>
jmp    15c0 <main+0x360>
jmp    1526 <main+0x2c6>
mov    -0x248(%rbp),%rdi
lea    -0x240(%rbp),%rsi
mov    $0x200,%edx
call   1070 <BIO_read@plt>
mov    %eax,-0x250(%rbp)
cmpl   $0x0,-0x250(%rbp)
jne    157b <main+0x31b>
lea    0xb1e(%rip),%rdi
call   1090 <printf@plt>
mov    -0x248(%rbp),%rdi
call   10c0 <BIO_pop@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1150 <BIO_free_all@plt>
jmp    1506 <main+0x2a6>
cmpl   $0x0,-0x250(%rbp)
jge    158d <main+0x32d>
jmp    15c0 <main+0x360>
lea    -0x240(%rbp),%rdi
mov    -0x250(%rbp),%edx
mov    0x2a27(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1170 <fwrite@plt>
mov    0x2a14(%rip),%rax
mov    (%rax),%edi
call   1100 <fflush@plt>
jmp    1526 <main+0x2c6>
cmpl   $0x0,-0x24c(%rbp)
je     15db <main+0x37b>
mov    0x2a04(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
mov    -0x248(%rbp),%rdi
call   1110 <BIO_free@plt>
mov    -0x24c(%rbp),%edi
call   1160 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%rbx
lea    0x8(%rsi),%rax
mov    %rax,(%rsp)
add    $0xffffffff,%edi
mov    %edi,0xc(%rsp)
xor    %eax,%eax
call   1030 <TLS_server_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1120 <SSL_CONF_CTX_new@plt>
mov    %rax,%r15
mov    0x2d3b(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1130 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    0x8(%rbx),%rax
lea    0xd2a(%rip),%rbx
test   %rax,%rax
jne    130a <main+0xaa>
mov    %r15,%rdi
call   1040 <SSL_CONF_CTX_finish@plt>
test   %eax,%eax
jne    1386 <main+0x126>
mov    0x2ce6(%rip),%rbx
mov    (%rbx),%edi
lea    0xd6d(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1482 <main+0x222>
lea    0xc(%rsp),%r12
mov    %rsp,%r13
lea    0xd1c(%rip),%rbp
jmp    1328 <main+0xc8>
nopl   0x0(%rax,%rax,1)
mov    (%rax),%rax
test   %rax,%rax
je     12db <main+0x7b>
cmpb   $0x2d,(%rax)
jne    12db <main+0x7b>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10e0 <SSL_CONF_cmd_argv@plt>
cmp    $0xfffffffd,%eax
je     1448 <main+0x1e8>
test   %eax,%eax
js     1461 <main+0x201>
mov    (%rsp),%rax
jne    1320 <main+0xc0>
mov    (%rax),%rdi
mov    %rbp,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    148b <main+0x22b>
mov    (%rsp),%rax
mov    0x8(%rax),%rbx
test   %rbx,%rbx
je     14ae <main+0x24e>
add    $0x10,%rax
mov    %rax,(%rsp)
addl   $0xfffffffe,0xc(%rsp)
jmp    1320 <main+0xc0>
mov    %r14,%rdi
xor    %esi,%esi
call   10a0 <BIO_new_ssl@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1060 <BIO_new_accept@plt>
test   %rax,%rax
jne    13a8 <main+0x148>
xor    %r14d,%r14d
jmp    14c8 <main+0x268>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbp,%rsi
call   1070 <BIO_set_accept_bios@plt>
mov    %r14,%rdi
call   1140 <BIO_do_accept@plt>
test   %rax,%rax
jle    14c8 <main+0x268>
lea    0x10(%rsp),%rbx
lea    0xca3(%rip),%r15
mov    0x2bee(%rip),%rbp
jmp    1410 <main+0x1b0>
mov    %r15,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   10c0 <BIO_pop@plt>
mov    %rax,%rdi
call   1150 <BIO_free_all@plt>
mov    %r14,%rdi
call   1140 <BIO_do_accept@plt>
test   %rax,%rax
jle    14c8 <main+0x268>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x200,%edx
call   1080 <BIO_read@plt>
test   %eax,%eax
je     13dc <main+0x17c>
test   %eax,%eax
js     14c8 <main+0x268>
mov    0x0(%rbp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1170 <fwrite@plt>
mov    0x0(%rbp),%edi
call   1100 <fflush@plt>
jmp    1410 <main+0x1b0>
mov    0x2b89(%rip),%rax
mov    (%rax),%edi
mov    (%rsp),%rax
mov    (%rax),%rdx
lea    0xba8(%rip),%rsi
jmp    14a2 <main+0x242>
mov    0x2b70(%rip),%rbx
mov    (%rbx),%edi
mov    (%rsp),%rax
mov    (%rax),%rdx
lea    0xba8(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%rbx),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    14c8 <main+0x268>
mov    0x2b46(%rip),%rax
mov    (%rax),%edi
mov    (%rsp),%rax
mov    (%rax),%rdx
lea    0xbb1(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    14c8 <main+0x268>
mov    0x2b23(%rip),%rax
mov    (%rax),%edi
lea    0xb7d(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x2b09(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
mov    %r14,%rdi
call   1110 <BIO_free@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"*:4433\00"
@SSL_CONF_FLAG_SERVER = global i32 0
@SSL_CONF_FLAG_CERTIFICATE = global i32 0
@stderr = global i32 0
@.str.1 = [25 x i8] c"Missing argument for %s\0A\00"
@.str.2 = [21 x i8] c"Error in command %s\0A\00"
@.str.3 = [6 x i8] c"-port\00"
@.str.4 = [24 x i8] c"Missing -port argument\0A\00"
@.str.5 = [21 x i8] c"Unknown argument %s\0A\00"
@.str.6 = [14 x i8] c"Finish error\0A\00"
@.str.7 = [6 x i8] c"Done\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [512 x i8]
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8**
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6
store i32* null, i32** %12
store i32 1, i32* %13
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
store i8** %19, i8*** %15
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %16
%22 = call i32 (...) @TLS_server_method()
%23 = call i32* @SSL_CTX_new(i32 %22)
store i32* %23, i32** %9
%24 = call i32* (...) @SSL_CONF_CTX_new()
store i32* %24, i32** %10
%25 = load i32*, i32** %10
%26 = load i32, i32* @SSL_CONF_FLAG_SERVER
%27 = call i32 @SSL_CONF_CTX_set_flags(i32* %25, i32 %26)
%28 = load i32*, i32** %10
%29 = load i32, i32* @SSL_CONF_FLAG_CERTIFICATE
%30 = call i32 @SSL_CONF_CTX_set_flags(i32* %28, i32 %29)
%31 = load i32*, i32** %10
%32 = load i32*, i32** %9
%33 = call i32 @SSL_CONF_CTX_set_ssl_ctx(i32* %31, i32* %32)
br label %34
34: ; preds = %84, %69, %2
%35 = load i8**, i8*** %15
%36 = load i8*, i8** %35
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %44
38: ; preds = %34
%39 = load i8**, i8*** %15
%40 = load i8*, i8** %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 45
br label %44
44: ; preds = %38, %34
%45 = phi i1 [ false, %34 ], [ %43, %38 ]
br i1 %45, label %46, label %94
46: ; preds = %44
%47 = load i32*, i32** %10
%48 = call i32 @SSL_CONF_cmd_argv(i32* %47, i32* %16, i8*** %15)
store i32 %48, i32* %17
%49 = load i32, i32* %17
%50 = icmp eq i32 %49, -3
br i1 %50, label %51, label %56
51: ; preds = %46
%52 = load i32, i32* @stderr
%53 = load i8**, i8*** %15
%54 = load i8*, i8** %53
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %54)
br label %143
56: ; preds = %46
%57 = load i32, i32* %17
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %66
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = load i8**, i8*** %15
%62 = load i8*, i8** %61
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %62)
%64 = load i32, i32* @stderr
%65 = call i32 @ERR_print_errors_fp(i32 %64)
br label %143
66: ; preds = %56
%67 = load i32, i32* %17
%68 = icmp sgt i32 %67, 0
br i1 %68, label %69, label %70
69: ; preds = %66
br label %34
70: ; preds = %66
%71 = load i8**, i8*** %15
%72 = load i8*, i8** %71
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %89
75: ; preds = %70
%76 = load i8**, i8*** %15
%77 = getelementptr inbounds i8*, i8** %76, i64 1
%78 = load i8*, i8** %77
store i8* %78, i8** %6
%79 = load i8*, i8** %6
%80 = icmp eq i8* %79, null
br i1 %80, label %81, label %84
81: ; preds = %75
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %143
84: ; preds = %75
%85 = load i8**, i8*** %15
%86 = getelementptr inbounds i8*, i8** %85, i64 2
store i8** %86, i8*** %15
%87 = load i32, i32* %16
%88 = sub nsw i32 %87, 2
store i32 %88, i32* %16
br label %34
89: ; preds = %70
%90 = load i32, i32* @stderr
%91 = load i8**, i8*** %15
%92 = load i8*, i8** %91
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %92)
br label %143
94: ; preds = %44
%95 = load i32*, i32** %10
%96 = call i32 @SSL_CONF_CTX_finish(i32* %95)
%97 = icmp ne i32 %96, 0
br i1 %97, label %103, label %98
98: ; preds = %94
%99 = load i32, i32* @stderr
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%101 = load i32, i32* @stderr
%102 = call i32 @ERR_print_errors_fp(i32 %101)
br label %143
103: ; preds = %94
%104 = load i32*, i32** %9
%105 = call i32* @BIO_new_ssl(i32* %104, i32 0)
store i32* %105, i32** %7
%106 = load i8*, i8** %6
%107 = call i32* @BIO_new_accept(i8* %106)
store i32* %107, i32** %12
%108 = icmp eq i32* %107, null
br i1 %108, label %109, label %110
109: ; preds = %103
br label %143
110: ; preds = %103
%111 = load i32*, i32** %12
%112 = load i32*, i32** %7
%113 = call i32 @BIO_set_accept_bios(i32* %111, i32* %112)
br label %114
114: ; preds = %126, %110
%115 = load i32*, i32** %12
%116 = call i64 @BIO_do_accept(i32* %115)
%117 = icmp sle i64 %116, 0
br i1 %117, label %118, label %119
118: ; preds = %114
br label %143
119: ; preds = %114
br label %120
120: ; preds = %136, %119
%121 = load i32*, i32** %12
%122 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%123 = call i32 @BIO_read(i32* %121, i8* %122, i32 512)
store i32 %123, i32* %14
%124 = load i32, i32* %14
%125 = icmp eq i32 %124, 0
br i1 %125, label %126, label %132
126: ; preds = %120
%127 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%128 = load i32*, i32** %12
%129 = call i32* @BIO_pop(i32* %128)
store i32* %129, i32** %8
%130 = load i32*, i32** %8
%131 = call i32 @BIO_free_all(i32* %130)
br label %114
132: ; preds = %120
%133 = load i32, i32* %14
%134 = icmp slt i32 %133, 0
br i1 %134, label %135, label %136
135: ; preds = %132
br label %143
136: ; preds = %132
%137 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%138 = load i32, i32* %14
%139 = load i32, i32* @stdout
%140 = call i32 @fwrite(i8* %137, i32 1, i32 %138, i32 %139)
%141 = load i32, i32* @stdout
%142 = call i32 @fflush(i32 %141)
br label %120
143: ; preds = %135, %118, %109, %98, %89, %81, %59, %51
%144 = load i32, i32* %13
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %149
146: ; preds = %143
%147 = load i32, i32* @stderr
%148 = call i32 @ERR_print_errors_fp(i32 %147)
br label %149
149: ; preds = %146, %143
%150 = load i32*, i32** %12
%151 = call i32 @BIO_free(i32* %150)
%152 = load i32, i32* %13
%153 = call i32 @exit(i32 %152)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"*:4433\00"
@SSL_CONF_FLAG_SERVER = global i32 0
@SSL_CONF_FLAG_CERTIFICATE = global i32 0
@stderr = global i32 0
@.str.1 = [25 x i8] c"Missing argument for %s\0A\00"
@.str.2 = [21 x i8] c"Error in command %s\0A\00"
@.str.3 = [6 x i8] c"-port\00"
@.str.4 = [24 x i8] c"Missing -port argument\0A\00"
@.str.5 = [21 x i8] c"Unknown argument %s\0A\00"
@.str.6 = [14 x i8] c"Finish error\0A\00"
@stdout = global i32 0
@str = [5 x i8] c"Done\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [512 x i8]
%4 = alloca i8**
%5 = alloca i32
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = bitcast i8*** %4 to i8*
%8 = getelementptr inbounds i8*, i8** %1, i64 1
store i8** %8, i8*** %4
%9 = bitcast i32* %5 to i8*
%10 = add nsw i32 %0, -1
store i32 %10, i32* %5
%11 = tail call i32 (...) @TLS_server_method()
%12 = tail call i32* @SSL_CTX_new(i32 %11)
%13 = tail call i32* (...) @SSL_CONF_CTX_new()
%14 = load i32, i32* @SSL_CONF_FLAG_SERVER
%15 = tail call i32 @SSL_CONF_CTX_set_flags(i32* %13, i32 %14)
%16 = load i32, i32* @SSL_CONF_FLAG_CERTIFICATE
%17 = tail call i32 @SSL_CONF_CTX_set_flags(i32* %13, i32 %16)
%18 = tail call i32 @SSL_CONF_CTX_set_ssl_ctx(i32* %13, i32* %12)
%19 = load i8*, i8** %8
%20 = icmp eq i8* %19, null
br i1 %20, label %72, label %21
21: ; preds = %2, %67
%22 = phi i8* [ %70, %67 ], [ %19, %2 ]
%23 = phi i8* [ %69, %67 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %2 ]
%24 = load i8, i8* %22
%25 = icmp eq i8 %24, 45
br i1 %25, label %26, label %72
26: ; preds = %21
%27 = call i32 @SSL_CONF_cmd_argv(i32* %13, i32* %5, i8*** %4)
%28 = icmp eq i32 %27, -3
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %4
%32 = load i8*, i8** %31
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %32)
br label %108
34: ; preds = %26
%35 = icmp slt i32 %27, 0
br i1 %35, label %36, label %43
36: ; preds = %34
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %4
%39 = load i8*, i8** %38
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %39)
%41 = load i32, i32* @stderr
%42 = call i32 @ERR_print_errors_fp(i32 %41)
br label %108
43: ; preds = %34
%44 = icmp eq i32 %27, 0
%45 = load i8**, i8*** %4
br i1 %44, label %46, label %67
46: ; preds = %43
%47 = load i8*, i8** %45
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %62
50: ; preds = %46
%51 = load i8**, i8*** %4
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = icmp eq i8* %53, null
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %108
58: ; preds = %50
%59 = getelementptr inbounds i8*, i8** %51, i64 2
store i8** %59, i8*** %4
%60 = load i32, i32* %5
%61 = add nsw i32 %60, -2
store i32 %61, i32* %5
br label %67
62: ; preds = %46
%63 = load i32, i32* @stderr
%64 = load i8**, i8*** %4
%65 = load i8*, i8** %64
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %65)
br label %108
67: ; preds = %43, %58
%68 = phi i8** [ %59, %58 ], [ %45, %43 ]
%69 = phi i8* [ %53, %58 ], [ %23, %43 ]
%70 = load i8*, i8** %68
%71 = icmp eq i8* %70, null
br i1 %71, label %72, label %21
72: ; preds = %21, %67, %2
%73 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %2 ], [ %69, %67 ], [ %23, %21 ]
%74 = call i32 @SSL_CONF_CTX_finish(i32* %13)
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%79 = load i32, i32* @stderr
%80 = call i32 @ERR_print_errors_fp(i32 %79)
br label %108
81: ; preds = %72
%82 = call i32* @BIO_new_ssl(i32* %12, i32 0)
%83 = call i32* @BIO_new_accept(i8* %73)
%84 = icmp eq i32* %83, null
br i1 %84, label %108, label %85
85: ; preds = %81
%86 = call i32 @BIO_set_accept_bios(i32* %83, i32* %82)
%87 = call i64 @BIO_do_accept(i32* %83)
%88 = icmp slt i64 %87, 1
br i1 %88, label %108, label %89
89: ; preds = %85, %92
%90 = call i32 @BIO_read(i32* %83, i8* %6, i32 512)
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %98
92: ; preds = %101, %89
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%94 = call i32* @BIO_pop(i32* %83)
%95 = call i32 @BIO_free_all(i32* %94)
%96 = call i64 @BIO_do_accept(i32* %83)
%97 = icmp slt i64 %96, 1
br i1 %97, label %108, label %89
98: ; preds = %89, %101
%99 = phi i32 [ %106, %101 ], [ %90, %89 ]
%100 = icmp slt i32 %99, 0
br i1 %100, label %108, label %101
101: ; preds = %98
%102 = load i32, i32* @stdout
%103 = call i32 @fwrite(i8* %6, i32 1, i32 %99, i32 %102)
%104 = load i32, i32* @stdout
%105 = call i32 @fflush(i32 %104)
%106 = call i32 @BIO_read(i32* %83, i8* %6, i32 512)
%107 = icmp eq i32 %106, 0
br i1 %107, label %92, label %98
108: ; preds = %92, %98, %85, %62, %55, %36, %29, %76, %81
%109 = phi i32* [ null, %81 ], [ null, %76 ], [ null, %29 ], [ null, %36 ], [ null, %55 ], [ null, %62 ], [ %83, %85 ], [ %83, %98 ], [ %83, %92 ]
%110 = load i32, i32* @stderr
%111 = call i32 @ERR_print_errors_fp(i32 %110)
%112 = call i32 @BIO_free(i32* %109)
%113 = call i32 @exit(i32 1)
unreachable
}