#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 EXIT_FAILURE;
int EXIT_SUCCESS;
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*/ 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 = EXIT_FAILURE, 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 = EXIT_SUCCESS;
err:
  if (ret != EXIT_SUCCESS)
    ERR_print_errors_fp(stderr);
  BIO_free(in);
  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    0xd90(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x248(%rbp)
mov    0x2d42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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    0x2d0f(%rip),%rax
mov    (%rax),%esi
call   1080 <SSL_CONF_CTX_set_flags@plt>
mov    -0x38(%rbp),%rdi
mov    0x2ced(%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     1329 <main+0xd9>
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    133c <main+0xec>
jmp    1481 <main+0x231>
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    138c <main+0x13c>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xc87(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15b5 <main+0x365>
cmpl   $0x0,-0x260(%rbp)
jge    13cd <main+0x17d>
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xc6d(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2c17(%rip),%rax
mov    (%rax),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    15b5 <main+0x365>
cmpl   $0x0,-0x260(%rbp)
jle    13df <main+0x18f>
jmp    12f7 <main+0xa7>
mov    -0x258(%rbp),%rax
mov    (%rax),%rdi
lea    0xc45(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    145b <main+0x20b>
mov    -0x258(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1435 <main+0x1e5>
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
lea    0xc12(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15b5 <main+0x365>
mov    -0x258(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x258(%rbp)
mov    -0x25c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x25c(%rbp)
jmp    12f7 <main+0xa7>
mov    0x2b76(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xbde(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15b5 <main+0x365>
mov    -0x38(%rbp),%rdi
call   1040 <SSL_CONF_CTX_finish@plt>
cmp    $0x0,%eax
jne    14bd <main+0x26d>
mov    0x2b3e(%rip),%rax
mov    (%rax),%edi
lea    0xbc5(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2b27(%rip),%rax
mov    (%rax),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    15b5 <main+0x365>
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    14eb <main+0x29b>
jmp    15b5 <main+0x365>
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     1516 <main+0x2c6>
jmp    15b5 <main+0x365>
jmp    151b <main+0x2cb>
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    1570 <main+0x320>
lea    0xb29(%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    14fb <main+0x2ab>
cmpl   $0x0,-0x250(%rbp)
jge    1582 <main+0x332>
jmp    15b5 <main+0x365>
lea    -0x240(%rbp),%rdi
mov    -0x250(%rbp),%edx
mov    0x2a2a(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1160 <fwrite@plt>
mov    0x2a17(%rip),%rax
mov    (%rax),%edi
call   1100 <fflush@plt>
jmp    151b <main+0x2cb>
mov    -0x24c(%rbp),%eax
mov    0x29f6(%rip),%rcx
cmp    (%rcx),%eax
je     15d8 <main+0x388>
mov    0x2a07(%rip),%rax
mov    (%rax),%edi
call   1170 <ERR_print_errors_fp@plt>
mov    -0x248(%rbp),%rdi
call   1110 <BIO_free@plt>
mov    -0x24c(%rbp),%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %rsi,%rbx
mov    0x2d5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0x8(%rsi),%rax
mov    %rax,0x10(%rsp)
add    $0xffffffff,%edi
mov    %edi,0x1c(%rsp)
xor    %eax,%eax
call   1030 <TLS_server_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1120 <SSL_CONF_CTX_new@plt>
mov    %rax,%rbp
mov    0x2d3d(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1130 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    0x8(%rbx),%rax
lea    0xd2c(%rip),%rbx
test   %rax,%rax
je     1359 <main+0x109>
lea    0x1c(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xd47(%rip),%r14
jmp    12f8 <main+0xa8>
mov    (%rax),%rax
test   %rax,%rax
je     1359 <main+0x109>
cmpb   $0x2d,(%rax)
jne    1359 <main+0x109>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10e0 <SSL_CONF_cmd_argv@plt>
cmp    $0xfffffffd,%eax
je     1447 <main+0x1f7>
test   %eax,%eax
js     1461 <main+0x211>
mov    0x10(%rsp),%rax
jne    12f0 <main+0xa0>
mov    (%rax),%rdi
mov    %r14,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    148c <main+0x23c>
mov    0x10(%rsp),%rax
mov    0x8(%rax),%rbx
test   %rbx,%rbx
je     14e7 <main+0x297>
add    $0x10,%rax
mov    %rax,0x10(%rsp)
addl   $0xfffffffe,0x1c(%rsp)
jmp    12f0 <main+0xa0>
mov    %rbp,%rdi
call   1040 <SSL_CONF_CTX_finish@plt>
test   %eax,%eax
je     1426 <main+0x1d6>
mov    %r15,%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
je     1442 <main+0x1f2>
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    14ae <main+0x25e>
lea    0x20(%rsp),%rbp
lea    0xcc4(%rip),%r15
mov    0x2c07(%rip),%rbx
jmp    13f0 <main+0x1a0>
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    14ae <main+0x25e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x200,%edx
call   1080 <BIO_read@plt>
test   %eax,%eax
je     13bb <main+0x16b>
test   %eax,%eax
js     14ae <main+0x25e>
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1160 <fwrite@plt>
mov    (%rbx),%edi
call   1100 <fflush@plt>
jmp    13f0 <main+0x1a0>
mov    0x2bab(%rip),%rbx
mov    (%rbx),%edi
lea    0xc32(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1483 <main+0x233>
xor    %r14d,%r14d
jmp    14ae <main+0x25e>
mov    0x2b8a(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
lea    0xba8(%rip),%rsi
jmp    14a4 <main+0x254>
mov    0x2b70(%rip),%rbx
mov    (%rbx),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
lea    0xba7(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%rbx),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    14ae <main+0x25e>
mov    0x2b45(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
lea    0xbaf(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0xc(%rsp),%ebx
mov    0x2aff(%rip),%rax
cmp    (%rax),%ebx
je     14cb <main+0x27b>
mov    0x2b14(%rip),%rax
mov    (%rax),%edi
call   1170 <ERR_print_errors_fp@plt>
mov    %r14,%rdi
call   1110 <BIO_free@plt>
mov    %ebx,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aea(%rip),%rax
mov    (%rax),%edi
lea    0xb44(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    14ae <main+0x25e>

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

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