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

/* Variables and functions */
int /*<<< orphan*/ BIO_NOCLOSE;
scalar_t__ BIO_do_connect(int /*<<< orphan*/ *);
scalar_t__ BIO_do_handshake(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_free_all(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_get_ssl(int /*<<< orphan*/ *, int /*<<< orphan*/ **);
int /*<<< orphan*/ *BIO_new_fp(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *BIO_new_ssl_connect(int /*<<< orphan*/ *);
int /*<<< orphan*/ BIO_puts(int /*<<< orphan*/ *, char *);
int BIO_read(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ BIO_set_conn_hostname(int /*<<< orphan*/ *, char const *);
int /*<<< orphan*/ BIO_write(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ ERR_print_errors_fp(int /*<<< orphan*/);
int /*<<< orphan*/ SSL_CONF_CTX_finish(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_CONF_CTX_free(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_CLIENT;
int SSL_CONF_cmd_argv(int /*<<< orphan*/ *, int *, char ***);
int /*<<< orphan*/ *SSL_CTX_new(int /*<<< orphan*/);
int /*<<< orphan*/ SSL_MODE_AUTO_RETRY;
int /*<<< orphan*/ SSL_set_mode(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ TLS_client_method();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  BIO *sbio = NULL, *out = NULL;
  int len;
  char tmpbuf[1024];
  SSL_CTX *ctx;
  SSL_CONF_CTX *cctx;
  SSL *ssl;
  char **args = argv + 1;
  const char *connect_str = "localhost:4433";
  int nargs = argc - 1;
  ctx = SSL_CTX_new(TLS_client_method());
  cctx = SSL_CONF_CTX_new();
  SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CLIENT);
  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 end;
    }
    if (rv < 0) {
      fprintf(stderr, "Error in command %s\n", *args);
      ERR_print_errors_fp(stderr);
      goto end;
    }
    if (rv > 0)
      continue;
    if (strcmp(*args, "-connect") == 0) {
      connect_str = args[1];
      if (connect_str == NULL) {
        fprintf(stderr, "Missing -connect argument\n");
        goto end;
      }
      args += 2;
      nargs -= 2;
      continue;
    } else {
      fprintf(stderr, "Unknown argument %s\n", *args);
      goto end;
    }
  }
  if (!SSL_CONF_CTX_finish(cctx)) {
    fprintf(stderr, "Finish error\n");
    ERR_print_errors_fp(stderr);
    goto end;
  }
  sbio = BIO_new_ssl_connect(ctx);
  BIO_get_ssl(sbio, &ssl);
  if (!ssl) {
    fprintf(stderr, "Can't locate SSL pointer\n");
    goto end;
  }
  SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
  BIO_set_conn_hostname(sbio, connect_str);
  out = BIO_new_fp(stdout, BIO_NOCLOSE);
  if (BIO_do_connect(sbio) <= 0) {
    fprintf(stderr, "Error connecting to server\n");
    ERR_print_errors_fp(stderr);
    goto end;
  }
  if (BIO_do_handshake(sbio) <= 0) {
    fprintf(stderr, "Error establishing SSL connection\n");
    ERR_print_errors_fp(stderr);
    goto end;
  }
  BIO_puts(sbio, "GET / HTTP/1.0\n\n");
  for (;;) {
    len = BIO_read(sbio, tmpbuf, 1024);
    if (len <= 0)
      break;
    BIO_write(out, tmpbuf, len);
  }
end:
  SSL_CONF_CTX_free(cctx);
  BIO_free_all(sbio);
  BIO_free(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x450(%rbp)
lea    0xd51(%rip),%rax
mov    %rax,-0x458(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x45c(%rbp)
mov    $0x0,%al
call   1040 <TLS_client_method@plt>
mov    %eax,%edi
call   1100 <SSL_CTX_new@plt>
mov    %rax,-0x438(%rbp)
mov    $0x0,%al
call   1120 <SSL_CONF_CTX_new@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    -0x440(%rbp),%rdi
mov    -0x438(%rbp),%rsi
call   1140 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    -0x450(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x461(%rbp)
je     133f <main+0xcf>
mov    -0x450(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x461(%rbp)
mov    -0x461(%rbp),%al
test   $0x1,%al
jne    1352 <main+0xe2>
jmp    14a0 <main+0x230>
mov    -0x440(%rbp),%rdi
lea    -0x45c(%rbp),%rsi
lea    -0x450(%rbp),%rdx
call   10f0 <SSL_CONF_cmd_argv@plt>
mov    %eax,-0x460(%rbp)
cmpl   $0xfffffffd,-0x460(%rbp)
jne    13a5 <main+0x135>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xc76(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1637 <main+0x3c7>
cmpl   $0x0,-0x460(%rbp)
jge    13e6 <main+0x176>
mov    0x2c0f(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xc5c(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    1637 <main+0x3c7>
cmpl   $0x0,-0x460(%rbp)
jle    13f8 <main+0x188>
jmp    130d <main+0x9d>
mov    -0x450(%rbp),%rax
mov    (%rax),%rdi
lea    0xc34(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    147a <main+0x20a>
mov    -0x450(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x458(%rbp)
cmpq   $0x0,-0x458(%rbp)
jne    1454 <main+0x1e4>
mov    0x2b89(%rip),%rax
mov    (%rax),%edi
lea    0xbfe(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1637 <main+0x3c7>
mov    -0x450(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x450(%rbp)
mov    -0x45c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x45c(%rbp)
jmp    130d <main+0x9d>
mov    0x2b47(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xbcd(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1637 <main+0x3c7>
mov    -0x440(%rbp),%rdi
call   1060 <SSL_CONF_CTX_finish@plt>
cmp    $0x0,%eax
jne    14df <main+0x26f>
mov    0x2b0c(%rip),%rax
mov    (%rax),%edi
lea    0xbb1(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2af5(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    1637 <main+0x3c7>
mov    -0x438(%rbp),%rdi
call   1190 <BIO_new_ssl_connect@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x448(%rbp),%rsi
call   1080 <BIO_get_ssl@plt>
cmpq   $0x0,-0x448(%rbp)
jne    1529 <main+0x2b9>
mov    0x2ab4(%rip),%rax
mov    (%rax),%edi
lea    0xb67(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1637 <main+0x3c7>
mov    -0x448(%rbp),%rdi
mov    0x2aa9(%rip),%rax
mov    (%rax),%esi
call   10a0 <SSL_set_mode@plt>
mov    -0x18(%rbp),%rdi
mov    -0x458(%rbp),%rsi
call   10e0 <BIO_set_conn_hostname@plt>
mov    0x2a6b(%rip),%rax
mov    (%rax),%edi
mov    0x2a8a(%rip),%rax
mov    (%rax),%esi
call   1050 <BIO_new_fp@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <BIO_do_connect@plt>
cmp    $0x0,%rax
jg     15a6 <main+0x336>
mov    0x2a45(%rip),%rax
mov    (%rax),%edi
lea    0xb12(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2a2e(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    1637 <main+0x3c7>
mov    -0x18(%rbp),%rdi
call   10b0 <BIO_do_handshake@plt>
cmp    $0x0,%rax
jg     15e3 <main+0x373>
mov    0x2a08(%rip),%rax
mov    (%rax),%edi
lea    0xaf1(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x29f1(%rip),%rax
mov    (%rax),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    1637 <main+0x3c7>
mov    -0x18(%rbp),%rdi
lea    0xaef(%rip),%rsi
call   1160 <BIO_puts@plt>
mov    -0x18(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1070 <BIO_read@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     161a <main+0x3aa>
jmp    1632 <main+0x3c2>
mov    -0x20(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1170 <BIO_write@plt>
jmp    15f3 <main+0x383>
jmp    1637 <main+0x3c7>
mov    -0x440(%rbp),%rdi
call   1130 <SSL_CONF_CTX_free@plt>
mov    -0x18(%rbp),%rdi
call   1150 <BIO_free_all@plt>
mov    -0x20(%rbp),%rdi
call   1110 <BIO_free@plt>
xor    %eax,%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,%rbx
lea    0x8(%rsi),%rax
mov    %rax,0x8(%rsp)
add    $0xffffffff,%edi
mov    %edi,0x14(%rsp)
xor    %eax,%eax
call   1040 <TLS_client_method@plt>
mov    %eax,%edi
call   1100 <SSL_CTX_new@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1120 <SSL_CONF_CTX_new@plt>
mov    %rax,%r15
mov    0x2d22(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1140 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    0x8(%rbx),%rax
lea    0xd2a(%rip),%rbx
test   %rax,%rax
je     1359 <main+0xe9>
lea    0x14(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0xd51(%rip),%rbp
jmp    12f8 <main+0x88>
xchg   %ax,%ax
mov    (%rax),%rax
test   %rax,%rax
je     1359 <main+0xe9>
cmpb   $0x2d,(%rax)
jne    1359 <main+0xe9>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10f0 <SSL_CONF_cmd_argv@plt>
cmp    $0xfffffffd,%eax
je     1481 <main+0x211>
test   %eax,%eax
js     149b <main+0x22b>
mov    0x8(%rsp),%rax
jne    12f0 <main+0x80>
mov    (%rax),%rdi
mov    %rbp,%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    14f8 <main+0x288>
mov    0x8(%rsp),%rax
mov    0x8(%rax),%rbx
test   %rbx,%rbx
je     1549 <main+0x2d9>
add    $0x10,%rax
mov    %rax,0x8(%rsp)
addl   $0xfffffffe,0x14(%rsp)
jmp    12f0 <main+0x80>
mov    %r15,%rdi
call   1060 <SSL_CONF_CTX_finish@plt>
test   %eax,%eax
je     1446 <main+0x1d6>
mov    %r14,%rdi
call   1190 <BIO_new_ssl_connect@plt>
mov    %rax,%r12
lea    0x18(%rsp),%rsi
mov    %rax,%rdi
call   1080 <BIO_get_ssl@plt>
mov    0x18(%rsp),%rdi
test   %rdi,%rdi
je     1462 <main+0x1f2>
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
call   10a0 <SSL_set_mode@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10e0 <BIO_set_conn_hostname@plt>
mov    0x2c11(%rip),%rax
mov    (%rax),%edi
mov    0x2c30(%rip),%rax
mov    (%rax),%esi
call   1050 <BIO_new_fp@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1030 <BIO_do_connect@plt>
test   %rax,%rax
jle    14c6 <main+0x256>
mov    %r12,%rdi
call   10b0 <BIO_do_handshake@plt>
test   %rax,%rax
jle    14d8 <main+0x268>
lea    0xcf2(%rip),%rsi
mov    %r12,%rdi
call   1160 <BIO_puts@plt>
lea    0x20(%rsp),%rsi
mov    %r12,%rdi
mov    $0x400,%edx
call   1070 <BIO_read@plt>
test   %eax,%eax
jle    151d <main+0x2ad>
lea    0x20(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1170 <BIO_write@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1070 <BIO_read@plt>
test   %eax,%eax
jg     1420 <main+0x1b0>
jmp    151d <main+0x2ad>
mov    0x2b7b(%rip),%rbx
mov    (%rbx),%edi
lea    0xc20(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    14bd <main+0x24d>
mov    0x2b5f(%rip),%rax
mov    (%rax),%edi
lea    0xc12(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    151d <main+0x2ad>
mov    0x2b40(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xb76(%rip),%rsi
jmp    1510 <main+0x2a0>
mov    0x2b26(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xb75(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%rbx),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    151a <main+0x2aa>
mov    0x2afb(%rip),%rbx
mov    (%rbx),%edi
lea    0xbc8(%rip),%rsi
jmp    14e8 <main+0x278>
mov    0x2ae9(%rip),%rbx
mov    (%rbx),%edi
lea    0xbd2(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%rbx),%edi
call   1180 <ERR_print_errors_fp@plt>
jmp    151d <main+0x2ad>
mov    0x2ac9(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xb51(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
xor    %r12d,%r12d
mov    %r15,%rdi
call   1130 <SSL_CONF_CTX_free@plt>
mov    %r12,%rdi
call   1150 <BIO_free_all@plt>
mov    %r14,%rdi
call   1110 <BIO_free@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a78(%rip),%rax
mov    (%rax),%edi
lea    0xaed(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    151a <main+0x2aa>

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

LLVM IR (-O2):
@.str = [15 x i8] c"localhost:4433\00"
@SSL_CONF_FLAG_CLIENT = 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 = [9 x i8] c"-connect\00"
@.str.4 = [27 x i8] c"Missing -connect 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 = [26 x i8] c"Can't locate SSL pointer\0A\00"
@SSL_MODE_AUTO_RETRY = global i32 0
@stdout = global i32 0
@BIO_NOCLOSE = global i32 0
@.str.8 = [28 x i8] c"Error connecting to server\0A\00"
@.str.9 = [35 x i8] c"Error establishing SSL connection\0A\00"
@.str.10 = [17 x i8] c"GET / HTTP/1.0\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [1024 x i8]
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i32
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = bitcast i32** %4 to i8*
%9 = bitcast i8*** %5 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
store i8** %10, i8*** %5
%11 = bitcast i32* %6 to i8*
%12 = add nsw i32 %0, -1
store i32 %12, i32* %6
%13 = tail call i32 (...) @TLS_client_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_CLIENT
%17 = tail call i32 @SSL_CONF_CTX_set_flags(i32* %15, i32 %16)
%18 = tail call i32 @SSL_CONF_CTX_set_ssl_ctx(i32* %15, i32* %14)
%19 = load i8*, i8** %10
%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 ([15 x i8], [15 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* %15, i32* %6, i8*** %5)
%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*** %5
%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 %120
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*** %5
%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 %120
43: ; preds = %34
%44 = icmp eq i32 %27, 0
%45 = load i8**, i8*** %5
br i1 %44, label %46, label %67
46: ; preds = %43
%47 = load i8*, i8** %45
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([9 x i8], [9 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*** %5
%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 ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %120
58: ; preds = %50
%59 = getelementptr inbounds i8*, i8** %51, i64 2
store i8** %59, i8*** %5
%60 = load i32, i32* %6
%61 = add nsw i32 %60, -2
store i32 %61, i32* %6
br label %67
62: ; preds = %46
%63 = load i32, i32* @stderr
%64 = load i8**, i8*** %5
%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 %120
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 ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %2 ], [ %69, %67 ], [ %23, %21 ]
%74 = call i32 @SSL_CONF_CTX_finish(i32* %15)
%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 %120
81: ; preds = %72
%82 = call i32* @BIO_new_ssl_connect(i32* %14)
%83 = call i32 @BIO_get_ssl(i32* %82, i32** %4)
%84 = load i32*, i32** %4
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %89
86: ; preds = %81
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
br label %120
89: ; preds = %81
%90 = load i32, i32* @SSL_MODE_AUTO_RETRY
%91 = call i32 @SSL_set_mode(i32* %84, i32 %90)
%92 = call i32 @BIO_set_conn_hostname(i32* %82, i8* %73)
%93 = load i32, i32* @stdout
%94 = load i32, i32* @BIO_NOCLOSE
%95 = call i32* @BIO_new_fp(i32 %93, i32 %94)
%96 = call i64 @BIO_do_connect(i32* %82)
%97 = icmp slt i64 %96, 1
br i1 %97, label %98, label %103
98: ; preds = %89
%99 = load i32, i32* @stderr
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%101 = load i32, i32* @stderr
%102 = call i32 @ERR_print_errors_fp(i32 %101)
br label %120
103: ; preds = %89
%104 = call i64 @BIO_do_handshake(i32* %82)
%105 = icmp slt i64 %104, 1
br i1 %105, label %106, label %111
106: ; preds = %103
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%109 = load i32, i32* @stderr
%110 = call i32 @ERR_print_errors_fp(i32 %109)
br label %120
111: ; preds = %103
%112 = call i32 @BIO_puts(i32* %82, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%113 = call i32 @BIO_read(i32* %82, i8* %7, i32 1024)
%114 = icmp slt i32 %113, 1
br i1 %114, label %120, label %115
115: ; preds = %111, %115
%116 = phi i32 [ %118, %115 ], [ %113, %111 ]
%117 = call i32 @BIO_write(i32* %95, i8* %7, i32 %116)
%118 = call i32 @BIO_read(i32* %82, i8* %7, i32 1024)
%119 = icmp slt i32 %118, 1
br i1 %119, label %120, label %115
120: ; preds = %115, %111, %62, %55, %36, %29, %76, %86, %98, %106
%121 = phi i32* [ %95, %98 ], [ %95, %106 ], [ null, %86 ], [ null, %76 ], [ null, %29 ], [ null, %36 ], [ null, %55 ], [ null, %62 ], [ %95, %111 ], [ %95, %115 ]
%122 = phi i32* [ %82, %98 ], [ %82, %106 ], [ %82, %86 ], [ null, %76 ], [ null, %29 ], [ null, %36 ], [ null, %55 ], [ null, %62 ], [ %82, %111 ], [ %82, %115 ]
%123 = call i32 @SSL_CONF_CTX_free(i32* %15)
%124 = call i32 @BIO_free_all(i32* %122)
%125 = call i32 @BIO_free(i32* %121)
ret i32 0
}