// File: /workspace/github_cpp_makefile_star2_O2/ctz[P]openssl-bench/bench.cc
// Function: main
int main(int argc, char **argv) {
  Context server_ctx = Context::server();
  Context client_ctx = Context::client();

  argv += 1;
  argc -= 1;

  if (argc < 2) {
    return usage();
  }

  unsigned n_threads = 1;
  if (strcmp(argv[0], "--threads") == 0) {
    n_threads = unsigned(atoi(argv[1]));
    argv += 2;
    argc -= 2;
    if (n_threads == 0) {
      puts("bad --threads count");
      return usage();
    }
  }

  KeyType key_type;
  if (strcmp(argv[0], "--rsa") == 0) {
    key_type = KeyType::RSA2048;
    argv += 1;
    argc -= 1;
  } else if (strcmp(argv[0], "--ecdsa") == 0) {
    key_type = KeyType::ECDSAP256;
    argv += 1;
    argc -= 1;
  } else {
    key_type = KeyType::RSA2048;
  }

  if (argc < 2) {
    return usage();
  }

  server_ctx.set_ciphers(argv[1]);
  client_ctx.set_ciphers(argv[1]);
  server_ctx.load_server_creds(key_type);
  client_ctx.load_client_creds(key_type);

  if (!strcmp(argv[0], "bulk") && argc == 3) {
    test_bulk(n_threads, server_ctx, client_ctx, atoi(argv[2]));
  } else if (!strcmp(argv[0], "handshake")) {
    test_handshake(n_threads, server_ctx, client_ctx);
  } else if (!strcmp(argv[0], "handshake-resume")) {
    test_handshake_resume(n_threads, server_ctx, client_ctx, false);
  } else if (!strcmp(argv[0], "handshake-ticket")) {
    test_handshake_resume(n_threads, server_ctx, client_ctx, true);
  } else if (!strcmp(argv[0], "memory")) {
    test_memory(server_ctx, client_ctx, atoi(argv[2]));
  } else {
    return usage();
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x508, %rsp            # imm = 0x508
movq %rsi, %r15
movl %edi, %r13d
leaq 0x10(%rsp), %rdi
callq 0x4f76
leaq 0x8(%rsp), %rdi
callq 0x4f98
cmpl $0x2, %r13d
jle 0x3b43
movq 0x8(%r15), %rbx
leaq 0x397c(%rip), %rsi      # 0x7048
movq %rbx, %rdi
callq 0x33c0
testl %eax, %eax
je 0x36e5
pushq $0x1
popq %r12
decl %r13d
addq $0x8, %r15
jmp 0x3705
movq 0x10(%r15), %rdi
callq 0x3440
testl %eax, %eax
je 0x3b37
movl %eax, %r12d
addl $-0x3, %r13d
movq 0x18(%r15), %rbx
addq $0x18, %r15
leaq 0x395a(%rip), %rsi      # 0x7066
movq %rbx, %rdi
callq 0x33c0
testl %eax, %eax
je 0x3739
leaq 0x394d(%rip), %rsi      # 0x706c
movq %rbx, %rdi
callq 0x33c0
xorl %ebx, %ebx
testl %eax, %eax
jne 0x3742
addq $0x8, %r15
decl %r13d
pushq $0x1
popq %rbx
jmp 0x3742
addq $0x8, %r15
decl %r13d
xorl %ebx, %ebx
cmpl $0x1, %r13d
jle 0x3b43
movq 0x8(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x4fba
movq 0x8(%r15), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4fba
leaq 0x10(%rsp), %rdi
movl %ebx, %esi
callq 0x507c
leaq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x514a
movq (%r15), %rbp
leaq 0x38ea(%rip), %rsi      # 0x7074
movq %rbp, %rdi
callq 0x33c0
movl %r12d, %r14d
cmpl $0x3, %r13d
jne 0x38b8
testl %eax, %eax
jne 0x38b8
movq 0x10(%r15), %rdi
callq 0x3440
movslq %eax, %rbx
movq %rbx, 0x18(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0x100(%rsp), %rdx
movq %r14, %rsi
callq 0x51ea
cmpl $0x2000, %ebx           # imm = 0x2000
movl $0x4000000, %eax        # imm = 0x4000000
movl $0x40000000, %edi       # imm = 0x40000000
cmovbq %rax, %rdi
callq 0x4791
xorl %ebp, %ebp
xorl %edx, %edx
divq %rbx
leaq 0xa8(%rsp), %rcx
movq %rax, (%rcx)
movq %r14, 0x80(%rsp)
shlq $0x4, %r14
leaq 0x100(%rsp), %r13
leaq 0x88(%rsp), %r12
leaq 0x40(%rsp), %rbx
leaq 0x60(%rsp), %r15
cmpq %rbp, %r14
je 0x39e7
leaq 0xbea(%rip), %rax       # 0x442b
movq %rax, 0xb0(%rsp)
movq 0xe8(%rsp), %rax
addq %rbp, %rax
movq %rax, 0x20(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x8(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %r12, %rcx
movq %rbx, %r8
leaq 0xa8(%rsp), %r9
callq 0x523c
movq %r15, %rdi
movq %r13, %rsi
callq 0x5554
movq %r13, %rdi
callq 0x52e8
addq $0x10, %rbp
jmp 0x3831
leaq 0x37ba(%rip), %rsi      # 0x7079
movq %rbp, %rdi
callq 0x33c0
testl %eax, %eax
je 0x3b90
leaq 0x37ad(%rip), %rsi      # 0x7083
movq %rbp, %rdi
callq 0x33c0
movl %eax, %ebx
testl %eax, %eax
je 0x3b73
leaq 0x37a5(%rip), %rsi      # 0x7094
movq %rbp, %rdi
callq 0x33c0
testl %eax, %eax
je 0x3b73
leaq 0x379f(%rip), %rsi      # 0x70a5
movq %rbp, %rdi
callq 0x33c0
testl %eax, %eax
jne 0x3b43
movq 0x10(%r15), %rdi
callq 0x3440
movslq %eax, %rbx
xorpd %xmm0, %xmm0
leaq 0xb0(%rsp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movapd %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
shrq %rbx
movq %rbx, %rsi
callq 0x62fc
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x62fc
leaq 0x100(%rsp), %r14
leaq 0xb0(%rsp), %r15
leaq 0x20(%rsp), %r12
leaq 0x3aca(%rip), %r13      # 0x7441
movq %rbx, %rbp
subq $0x1, %rbp
jb 0x3def
movq 0x10(%rsp), %rdi
callq 0x3300
movq %r14, %rdi
movq %rax, %rsi
callq 0x52fe
movq %r15, %rdi
movq %r14, %rsi
callq 0x65ac
movq %r14, %rdi
callq 0x5420
movq 0x8(%rsp), %rdi
callq 0x3300
movq %r14, %rdi
movq %rax, %rsi
callq 0x52fe
movq %r12, %rdi
movq %r14, %rsi
callq 0x65ac
movq %r14, %rdi
callq 0x5420
movq 0x28(%rsp), %rdi
addq $-0x38, %rdi
movq %r13, %rsi
callq 0x5c5e
jmp 0x397a
movq 0x80(%rsp), %r14
shlq $0x3, %r14
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x3a0d
movq 0x60(%rsp), %rdi
addq %rbx, %rdi
callq 0x34c0
addq $0x8, %rbx
jmp 0x39f5
movq 0x8(%rsp), %rdi
callq 0x3300
leaq 0x100(%rsp), %rdi
movq %rax, %rsi
callq 0x52fe
movq 0x10(%rsp), %rdi
callq 0x3300
leaq 0xb0(%rsp), %rdi
movq %rax, %rsi
callq 0x52fe
leaq 0x100(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x45d4
leaq 0x38ee(%rip), %rsi      # 0x734b
leaq 0x20(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x536a
leaq 0x38e0(%rip), %rsi      # 0x7356
leaq 0x88(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x536a
leaq 0x40(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x53a6
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3570
leaq 0x40(%rsp), %rdi
callq 0x3150
leaq 0x40(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x53a6
leaq 0x88(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3570
leaq 0x40(%rsp), %rdi
callq 0x3150
movq 0xa8(%rsp), %rax
imulq 0x18(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x3514(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x351c(%rip), %xmm1     # 0x7020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x3518(%rip), %xmm0     # 0x7030
leaq 0x20(%rsp), %rbx
movq (%rbx), %rdi
leaq 0x88(%rsp), %r14
movq (%r14), %rsi
leaq 0x382f(%rip), %rcx      # 0x7361
jmp 0x3d9c
leaq 0x3514(%rip), %rdi      # 0x7052
callq 0x3420
callq 0x3fdb
pushq $0x1
popq %rbx
leaq 0x8(%rsp), %rdi
callq 0x5192
leaq 0x10(%rsp), %rdi
callq 0x5192
movl %ebx, %eax
addq $0x508, %rsp            # imm = 0x508
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
testl %ebx, %ebx
setne %cl
xorl %ebx, %ebx
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movl %r12d, %edi
callq 0x4001
jmp 0x3b4b
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0x100(%rsp), %rdx
movq %r14, %rsi
callq 0x51ea
movl $0x200, %edi            # imm = 0x200
callq 0x4791
leaq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movq %r14, 0x80(%rsp)
shlq $0x4, %r14
xorl %r12d, %r12d
leaq 0x100(%rsp), %r13
leaq 0x88(%rsp), %rbx
leaq 0x40(%rsp), %rbp
leaq 0x60(%rsp), %r15
cmpq %r12, %r14
je 0x3c67
leaq 0xc9d(%rip), %rax       # 0x489c
movq %rax, 0xb0(%rsp)
movq 0xe8(%rsp), %rax
addq %r12, %rax
movq %rax, 0x20(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x8(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %rbx, %r8
movq %rbp, %r9
callq 0x5dac
movq %r15, %rdi
movq %r13, %rsi
callq 0x5554
movq %r13, %rdi
callq 0x52e8
addq $0x10, %r12
jmp 0x3bf3
movq 0x80(%rsp), %r14
shlq $0x3, %r14
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x3c8d
movq 0x60(%rsp), %rdi
addq %rbx, %rdi
callq 0x34c0
addq $0x8, %rbx
jmp 0x3c75
movq 0x8(%rsp), %rdi
callq 0x3300
leaq 0x100(%rsp), %rdi
movq %rax, %rsi
callq 0x52fe
movq 0x10(%rsp), %rdi
callq 0x3300
leaq 0xb0(%rsp), %rdi
movq %rax, %rsi
callq 0x52fe
leaq 0x100(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x45d4
leaq 0x37f2(%rip), %rsi      # 0x74cf
leaq 0x20(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x536a
leaq 0x37ec(%rip), %rsi      # 0x74e2
leaq 0x88(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x536a
leaq 0x40(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x53a6
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3570
leaq 0x40(%rsp), %rdi
callq 0x3150
leaq 0x40(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x53a6
leaq 0x88(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3570
leaq 0x40(%rsp), %rdi
callq 0x3150
leaq 0x20(%rsp), %rbx
movq (%rbx), %rdi
leaq 0x88(%rsp), %r14
movsd 0x18(%rsp), %xmm1
unpcklps 0x3292(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x329a(%rip), %xmm1     # 0x7020
movq (%r14), %rsi
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
leaq 0x3759(%rip), %rcx      # 0x74f5
leaq 0xe8(%rsp), %r15
movq %r15, %rdx
callq 0x4601
movq %r14, %rdi
callq 0x3150
movq %rbx, %rdi
callq 0x3150
leaq 0xb0(%rsp), %rdi
callq 0x5420
leaq 0x100(%rsp), %rdi
callq 0x5420
movq %r15, %rdi
callq 0x5498
leaq 0x60(%rsp), %rdi
callq 0x544a
xorl %ebx, %ebx
jmp 0x3b4b
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x3e27
movq %rbx, %r15
xorl %r12d, %r12d
subq $0x1, %r15
jb 0x3e22
movq 0x20(%rsp), %rdi
addq %r12, %rdi
movq 0xb0(%rsp), %rsi
addq %r12, %rsi
callq 0x484e
addq $0x38, %r12
jmp 0x3dfe
incq %r14
jmp 0x3df2
xorl %r15d, %r15d
leaq 0x100(%rsp), %r14
movq %rbx, %r12
subq $0x1, %r12
jb 0x3e65
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x31b0
movq 0x20(%rsp), %rdi
addq %r15, %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x579e
addq $0x38, %r15
jmp 0x3e35
xorl %r15d, %r15d
leaq 0x100(%rsp), %r14
subq $0x1, %rbx
jb 0x3eac
movq 0x20(%rsp), %rdi
addq %r15, %rdi
movq 0xb0(%rsp), %rsi
addq %r15, %rsi
callq 0x57bc
movq 0xb0(%rsp), %rdi
addq %r15, %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x5856
addq $0x38, %r15
jmp 0x3e70
leaq 0x20(%rsp), %rdi
callq 0x639e
leaq 0xb0(%rsp), %rdi
callq 0x639e
jmp 0x3de8
jmp 0x3fa5
jmp 0x3ee8
jmp 0x3ef7
jmp 0x3ee8
jmp 0x3ef7
jmp 0x3f09
jmp 0x3f1a
jmp 0x3f1a
jmp 0x3f2c
jmp 0x3f31
jmp 0x3f77
jmp 0x3ee8
jmp 0x3ef7
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3150
jmp 0x3efa
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3150
jmp 0x3f0c
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3150
jmp 0x3f1d
jmp 0x3f1a
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x5420
jmp 0x3f34
movq %rax, %rbx
jmp 0x3f99
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x5420
jmp 0x3f8c
jmp 0x3f77
jmp 0x3fa5
jmp 0x3fa5
jmp 0x3fa5
jmp 0x3f4f
jmp 0x3fa5
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x5420
jmp 0x3fa8
jmp 0x3fa5
jmp 0x3fa5
movq %rax, %rbx
jmp 0x3fbf
movq %rax, %rbx
jmp 0x3fc9
jmp 0x3f77
jmp 0x3f77
jmp 0x3f7c
jmp 0x3f77
movq %rax, %rbx
jmp 0x3f8c
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x52e8
leaq 0xe8(%rsp), %rdi
callq 0x5498
leaq 0x60(%rsp), %rdi
callq 0x544a
jmp 0x3fbf
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x639e
leaq 0xb0(%rsp), %rdi
callq 0x639e
leaq 0x8(%rsp), %rdi
callq 0x5192
leaq 0x10(%rsp), %rdi
callq 0x5192
movq %rbx, %rdi
callq 0x34d0