#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*/ 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;
  }
  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    0xd71(%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   10e0 <SSL_CTX_new@plt>
mov    %rax,-0x438(%rbp)
mov    $0x0,%al
call   1100 <SSL_CONF_CTX_new@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
mov    0x2d0d(%rip),%rax
mov    (%rax),%esi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    -0x440(%rbp),%rdi
mov    -0x438(%rbp),%rsi
call   1120 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    -0x450(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x461(%rbp)
je     131f <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    1332 <main+0xe2>
jmp    1480 <main+0x230>
mov    -0x440(%rbp),%rdi
lea    -0x45c(%rbp),%rsi
lea    -0x450(%rbp),%rdx
call   10d0 <SSL_CONF_cmd_argv@plt>
mov    %eax,-0x460(%rbp)
cmpl   $0xfffffffd,-0x460(%rbp)
jne    1385 <main+0x135>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    15c5 <main+0x375>
cmpl   $0x0,-0x460(%rbp)
jge    13c6 <main+0x176>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xc7c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2c16(%rip),%rax
mov    (%rax),%edi
call   1160 <ERR_print_errors_fp@plt>
jmp    15c5 <main+0x375>
cmpl   $0x0,-0x460(%rbp)
jle    13d8 <main+0x188>
jmp    12ed <main+0x9d>
mov    -0x450(%rbp),%rax
mov    (%rax),%rdi
lea    0xc54(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    145a <main+0x20a>
mov    -0x450(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x458(%rbp)
cmpq   $0x0,-0x458(%rbp)
jne    1434 <main+0x1e4>
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
lea    0xc1e(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    15c5 <main+0x375>
mov    -0x450(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x450(%rbp)
mov    -0x45c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x45c(%rbp)
jmp    12ed <main+0x9d>
mov    0x2b6f(%rip),%rax
mov    (%rax),%edi
mov    -0x450(%rbp),%rax
mov    (%rax),%rdx
lea    0xbed(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    15c5 <main+0x375>
mov    -0x440(%rbp),%rdi
call   1060 <SSL_CONF_CTX_finish@plt>
cmp    $0x0,%eax
jne    14bf <main+0x26f>
mov    0x2b34(%rip),%rax
mov    (%rax),%edi
lea    0xbd1(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2b1d(%rip),%rax
mov    (%rax),%edi
call   1160 <ERR_print_errors_fp@plt>
jmp    15c5 <main+0x375>
mov    -0x438(%rbp),%rdi
call   1170 <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    1509 <main+0x2b9>
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
lea    0xb87(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    15c5 <main+0x375>
mov    -0x18(%rbp),%rdi
mov    -0x458(%rbp),%rsi
call   10c0 <BIO_set_conn_hostname@plt>
mov    0x2aa8(%rip),%rax
mov    (%rax),%edi
mov    0x2abf(%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     1571 <main+0x321>
mov    0x2a82(%rip),%rax
mov    (%rax),%edi
lea    0xb47(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2a6b(%rip),%rax
mov    (%rax),%edi
call   1160 <ERR_print_errors_fp@plt>
jmp    15c5 <main+0x375>
mov    -0x18(%rbp),%rdi
lea    0xb3e(%rip),%rsi
call   1140 <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     15a8 <main+0x358>
jmp    15c0 <main+0x370>
mov    -0x20(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1150 <BIO_write@plt>
jmp    1581 <main+0x331>
jmp    15c5 <main+0x375>
mov    -0x440(%rbp),%rdi
call   1110 <SSL_CONF_CTX_free@plt>
mov    -0x18(%rbp),%rdi
call   1130 <BIO_free_all@plt>
mov    -0x20(%rbp),%rdi
call   10f0 <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   10e0 <SSL_CTX_new@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1100 <SSL_CONF_CTX_new@plt>
mov    %rax,%r14
mov    0x2d4a(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1090 <SSL_CONF_CTX_set_flags@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1120 <SSL_CONF_CTX_set_ssl_ctx@plt>
mov    0x8(%rbx),%rax
lea    0xd4a(%rip),%rbx
test   %rax,%rax
je     1339 <main+0xe9>
lea    0x14(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0xd71(%rip),%rbp
jmp    12d8 <main+0x88>
xchg   %ax,%ax
mov    (%rax),%rax
test   %rax,%rax
je     1339 <main+0xe9>
cmpb   $0x2d,(%rax)
jne    1339 <main+0xe9>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10d0 <SSL_CONF_cmd_argv@plt>
cmp    $0xfffffffd,%eax
je     1441 <main+0x1f1>
test   %eax,%eax
js     145b <main+0x20b>
mov    0x8(%rsp),%rax
jne    12d0 <main+0x80>
mov    (%rax),%rdi
mov    %rbp,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    14a6 <main+0x256>
mov    0x8(%rsp),%rax
mov    0x8(%rax),%rbx
test   %rbx,%rbx
je     14f7 <main+0x2a7>
add    $0x10,%rax
mov    %rax,0x8(%rsp)
addl   $0xfffffffe,0x14(%rsp)
jmp    12d0 <main+0x80>
mov    %r14,%rdi
call   1060 <SSL_CONF_CTX_finish@plt>
test   %eax,%eax
je     1406 <main+0x1b6>
mov    %r15,%rdi
call   1170 <BIO_new_ssl_connect@plt>
mov    %rax,%r12
lea    0x18(%rsp),%rsi
mov    %rax,%rdi
call   1080 <BIO_get_ssl@plt>
cmpq   $0x0,0x18(%rsp)
je     1422 <main+0x1d2>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10c0 <BIO_set_conn_hostname@plt>
mov    0x2c49(%rip),%rax
mov    (%rax),%edi
mov    0x2c60(%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    1486 <main+0x236>
lea    0xd10(%rip),%rsi
mov    %r12,%rdi
call   1140 <BIO_puts@plt>
lea    0x20(%rsp),%rsi
mov    %r12,%rdi
mov    $0x400,%edx
call   1070 <BIO_read@plt>
test   %eax,%eax
jle    14cb <main+0x27b>
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   1150 <BIO_write@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1070 <BIO_read@plt>
test   %eax,%eax
jg     13e0 <main+0x190>
jmp    14cb <main+0x27b>
mov    0x2bc3(%rip),%rbx
mov    (%rbx),%edi
lea    0xc60(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    147d <main+0x22d>
mov    0x2ba7(%rip),%rax
mov    (%rax),%edi
lea    0xc52(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    14cb <main+0x27b>
mov    0x2b88(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xbb6(%rip),%rsi
jmp    14be <main+0x26e>
mov    0x2b6e(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xbb5(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    (%rbx),%edi
call   1160 <ERR_print_errors_fp@plt>
jmp    14c8 <main+0x278>
mov    0x2b43(%rip),%rbx
mov    (%rbx),%edi
lea    0xc08(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    (%rbx),%edi
call   1160 <ERR_print_errors_fp@plt>
jmp    14cb <main+0x27b>
mov    0x2b23(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xba3(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10b0 <fprintf@plt>
xor    %r12d,%r12d
mov    %r14,%rdi
call   1110 <SSL_CONF_CTX_free@plt>
mov    %r12,%rdi
call   1130 <BIO_free_all@plt>
mov    %r15,%rdi
call   10f0 <BIO_free@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ad2(%rip),%rax
mov    (%rax),%edi
lea    0xb3f(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    14c8 <main+0x278>

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"
@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 %140
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 %140
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 %140
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 %140
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 %140
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 %140
109: ; preds = %99
%110 = load i32*, i32** %6
%111 = load i8*, i8** %14
%112 = call i32 @BIO_set_conn_hostname(i32* %110, i8* %111)
%113 = load i32, i32* @stdout
%114 = load i32, i32* @BIO_NOCLOSE
%115 = call i32* @BIO_new_fp(i32 %113, i32 %114)
store i32* %115, i32** %7
%116 = load i32*, i32** %6
%117 = call i64 @BIO_do_connect(i32* %116)
%118 = icmp sle i64 %117, 0
br i1 %118, label %119, label %124
119: ; preds = %109
%120 = load i32, i32* @stderr
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%122 = load i32, i32* @stderr
%123 = call i32 @ERR_print_errors_fp(i32 %122)
br label %140
124: ; preds = %109
%125 = load i32*, i32** %6
%126 = call i32 @BIO_puts(i32* %125, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
br label %127
127: ; preds = %134, %124
%128 = load i32*, i32** %6
%129 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%130 = call i32 @BIO_read(i32* %128, i8* %129, i32 1024)
store i32 %130, i32* %8
%131 = load i32, i32* %8
%132 = icmp sle i32 %131, 0
br i1 %132, label %133, label %134
133: ; preds = %127
br label %139
134: ; preds = %127
%135 = load i32*, i32** %7
%136 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%137 = load i32, i32* %8
%138 = call i32 @BIO_write(i32* %135, i8* %136, i32 %137)
br label %127
139: ; preds = %133
br label %140
140: ; preds = %139, %119, %106, %94, %85, %77, %55, %47
%141 = load i32*, i32** %11
%142 = call i32 @SSL_CONF_CTX_free(i32* %141)
%143 = load i32*, i32** %6
%144 = call i32 @BIO_free_all(i32* %143)
%145 = load i32*, i32** %7
%146 = call i32 @BIO_free(i32* %145)
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"
@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 %110
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 %110
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 %110
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 %110
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 %110
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 %110
89: ; preds = %81
%90 = call i32 @BIO_set_conn_hostname(i32* %82, i8* %73)
%91 = load i32, i32* @stdout
%92 = load i32, i32* @BIO_NOCLOSE
%93 = call i32* @BIO_new_fp(i32 %91, i32 %92)
%94 = call i64 @BIO_do_connect(i32* %82)
%95 = icmp slt i64 %94, 1
br i1 %95, label %96, label %101
96: ; preds = %89
%97 = load i32, i32* @stderr
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%99 = load i32, i32* @stderr
%100 = call i32 @ERR_print_errors_fp(i32 %99)
br label %110
101: ; preds = %89
%102 = call i32 @BIO_puts(i32* %82, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%103 = call i32 @BIO_read(i32* %82, i8* %7, i32 1024)
%104 = icmp slt i32 %103, 1
br i1 %104, label %110, label %105
105: ; preds = %101, %105
%106 = phi i32 [ %108, %105 ], [ %103, %101 ]
%107 = call i32 @BIO_write(i32* %93, i8* %7, i32 %106)
%108 = call i32 @BIO_read(i32* %82, i8* %7, i32 1024)
%109 = icmp slt i32 %108, 1
br i1 %109, label %110, label %105
110: ; preds = %105, %101, %62, %55, %36, %29, %76, %86, %96
%111 = phi i32* [ %93, %96 ], [ null, %86 ], [ null, %76 ], [ null, %29 ], [ null, %36 ], [ null, %55 ], [ null, %62 ], [ %93, %101 ], [ %93, %105 ]
%112 = phi i32* [ %82, %96 ], [ %82, %86 ], [ null, %76 ], [ null, %29 ], [ null, %36 ], [ null, %55 ], [ null, %62 ], [ %82, %101 ], [ %82, %105 ]
%113 = call i32 @SSL_CONF_CTX_free(i32* %15)
%114 = call i32 @BIO_free_all(i32* %112)
%115 = call i32 @BIO_free(i32* %111)
ret i32 0
}