#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*/ *);
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;
  }
  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    0xd61(%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   10f0 <SSL_CTX_new@plt>
mov    %rax,-0x438(%rbp)
mov    $0x0,%al
call   1110 <SSL_CONF_CTX_new@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
mov    0x2cf5(%rip),%rax
mov    (%rax),%esi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    -0x440(%rbp),%rdi
mov    -0x438(%rbp),%rsi
call   1130 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    -0x450(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x461(%rbp)
je     132f <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    1342 <main+0xe2>
jmp    1490 <main+0x230>
mov    -0x440(%rbp),%rdi
lea    -0x45c(%rbp),%rsi
lea    -0x450(%rbp),%rdx
call   10e0 <SSL_CONF_cmd_argv@plt>
mov    %eax,-0x460(%rbp)
cmpl   $0xfffffffd,-0x460(%rbp)
jne    1395 <main+0x135>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xc86(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
jmp    15ea <main+0x38a>
cmpl   $0x0,-0x460(%rbp)
jge    13d6 <main+0x176>
mov    0x2c1f(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xc6c(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    0x2bfe(%rip),%rax
mov    (%rax),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    15ea <main+0x38a>
cmpl   $0x0,-0x460(%rbp)
jle    13e8 <main+0x188>
jmp    12fd <main+0x9d>
mov    -0x450(%rbp),%rax
mov    (%rax),%rdi
lea    0xc44(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    146a <main+0x20a>
mov    -0x450(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x458(%rbp)
cmpq   $0x0,-0x458(%rbp)
jne    1444 <main+0x1e4>
mov    0x2b99(%rip),%rax
mov    (%rax),%edi
lea    0xc0e(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
jmp    15ea <main+0x38a>
mov    -0x450(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x450(%rbp)
mov    -0x45c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x45c(%rbp)
jmp    12fd <main+0x9d>
mov    0x2b57(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xbdd(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
jmp    15ea <main+0x38a>
mov    -0x440(%rbp),%rdi
call   1060 <SSL_CONF_CTX_finish@plt>
cmp    $0x0,%eax
jne    14cf <main+0x26f>
mov    0x2b1c(%rip),%rax
mov    (%rax),%edi
lea    0xbc1(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    0x2b05(%rip),%rax
mov    (%rax),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    15ea <main+0x38a>
mov    -0x438(%rbp),%rdi
call   1180 <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    1519 <main+0x2b9>
mov    0x2ac4(%rip),%rax
mov    (%rax),%edi
lea    0xb77(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
jmp    15ea <main+0x38a>
mov    -0x448(%rbp),%rdi
mov    0x2ab9(%rip),%rax
mov    (%rax),%esi
call   10a0 <SSL_set_mode@plt>
mov    -0x18(%rbp),%rdi
mov    -0x458(%rbp),%rsi
call   10d0 <BIO_set_conn_hostname@plt>
mov    0x2a7b(%rip),%rax
mov    (%rax),%edi
mov    0x2a9a(%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     1596 <main+0x336>
mov    0x2a55(%rip),%rax
mov    (%rax),%edi
lea    0xb22(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    0x2a3e(%rip),%rax
mov    (%rax),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    15ea <main+0x38a>
mov    -0x18(%rbp),%rdi
lea    0xb19(%rip),%rsi
call   1150 <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     15cd <main+0x36d>
jmp    15e5 <main+0x385>
mov    -0x20(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1160 <BIO_write@plt>
jmp    15a6 <main+0x346>
jmp    15ea <main+0x38a>
mov    -0x440(%rbp),%rdi
call   1120 <SSL_CONF_CTX_free@plt>
mov    -0x18(%rbp),%rdi
call   1140 <BIO_free_all@plt>
mov    -0x20(%rbp),%rdi
call   1100 <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   10f0 <SSL_CTX_new@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1110 <SSL_CONF_CTX_new@plt>
mov    %rax,%r14
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1130 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    0x8(%rbx),%rax
lea    0xd3a(%rip),%rbx
test   %rax,%rax
je     1349 <main+0xe9>
lea    0x14(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0xd61(%rip),%rbp
jmp    12e8 <main+0x88>
xchg   %ax,%ax
mov    (%rax),%rax
test   %rax,%rax
je     1349 <main+0xe9>
cmpb   $0x2d,(%rax)
jne    1349 <main+0xe9>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10e0 <SSL_CONF_cmd_argv@plt>
cmp    $0xfffffffd,%eax
je     1461 <main+0x201>
test   %eax,%eax
js     147b <main+0x21b>
mov    0x8(%rsp),%rax
jne    12e0 <main+0x80>
mov    (%rax),%rdi
mov    %rbp,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    14c6 <main+0x266>
mov    0x8(%rsp),%rax
mov    0x8(%rax),%rbx
test   %rbx,%rbx
je     1517 <main+0x2b7>
add    $0x10,%rax
mov    %rax,0x8(%rsp)
addl   $0xfffffffe,0x14(%rsp)
jmp    12e0 <main+0x80>
mov    %r14,%rdi
call   1060 <SSL_CONF_CTX_finish@plt>
test   %eax,%eax
je     1426 <main+0x1c6>
mov    %r15,%rdi
call   1180 <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     1442 <main+0x1e2>
mov    0x2c5a(%rip),%rax
mov    (%rax),%esi
call   10a0 <SSL_set_mode@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10d0 <BIO_set_conn_hostname@plt>
mov    0x2c21(%rip),%rax
mov    (%rax),%edi
mov    0x2c40(%rip),%rax
mov    (%rax),%esi
call   1050 <BIO_new_fp@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1030 <BIO_do_connect@plt>
test   %rax,%rax
jle    14a6 <main+0x246>
lea    0xcf0(%rip),%rsi
mov    %r12,%rdi
call   1150 <BIO_puts@plt>
lea    0x20(%rsp),%rsi
mov    %r12,%rdi
mov    $0x400,%edx
call   1070 <BIO_read@plt>
test   %eax,%eax
jle    14eb <main+0x28b>
lea    0x20(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1160 <BIO_write@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1070 <BIO_read@plt>
test   %eax,%eax
jg     1400 <main+0x1a0>
jmp    14eb <main+0x28b>
mov    0x2b9b(%rip),%rbx
mov    (%rbx),%edi
lea    0xc40(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    149d <main+0x23d>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
lea    0xc32(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    14eb <main+0x28b>
mov    0x2b60(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xb96(%rip),%rsi
jmp    14de <main+0x27e>
mov    0x2b46(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xb95(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    (%rbx),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    14e8 <main+0x288>
mov    0x2b1b(%rip),%rbx
mov    (%rbx),%edi
lea    0xbe8(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    (%rbx),%edi
call   1170 <ERR_print_errors_fp@plt>
jmp    14eb <main+0x28b>
mov    0x2afb(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xb83(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10c0 <fprintf@plt>
xor    %r12d,%r12d
mov    %r14,%rdi
call   1120 <SSL_CONF_CTX_free@plt>
mov    %r12,%rdi
call   1140 <BIO_free_all@plt>
mov    %r15,%rdi
call   1100 <BIO_free@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aaa(%rip),%rax
mov    (%rax),%edi
lea    0xb1f(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    14e8 <main+0x288>

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 = [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 %143
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 %143
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 %143
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 %143
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 %143
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 %143
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 %143
127: ; preds = %109
%128 = load i32*, i32** %6
%129 = call i32 @BIO_puts(i32* %128, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
br label %130
130: ; preds = %137, %127
%131 = load i32*, i32** %6
%132 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%133 = call i32 @BIO_read(i32* %131, i8* %132, i32 1024)
store i32 %133, i32* %8
%134 = load i32, i32* %8
%135 = icmp sle i32 %134, 0
br i1 %135, label %136, label %137
136: ; preds = %130
br label %142
137: ; preds = %130
%138 = load i32*, i32** %7
%139 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%140 = load i32, i32* %8
%141 = call i32 @BIO_write(i32* %138, i8* %139, i32 %140)
br label %130
142: ; preds = %136
br label %143
143: ; preds = %142, %122, %106, %94, %85, %77, %55, %47
%144 = load i32*, i32** %11
%145 = call i32 @SSL_CONF_CTX_free(i32* %144)
%146 = load i32*, i32** %6
%147 = call i32 @BIO_free_all(i32* %146)
%148 = load i32*, i32** %7
%149 = call i32 @BIO_free(i32* %148)
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 = [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 %112
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 %112
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 %112
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 %112
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 %112
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 %112
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 %112
103: ; preds = %89
%104 = call i32 @BIO_puts(i32* %82, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%105 = call i32 @BIO_read(i32* %82, i8* %7, i32 1024)
%106 = icmp slt i32 %105, 1
br i1 %106, label %112, label %107
107: ; preds = %103, %107
%108 = phi i32 [ %110, %107 ], [ %105, %103 ]
%109 = call i32 @BIO_write(i32* %95, i8* %7, i32 %108)
%110 = call i32 @BIO_read(i32* %82, i8* %7, i32 1024)
%111 = icmp slt i32 %110, 1
br i1 %111, label %112, label %107
112: ; preds = %107, %103, %62, %55, %36, %29, %76, %86, %98
%113 = phi i32* [ %95, %98 ], [ null, %86 ], [ null, %76 ], [ null, %29 ], [ null, %36 ], [ null, %55 ], [ null, %62 ], [ %95, %103 ], [ %95, %107 ]
%114 = phi i32* [ %82, %98 ], [ %82, %86 ], [ null, %76 ], [ null, %29 ], [ null, %36 ], [ null, %55 ], [ null, %62 ], [ %82, %103 ], [ %82, %107 ]
%115 = call i32 @SSL_CONF_CTX_free(i32* %15)
%116 = call i32 @BIO_free_all(i32* %114)
%117 = call i32 @BIO_free(i32* %113)
ret i32 0
}