#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 */

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ SSL_library_init();
int /*<<< orphan*/ do_test(char const *, char const *, char const *,
                           char const *, char const *, int);
int getopt(int, char **, char *);
char *optarg;
int optind;
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  int opt;
  const char *addr = NULL, *cipher = NULL;
  const char *client_cert_file = NULL, *client_key_file = NULL;
  const char *ca_file = NULL;
  int verify_server_name = 0;
  while ((opt = getopt(argc, argv, "a:C:c:k:n")) != -1) {
    switch (opt) {
    case 'a':
      ca_file = optarg;
      break;
    case 'C':
      cipher = optarg;
      break;
    case 'c':
      client_cert_file = optarg;
      break;
    case 'k':
      client_key_file = optarg;
      break;
    case 'n':
      verify_server_name = 1;
      break;
    }
  }
  if (client_key_file == NULL)
    client_key_file = client_cert_file;
  if (optind < argc) {
    addr = argv[optind];
  } else {
    addr = "localhost:4343";
  }
  SSL_library_init();
  usleep(100000);
  if (!do_test(addr, ca_file, client_cert_file, client_key_file, cipher,
               verify_server_name)) {
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf1d(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1225 <main+0xe5>
mov    -0x14(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0x2b,%eax
ja     1220 <main+0xe0>
mov    -0x50(%rbp),%rax
lea    0xe3c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e24(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1220 <main+0xe0>
mov    0x2e11(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1220 <main+0xe0>
mov    0x2dfe(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1220 <main+0xe0>
mov    0x2deb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1220 <main+0xe0>
movl   $0x1,-0x44(%rbp)
jmp    1185 <main+0x45>
cmpq   $0x0,-0x38(%rbp)
jne    1238 <main+0xf8>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1265 <main+0x125>
mov    -0x10(%rbp),%rax
mov    0x2d8b(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
jmp    1270 <main+0x130>
lea    0xe4e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <SSL_library_init@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x44(%rbp),%r9d
call   1040 <do_test@plt>
cmp    $0x0,%eax
jne    12b8 <main+0x178>
mov    0x2d22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12c4 <main+0x184>
mov    0x2d09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbp
mov    %edi,%r14d
xor    %eax,%eax
mov    %rax,0x20(%rsp)
lea    0xf4e(%rip),%r12
lea    0xe97(%rip),%r13
mov    0x2e88(%rip),%r15
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %ebx,%ebx
xor    %eax,%eax
mov    %rax,0x10(%rsp)
movl   $0x0,0xc(%rsp)
jmp    1195 <main+0x55>
nopw   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     11e2 <main+0xa2>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1050 <getopt@plt>
lea    -0x43(%rax),%ecx
cmp    $0x2b,%ecx
ja     1190 <main+0x50>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
jmp    *%rax
mov    (%r15),%rax
mov    %rax,0x20(%rsp)
jmp    1195 <main+0x55>
mov    (%r15),%rax
mov    %rax,0x10(%rsp)
jmp    1195 <main+0x55>
mov    (%r15),%rax
mov    %rax,0x18(%rsp)
jmp    1195 <main+0x55>
mov    (%r15),%rbx
jmp    1195 <main+0x55>
movl   $0x1,0xc(%rsp)
jmp    1195 <main+0x55>
mov    0x2df7(%rip),%rax
movslq (%rax),%rax
cmp    %r14d,%eax
jge    11f8 <main+0xb8>
mov    0x0(%rbp,%rax,8),%r14
jmp    11ff <main+0xbf>
lea    0xebb(%rip),%r14
test   %rbx,%rbx
mov    0x18(%rsp),%rbp
cmove  %rbp,%rbx
xor    %eax,%eax
call   1030 <SSL_library_init@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
mov    %r14,%rdi
mov    0x10(%rsp),%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    0x20(%rsp),%r8
mov    0xc(%rsp),%r9d
call   1040 <do_test@plt>
test   %eax,%eax
jne    1246 <main+0x106>
mov    0x2d8c(%rip),%rax
jmp    124d <main+0x10d>
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"a:C:c:k:n\00"
@optarg = global i8* null
@optind = global i32 0
@.str.1 = [15 x i8] c"localhost:4343\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
store i8* null, i8** %11
store i32 0, i32* %12
br label %13
13: ; preds = %29, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %6
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %30
18: ; preds = %13
%19 = load i32, i32* %6
switch i32 %19, label %29 [
i32 97, label %20
i32 67, label %22
i32 99, label %24
i32 107, label %26
i32 110, label %28
]
20: ; preds = %18
%21 = load i8*, i8** @optarg
store i8* %21, i8** %11
br label %29
22: ; preds = %18
%23 = load i8*, i8** @optarg
store i8* %23, i8** %8
br label %29
24: ; preds = %18
%25 = load i8*, i8** @optarg
store i8* %25, i8** %9
br label %29
26: ; preds = %18
%27 = load i8*, i8** @optarg
store i8* %27, i8** %10
br label %29
28: ; preds = %18
store i32 1, i32* %12
br label %29
29: ; preds = %18, %28, %26, %24, %22, %20
br label %13
30: ; preds = %13
%31 = load i8*, i8** %10
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = load i8*, i8** %9
store i8* %34, i8** %10
br label %35
35: ; preds = %33, %30
%36 = load i32, i32* @optind
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %45
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = load i32, i32* @optind
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
store i8* %44, i8** %7
br label %46
45: ; preds = %35
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %7
br label %46
46: ; preds = %45, %39
%47 = call i32 (...) @SSL_library_init()
%48 = call i32 @usleep(i32 100000)
%49 = load i8*, i8** %7
%50 = load i8*, i8** %11
%51 = load i8*, i8** %9
%52 = load i8*, i8** %10
%53 = load i8*, i8** %8
%54 = load i32, i32* %12
%55 = call i32 @do_test(i8* %49, i8* %50, i8* %51, i8* %52, i8* %53, i32 %54)
%56 = icmp ne i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %46
%58 = load i32, i32* @EXIT_FAILURE
store i32 %58, i32* %3
br label %61
59: ; preds = %46
%60 = load i32, i32* @EXIT_SUCCESS
store i32 %60, i32* %3
br label %61
61: ; preds = %59, %57
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
@.str = [10 x i8] c"a:C:c:k:n\00"
@optarg = global i8* null
@optind = global i32 0
@.str.1 = [15 x i8] c"localhost:4343\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %27, %2
%4 = phi i8* [ %28, %27 ], [ null, %2 ]
%5 = phi i8* [ %10, %27 ], [ null, %2 ]
%6 = phi i8* [ %15, %27 ], [ null, %2 ]
%7 = phi i8* [ %19, %27 ], [ null, %2 ]
%8 = phi i32 [ %22, %27 ], [ 0, %2 ]
br label %9
9: ; preds = %3, %29
%10 = phi i8* [ %5, %3 ], [ %30, %29 ]
%11 = phi i8* [ %6, %3 ], [ %15, %29 ]
%12 = phi i8* [ %7, %3 ], [ %19, %29 ]
%13 = phi i32 [ %8, %3 ], [ %22, %29 ]
br label %14
14: ; preds = %9, %31
%15 = phi i8* [ %11, %9 ], [ %32, %31 ]
%16 = phi i8* [ %12, %9 ], [ %19, %31 ]
%17 = phi i32 [ %13, %9 ], [ %22, %31 ]
br label %18
18: ; preds = %14, %25
%19 = phi i8* [ %16, %14 ], [ %26, %25 ]
%20 = phi i32 [ %17, %14 ], [ %22, %25 ]
br label %21
21: ; preds = %23, %18
%22 = phi i32 [ %20, %18 ], [ 1, %23 ]
br label %23
23: ; preds = %21, %23
%24 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %24, label %23 [
i32 -1, label %33
i32 97, label %25
i32 67, label %27
i32 99, label %29
i32 107, label %31
i32 110, label %21
]
25: ; preds = %23
%26 = load i8*, i8** @optarg
br label %18
27: ; preds = %23
%28 = load i8*, i8** @optarg
br label %3
29: ; preds = %23
%30 = load i8*, i8** @optarg
br label %9
31: ; preds = %23
%32 = load i8*, i8** @optarg
br label %14
33: ; preds = %23
%34 = load i32, i32* @optind
%35 = icmp slt i32 %34, %0
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = sext i32 %34 to i64
%38 = getelementptr inbounds i8*, i8** %1, i64 %37
%39 = load i8*, i8** %38
br label %40
40: ; preds = %33, %36
%41 = phi i8* [ %39, %36 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %33 ]
%42 = icmp eq i8* %15, null
%43 = select i1 %42, i8* %10, i8* %15
%44 = tail call i32 (...) @SSL_library_init()
%45 = tail call i32 @usleep(i32 100000)
%46 = tail call i32 @do_test(i8* %41, i8* %19, i8* %10, i8* %43, i8* %4, i32 %22)
%47 = icmp eq i32 %46, 0
%48 = load i32, i32* @EXIT_FAILURE
%49 = load i32, i32* @EXIT_SUCCESS
%50 = select i1 %47, i32 %48, i32 %49
ret i32 %50
}