#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*/ OpenSSL_add_ssl_algorithms();
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*/ SSL_load_error_strings();
int /*<<< orphan*/ SSLv23_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;
int /*<<< orphan*/ 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;
  SSL_load_error_strings();
  OpenSSL_add_ssl_algorithms();
  ctx = SSL_CTX_new(SSLv23_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")) {
      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);
  }
  if (in != NULL)
    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    0xd60(%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   1150 <SSL_load_error_strings@plt>
mov    $0x0,%al
call   1170 <OpenSSL_add_ssl_algorithms@plt>
mov    $0x0,%al
call   1040 <SSLv23_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    0x2cd6(%rip),%rax
mov    (%rax),%esi
call   1080 <SSL_CONF_CTX_set_flags@plt>
mov    -0x38(%rbp),%rdi
mov    0x2cb4(%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     1362 <main+0xe2>
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    1375 <main+0xf5>
jmp    14b9 <main+0x239>
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    13c5 <main+0x145>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xc4e(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15ed <main+0x36d>
cmpl   $0x0,-0x260(%rbp)
jge    1406 <main+0x186>
mov    0x2bff(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xc34(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2bde(%rip),%rax
mov    (%rax),%edi
call   11a0 <ERR_print_errors_fp@plt>
jmp    15ed <main+0x36d>
cmpl   $0x0,-0x260(%rbp)
jle    1418 <main+0x198>
jmp    1330 <main+0xb0>
mov    -0x258(%rbp),%rax
mov    (%rax),%rdi
lea    0xc0c(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    1493 <main+0x213>
mov    -0x258(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    146d <main+0x1ed>
mov    0x2b80(%rip),%rax
mov    (%rax),%edi
lea    0xbda(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15ed <main+0x36d>
mov    -0x258(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x258(%rbp)
mov    -0x25c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x25c(%rbp)
jmp    1330 <main+0xb0>
mov    0x2b3e(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%rax
mov    (%rax),%rdx
lea    0xba6(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    15ed <main+0x36d>
mov    -0x38(%rbp),%rdi
call   1030 <SSL_CONF_CTX_finish@plt>
cmp    $0x0,%eax
jne    14f5 <main+0x275>
mov    0x2b06(%rip),%rax
mov    (%rax),%edi
lea    0xb8d(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2aef(%rip),%rax
mov    (%rax),%edi
call   11a0 <ERR_print_errors_fp@plt>
jmp    15ed <main+0x36d>
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    1523 <main+0x2a3>
jmp    15ed <main+0x36d>
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     154e <main+0x2ce>
jmp    15ed <main+0x36d>
jmp    1553 <main+0x2d3>
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    15a8 <main+0x328>
lea    0xaf1(%rip),%rdi
call   1090 <printf@plt>
mov    -0x248(%rbp),%rdi
call   10c0 <BIO_pop@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1160 <BIO_free_all@plt>
jmp    1533 <main+0x2b3>
cmpl   $0x0,-0x250(%rbp)
jge    15ba <main+0x33a>
jmp    15ed <main+0x36d>
lea    -0x240(%rbp),%rdi
mov    -0x250(%rbp),%edx
mov    0x29fa(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1190 <fwrite@plt>
mov    0x29e7(%rip),%rax
mov    (%rax),%edi
call   1100 <fflush@plt>
jmp    1553 <main+0x2d3>
cmpl   $0x0,-0x24c(%rbp)
je     1608 <main+0x388>
mov    0x29d7(%rip),%rax
mov    (%rax),%edi
call   11a0 <ERR_print_errors_fp@plt>
cmpq   $0x0,-0x248(%rbp)
je     1622 <main+0x3a2>
mov    -0x248(%rbp),%rdi
call   1110 <BIO_free@plt>
mov    -0x24c(%rbp),%edi
call   1180 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %rsi,%rbx
lea    0x8(%rsi),%rax
mov    %rax,0x8(%rsp)
add    $0xffffffff,%edi
mov    %edi,0x14(%rsp)
xor    %eax,%eax
call   1150 <SSL_load_error_strings@plt>
xor    %eax,%eax
call   1170 <OpenSSL_add_ssl_algorithms@plt>
xor    %eax,%eax
call   1050 <SSLv23_server_method@plt>
mov    %eax,%edi
call   10f0 <SSL_CTX_new@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1120 <SSL_CONF_CTX_new@plt>
mov    %rax,%r15
mov    0x2d0c(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    %r15,%rdi
mov    %rbp,0x18(%rsp)
mov    %rbp,%rsi
call   1130 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    0x8(%rbx),%rax
lea    0xcf6(%rip),%rbx
test   %rax,%rax
jne    133b <main+0xbb>
mov    %r15,%rdi
call   1030 <SSL_CONF_CTX_finish@plt>
test   %eax,%eax
jne    13b6 <main+0x136>
mov    0x2cb2(%rip),%rbx
mov    (%rbx),%edi
lea    0xd39(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    144d <main+0x1cd>
lea    0x14(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0xce9(%rip),%rbp
jmp    1358 <main+0xd8>
xchg   %ax,%ax
mov    (%r14),%rax
test   %rax,%rax
je     130f <main+0x8f>
cmpb   $0x2d,(%rax)
jne    130f <main+0x8f>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10e0 <SSL_CONF_cmd_argv@plt>
cmp    $0xfffffffd,%eax
je     1411 <main+0x191>
test   %eax,%eax
js     142e <main+0x1ae>
mov    0x8(%rsp),%r14
jne    1350 <main+0xd0>
mov    (%r14),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10b0 <strcmp@plt>
test   %eax,%eax
jne    14d8 <main+0x258>
mov    0x8(%r14),%rbx
test   %rbx,%rbx
je     14f4 <main+0x274>
add    $0x10,%r14
mov    %r14,0x8(%rsp)
addl   $0xfffffffe,0x14(%rsp)
jmp    1350 <main+0xd0>
mov    0x18(%rsp),%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     150b <main+0x28b>
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
jg     1459 <main+0x1d9>
mov    0x2be0(%rip),%rax
mov    (%rax),%edi
call   11a0 <ERR_print_errors_fp@plt>
mov    %r14,%rdi
call   1110 <BIO_free@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xbde(%rip),%rsi
jmp    14eb <main+0x26b>
mov    0x2ba3(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xbda(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%rbx),%edi
call   11a0 <ERR_print_errors_fp@plt>
jmp    150b <main+0x28b>
lea    0x20(%rsp),%rbx
lea    0xc11(%rip),%r15
mov    0x2b5c(%rip),%rbp
jmp    14a0 <main+0x220>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   10c0 <BIO_pop@plt>
mov    %rax,%rdi
call   1160 <BIO_free_all@plt>
mov    %r14,%rdi
call   1140 <BIO_do_accept@plt>
test   %rax,%rax
jle    13f1 <main+0x171>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x200,%edx
call   1080 <BIO_read@plt>
test   %eax,%eax
je     146e <main+0x1ee>
test   %eax,%eax
js     13f1 <main+0x171>
mov    0x0(%rbp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1190 <fwrite@plt>
mov    0x0(%rbp),%edi
call   1100 <fflush@plt>
jmp    14a0 <main+0x220>
mov    0x2af9(%rip),%rax
mov    (%rax),%edi
lea    0xb6b(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    150b <main+0x28b>
mov    0x2add(%rip),%rax
mov    (%rax),%edi
lea    0xb37(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x2ac6(%rip),%rax
mov    (%rax),%edi
call   11a0 <ERR_print_errors_fp@plt>
mov    $0x1,%edi
call   1180 <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 (...) @SSL_load_error_strings()
%23 = call i32 (...) @OpenSSL_add_ssl_algorithms()
%24 = call i32 (...) @SSLv23_server_method()
%25 = call i32* @SSL_CTX_new(i32 %24)
store i32* %25, i32** %9
%26 = call i32* (...) @SSL_CONF_CTX_new()
store i32* %26, i32** %10
%27 = load i32*, i32** %10
%28 = load i32, i32* @SSL_CONF_FLAG_SERVER
%29 = call i32 @SSL_CONF_CTX_set_flags(i32* %27, i32 %28)
%30 = load i32*, i32** %10
%31 = load i32, i32* @SSL_CONF_FLAG_CERTIFICATE
%32 = call i32 @SSL_CONF_CTX_set_flags(i32* %30, i32 %31)
%33 = load i32*, i32** %10
%34 = load i32*, i32** %9
%35 = call i32 @SSL_CONF_CTX_set_ssl_ctx(i32* %33, i32* %34)
br label %36
36: ; preds = %86, %71, %2
%37 = load i8**, i8*** %15
%38 = load i8*, i8** %37
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i8**, i8*** %15
%42 = load i8*, i8** %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 45
br label %46
46: ; preds = %40, %36
%47 = phi i1 [ false, %36 ], [ %45, %40 ]
br i1 %47, label %48, label %96
48: ; preds = %46
%49 = load i32*, i32** %10
%50 = call i32 @SSL_CONF_cmd_argv(i32* %49, i32* %16, i8*** %15)
store i32 %50, i32* %17
%51 = load i32, i32* %17
%52 = icmp eq i32 %51, -3
br i1 %52, label %53, label %58
53: ; preds = %48
%54 = load i32, i32* @stderr
%55 = load i8**, i8*** %15
%56 = load i8*, i8** %55
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %56)
br label %145
58: ; preds = %48
%59 = load i32, i32* %17
%60 = icmp slt i32 %59, 0
br i1 %60, label %61, label %68
61: ; preds = %58
%62 = load i32, i32* @stderr
%63 = load i8**, i8*** %15
%64 = load i8*, i8** %63
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %64)
%66 = load i32, i32* @stderr
%67 = call i32 @ERR_print_errors_fp(i32 %66)
br label %145
68: ; preds = %58
%69 = load i32, i32* %17
%70 = icmp sgt i32 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %68
br label %36
72: ; preds = %68
%73 = load i8**, i8*** %15
%74 = load i8*, i8** %73
%75 = call i32 @strcmp(i8* %74, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%76 = icmp ne i32 %75, 0
br i1 %76, label %91, label %77
77: ; preds = %72
%78 = load i8**, i8*** %15
%79 = getelementptr inbounds i8*, i8** %78, i64 1
%80 = load i8*, i8** %79
store i8* %80, i8** %6
%81 = load i8*, i8** %6
%82 = icmp eq i8* %81, null
br i1 %82, label %83, label %86
83: ; preds = %77
%84 = load i32, i32* @stderr
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %145
86: ; preds = %77
%87 = load i8**, i8*** %15
%88 = getelementptr inbounds i8*, i8** %87, i64 2
store i8** %88, i8*** %15
%89 = load i32, i32* %16
%90 = sub nsw i32 %89, 2
store i32 %90, i32* %16
br label %36
91: ; preds = %72
%92 = load i32, i32* @stderr
%93 = load i8**, i8*** %15
%94 = load i8*, i8** %93
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %94)
br label %145
96: ; preds = %46
%97 = load i32*, i32** %10
%98 = call i32 @SSL_CONF_CTX_finish(i32* %97)
%99 = icmp ne i32 %98, 0
br i1 %99, label %105, label %100
100: ; preds = %96
%101 = load i32, i32* @stderr
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%103 = load i32, i32* @stderr
%104 = call i32 @ERR_print_errors_fp(i32 %103)
br label %145
105: ; preds = %96
%106 = load i32*, i32** %9
%107 = call i32* @BIO_new_ssl(i32* %106, i32 0)
store i32* %107, i32** %7
%108 = load i8*, i8** %6
%109 = call i32* @BIO_new_accept(i8* %108)
store i32* %109, i32** %12
%110 = icmp eq i32* %109, null
br i1 %110, label %111, label %112
111: ; preds = %105
br label %145
112: ; preds = %105
%113 = load i32*, i32** %12
%114 = load i32*, i32** %7
%115 = call i32 @BIO_set_accept_bios(i32* %113, i32* %114)
br label %116
116: ; preds = %128, %112
%117 = load i32*, i32** %12
%118 = call i64 @BIO_do_accept(i32* %117)
%119 = icmp sle i64 %118, 0
br i1 %119, label %120, label %121
120: ; preds = %116
br label %145
121: ; preds = %116
br label %122
122: ; preds = %138, %121
%123 = load i32*, i32** %12
%124 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%125 = call i32 @BIO_read(i32* %123, i8* %124, i32 512)
store i32 %125, i32* %14
%126 = load i32, i32* %14
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %134
128: ; preds = %122
%129 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%130 = load i32*, i32** %12
%131 = call i32* @BIO_pop(i32* %130)
store i32* %131, i32** %8
%132 = load i32*, i32** %8
%133 = call i32 @BIO_free_all(i32* %132)
br label %116
134: ; preds = %122
%135 = load i32, i32* %14
%136 = icmp slt i32 %135, 0
br i1 %136, label %137, label %138
137: ; preds = %134
br label %145
138: ; preds = %134
%139 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%140 = load i32, i32* %14
%141 = load i32, i32* @stdout
%142 = call i32 @fwrite(i8* %139, i32 1, i32 %140, i32 %141)
%143 = load i32, i32* @stdout
%144 = call i32 @fflush(i32 %143)
br label %122
145: ; preds = %137, %120, %111, %100, %91, %83, %61, %53
%146 = load i32, i32* %13
%147 = icmp ne i32 %146, 0
br i1 %147, label %148, label %151
148: ; preds = %145
%149 = load i32, i32* @stderr
%150 = call i32 @ERR_print_errors_fp(i32 %149)
br label %151
151: ; preds = %148, %145
%152 = load i32*, i32** %12
%153 = icmp ne i32* %152, null
br i1 %153, label %154, label %157
154: ; preds = %151
%155 = load i32*, i32** %12
%156 = call i32 @BIO_free(i32* %155)
br label %157
157: ; preds = %154, %151
%158 = load i32, i32* %13
%159 = call i32 @exit(i32 %158)
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 (...) @SSL_load_error_strings()
%12 = tail call i32 (...) @OpenSSL_add_ssl_algorithms()
%13 = tail call i32 (...) @SSLv23_server_method()
%14 = tail call i32* @SSL_CTX_new(i32 %13)
%15 = tail call i32* (...) @SSL_CONF_CTX_new()
%16 = load i32, i32* @SSL_CONF_FLAG_SERVER
%17 = tail call i32 @SSL_CONF_CTX_set_flags(i32* %15, i32 %16)
%18 = load i32, i32* @SSL_CONF_FLAG_CERTIFICATE
%19 = tail call i32 @SSL_CONF_CTX_set_flags(i32* %15, i32 %18)
%20 = tail call i32 @SSL_CONF_CTX_set_ssl_ctx(i32* %15, i32* %14)
%21 = load i8*, i8** %8
%22 = icmp eq i8* %21, null
br i1 %22, label %71, label %23
23: ; preds = %2, %66
%24 = phi i8* [ %69, %66 ], [ %21, %2 ]
%25 = phi i8* [ %68, %66 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %2 ]
%26 = load i8, i8* %24
%27 = icmp eq i8 %26, 45
br i1 %27, label %28, label %71
28: ; preds = %23
%29 = call i32 @SSL_CONF_cmd_argv(i32* %15, i32* %5, i8*** %4)
%30 = icmp eq i32 %29, -3
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %4
%34 = load i8*, i8** %33
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %34)
br label %107
36: ; preds = %28
%37 = icmp slt i32 %29, 0
br i1 %37, label %38, label %45
38: ; preds = %36
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %4
%41 = load i8*, i8** %40
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = load i32, i32* @stderr
%44 = call i32 @ERR_print_errors_fp(i32 %43)
br label %107
45: ; preds = %36
%46 = icmp eq i32 %29, 0
%47 = load i8**, i8*** %4
br i1 %46, label %48, label %66
48: ; preds = %45
%49 = load i8*, i8** %47
%50 = call i32 @strcmp(i8* dereferenceable(1) %49, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %63
52: ; preds = %48
%53 = getelementptr inbounds i8*, i8** %47, i64 1
%54 = load i8*, i8** %53
%55 = icmp eq i8* %54, null
br i1 %55, label %56, label %59
56: ; preds = %52
%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 %107
59: ; preds = %52
%60 = getelementptr inbounds i8*, i8** %47, 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 %66
63: ; preds = %48
%64 = load i32, i32* @stderr
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %49)
br label %107
66: ; preds = %45, %59
%67 = phi i8** [ %60, %59 ], [ %47, %45 ]
%68 = phi i8* [ %54, %59 ], [ %25, %45 ]
%69 = load i8*, i8** %67
%70 = icmp eq i8* %69, null
br i1 %70, label %71, label %23
71: ; preds = %23, %66, %2
%72 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %2 ], [ %68, %66 ], [ %25, %23 ]
%73 = call i32 @SSL_CONF_CTX_finish(i32* %15)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %80
75: ; preds = %71
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%78 = load i32, i32* @stderr
%79 = call i32 @ERR_print_errors_fp(i32 %78)
br label %107
80: ; preds = %71
%81 = call i32* @BIO_new_ssl(i32* %14, i32 0)
%82 = call i32* @BIO_new_accept(i8* %72)
%83 = icmp eq i32* %82, null
br i1 %83, label %107, label %84
84: ; preds = %80
%85 = call i32 @BIO_set_accept_bios(i32* %82, i32* %81)
%86 = call i64 @BIO_do_accept(i32* %82)
%87 = icmp slt i64 %86, 1
br i1 %87, label %110, label %88
88: ; preds = %84, %91
%89 = call i32 @BIO_read(i32* %82, i8* %6, i32 512)
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %97
91: ; preds = %100, %88
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%93 = call i32* @BIO_pop(i32* %82)
%94 = call i32 @BIO_free_all(i32* %93)
%95 = call i64 @BIO_do_accept(i32* %82)
%96 = icmp slt i64 %95, 1
br i1 %96, label %110, label %88
97: ; preds = %88, %100
%98 = phi i32 [ %105, %100 ], [ %89, %88 ]
%99 = icmp slt i32 %98, 0
br i1 %99, label %110, label %100
100: ; preds = %97
%101 = load i32, i32* @stdout
%102 = call i32 @fwrite(i8* %6, i32 1, i32 %98, i32 %101)
%103 = load i32, i32* @stdout
%104 = call i32 @fflush(i32 %103)
%105 = call i32 @BIO_read(i32* %82, i8* %6, i32 512)
%106 = icmp eq i32 %105, 0
br i1 %106, label %91, label %97
107: ; preds = %80, %75, %31, %38, %63, %56
%108 = load i32, i32* @stderr
%109 = call i32 @ERR_print_errors_fp(i32 %108)
br label %114
110: ; preds = %91, %97, %84
%111 = load i32, i32* @stderr
%112 = call i32 @ERR_print_errors_fp(i32 %111)
%113 = call i32 @BIO_free(i32* %82)
br label %114
114: ; preds = %107, %110
%115 = call i32 @exit(i32 1)
unreachable
}