// File: /workspace/github_cpp_makefile_star2_O1/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 $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movl %edi, %ebp
callq 0x3550
movq %rax, %rdi
callq 0x33d0
movq %rax, 0x18(%rsp)
movl $0x40020000, %esi       # imm = 0x40020000
movq %rax, %rdi
callq 0x3520
callq 0x3160
movq %rax, %rdi
callq 0x33d0
movq %rax, 0x10(%rsp)
movl $0x40020000, %esi       # imm = 0x40020000
movq %rax, %rdi
callq 0x3520
cmpl $0x2, %ebp
jle 0x3b15
movq 0x8(%rbx), %rdi
leaq 0x3944(%rip), %rsi      # 0x7048
callq 0x33a0
testl %eax, %eax
je 0x371b
decl %ebp
addq $0x8, %rbx
movl $0x1, %r12d
jmp 0x3736
movq 0x10(%rbx), %rdi
callq 0x3430
testl %eax, %eax
je 0x3b09
movl %eax, %r12d
addq $0x18, %rbx
addl $-0x3, %ebp
movq (%rbx), %r14
leaq 0x3926(%rip), %rsi      # 0x7066
movq %r14, %rdi
callq 0x33a0
testl %eax, %eax
je 0x3770
leaq 0x3919(%rip), %rsi      # 0x706c
movq %r14, %rdi
callq 0x33a0
xorl %r13d, %r13d
testl %eax, %eax
jne 0x3779
addq $0x8, %rbx
decl %ebp
movl $0x1, %r13d
jmp 0x3779
addq $0x8, %rbx
decl %ebp
xorl %r13d, %r13d
cmpl $0x1, %ebp
jle 0x3b15
movq 0x8(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x56e6
movq 0x8(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x56e6
leaq 0x18(%rsp), %rdi
movl %r13d, %esi
callq 0x57d8
leaq 0x10(%rsp), %rdi
movl %r13d, %esi
callq 0x58be
movq (%rbx), %r14
leaq 0x38b2(%rip), %rsi      # 0x7074
movq %r14, %rdi
callq 0x33a0
cmpl $0x3, %ebp
jne 0x3a93
testl %eax, %eax
jne 0x3a93
movq 0x10(%rbx), %rdi
callq 0x3430
cltq
movq %rax, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movl %r12d, %r15d
leaq 0x88(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %r15, %rsi
callq 0x590e
leaq 0x40(%rsp), %rax
movq (%rax), %rbx
cmpq $0x2000, %rbx           # imm = 0x2000
movl $0x4000000, %eax        # imm = 0x4000000
movl $0x40000000, %edi       # imm = 0x40000000
cmovbq %rax, %rdi
callq 0x4b52
xorl %r14d, %r14d
xorl %edx, %edx
divq %rbx
leaq 0xf8(%rsp), %rcx
movq %rax, (%rcx)
leaq 0xc0(%rsp), %r13
leaq 0x20(%rsp), %r12
leaq 0xa0(%rsp), %rbp
movq %r15, %rbx
leaq 0xeae(%rip), %rax       # 0x4721
movq %rax, 0x100(%rsp)
movq 0x88(%rsp), %rax
addq %r14, %rax
movq %rax, 0x68(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
leaq 0x100(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x48(%rsp), %rcx
movq %r12, %r8
leaq 0xf8(%rsp), %r9
callq 0x5986
movq %rbp, %rdi
movq %r13, %rsi
callq 0x5be2
cmpq $0x0, 0xc0(%rsp)
jne 0x3fb9
addq $0x10, %r14
decq %rbx
jne 0x386c
xorl %ebx, %ebx
movq 0xa0(%rsp), %rdi
addq %rbx, %rdi
callq 0x34b0
addq $0x8, %rbx
decq %r15
jne 0x38f6
movq 0x10(%rsp), %rdi
callq 0x32d0
leaq 0xc0(%rsp), %rdi
movq %rax, %rsi
callq 0x5a48
movq 0x18(%rsp), %rdi
callq 0x32d0
leaq 0x100(%rsp), %rdi
movq %rax, %rsi
callq 0x5a48
leaq 0x3af7(%rip), %rsi      # 0x7441
leaq 0xc0(%rsp), %rdi
callq 0x6210
leaq 0xc0(%rsp), %rbx
leaq 0x100(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4be2
testb %al, %al
jne 0x3967
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movabsq $0x6e6573096b6c7562, %rax # imm = 0x6E6573096B6C7562
movq %rax, (%r14)
movw $0x964, 0x8(%r14)       # imm = 0x964
movl $0xa, %eax
movq %rax, -0x8(%r14)
xorl %ecx, %ecx
movb %cl, 0xa(%r14)
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movabsq $0x636572096b6c7562, %rdx # imm = 0x636572096B6C7562
movq %rdx, (%r15)
movw $0x976, 0x8(%r15)       # imm = 0x976
movq %rax, -0x8(%r15)
movb %cl, 0xa(%r15)
leaq 0x20(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x5ac2
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x68(%rsp), %rdi
callq 0x3100
leaq 0x30(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x3a09
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x20(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x5ac2
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x3100
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x3a46
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0xf8(%rsp), %rax
imulq 0x40(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x35af(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x35b7(%rip), %xmm1     # 0x7020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x35b3(%rip), %xmm0     # 0x7030
movq 0x68(%rsp), %rdi
movq 0x48(%rsp), %rsi
leaq 0x38d3(%rip), %rcx      # 0x7361
jmp 0x3e0e
leaq 0x35df(%rip), %rsi      # 0x7079
movq %r14, %rdi
callq 0x33a0
testl %eax, %eax
je 0x3b65
leaq 0x35d2(%rip), %rsi      # 0x7083
movq %r14, %rdi
callq 0x33a0
movl %eax, %ebp
testl %eax, %eax
je 0x3b47
leaq 0x35ca(%rip), %rsi      # 0x7094
movq %r14, %rdi
callq 0x33a0
testl %eax, %eax
je 0x3b47
leaq 0x35c8(%rip), %rsi      # 0x70a5
movq %r14, %rdi
callq 0x33a0
testl %eax, %eax
jne 0x3b15
movq 0x10(%rbx), %rdi
callq 0x3430
movslq %eax, %rdx
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x454d
jmp 0x3e8d
leaq 0x3542(%rip), %rdi      # 0x7052
callq 0x3400
callq 0x3fc8
movl $0x1, %ebx
movq 0x10(%rsp), %rdi
callq 0x3070
movq 0x18(%rsp), %rdi
callq 0x3070
movl %ebx, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
testl %ebp, %ebp
setne %cl
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movl %r12d, %edi
callq 0x3fee
jmp 0x3e8d
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movl %r12d, %ebp
leaq 0x88(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %rbp, %rsi
callq 0x590e
movl $0x200, %edi            # imm = 0x200
callq 0x4b52
leaq 0x40(%rsp), %rcx
movq %rax, (%rcx)
xorl %r15d, %r15d
leaq 0xc0(%rsp), %r13
leaq 0x20(%rsp), %r12
leaq 0xa0(%rsp), %r14
movq %rbp, %rbx
leaq 0x1063(%rip), %rax      # 0x4c30
movq %rax, 0x100(%rsp)
movq 0x88(%rsp), %rax
addq %r15, %rax
movq %rax, 0x68(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r13, %rdi
leaq 0x100(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x40(%rsp), %rcx
leaq 0x48(%rsp), %r8
movq %r12, %r9
callq 0x6286
movq %r14, %rdi
movq %r13, %rsi
callq 0x5be2
cmpq $0x0, 0xc0(%rsp)
jne 0x3fb9
addq $0x10, %r15
decq %rbx
jne 0x3bc6
xorl %ebx, %ebx
movq 0xa0(%rsp), %rdi
addq %rbx, %rdi
callq 0x34b0
addq $0x8, %rbx
decq %rbp
jne 0x3c40
movq 0x10(%rsp), %rdi
callq 0x32d0
leaq 0xc0(%rsp), %rdi
movq %rax, %rsi
callq 0x5a48
movq 0x18(%rsp), %rdi
callq 0x32d0
leaq 0x100(%rsp), %rdi
movq %rax, %rsi
callq 0x5a48
leaq 0x37ad(%rip), %rsi      # 0x7441
leaq 0xc0(%rsp), %rdi
callq 0x6210
leaq 0xc0(%rsp), %rbx
leaq 0x100(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4be2
testb %al, %al
jne 0x3cb1
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x48(%rsp), %rsi
movq $0x12, (%rsi)
leaq 0x68(%rsp), %rdi
xorl %edx, %edx
callq 0x34d0
movq %rax, 0x68(%rsp)
leaq 0x58(%rsp), %r15
movq -0x10(%r15), %rcx
movq %rcx, 0x78(%rsp)
movupd 0x37a9(%rip), %xmm0     # 0x74a5
movupd %xmm0, (%rax)
movw $0x972, 0x10(%rax)      # imm = 0x972
movq %rcx, 0x70(%rsp)
movq 0x68(%rsp), %rax
movb $0x0, (%rax,%rcx)
movq %r15, -0x10(%r15)
leaq 0x20(%rsp), %rsi
movq $0x12, (%rsi)
leaq 0x48(%rsp), %rdi
xorl %edx, %edx
callq 0x34d0
movq %rax, 0x48(%rsp)
leaq 0x20(%rsp), %rdi
movq (%rdi), %rcx
movq %rcx, 0x58(%rsp)
movupd 0x376e(%rip), %xmm0     # 0x74b8
movupd %xmm0, (%rax)
movw $0x974, 0x10(%rax)      # imm = 0x974
movq %rcx, 0x50(%rsp)
movq 0x48(%rsp), %rax
movb $0x0, (%rax,%rcx)
leaq 0xc0(%rsp), %rsi
callq 0x5ac2
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x68(%rsp), %rdi
callq 0x3100
leaq 0x30(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x3d9f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x20(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x5ac2
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x3100
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x3ddc
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x68(%rsp), %rdi
movsd 0x40(%rsp), %xmm1
unpcklps 0x3222(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x322a(%rip), %xmm1     # 0x7020
movq 0x48(%rsp), %rsi
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
leaq 0x36bd(%rip), %rcx      # 0x74cb
leaq 0x88(%rsp), %rdx
callq 0x49bd
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x3e32
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e49
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x100(%rsp), %rdi
callq 0x5b4a
leaq 0xc0(%rsp), %rdi
callq 0x5b4a
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3e80
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
leaq 0xa0(%rsp), %rdi
callq 0x5b80
xorl %ebx, %ebx
jmp 0x3b1f
jmp 0x3eb4
jmp 0x3ee5
jmp 0x3ec5
jmp 0x3ee5
movq %rax, %rbx
jmp 0x3eff
jmp 0x3f42
jmp 0x3f42
jmp 0x3f1a
jmp 0x3f1f
jmp 0x3f70
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3ed6
jmp 0x3ee8
jmp 0x3ee5
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ee8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
jmp 0x3ee8
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x3eff
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x3f45
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32c0
jmp 0x3f45
jmp 0x3f42
movq %rax, %rbx
jmp 0x3f90
movq %rax, %rbx
jmp 0x3f52
jmp 0x3f70
movq %rax, %rbx
jmp 0x3f9d
jmp 0x3fc0
jmp 0x3fc0
jmp 0x3f42
jmp 0x3f70
jmp 0x3f70
jmp 0x3f65
movq %rax, %rbx
jmp 0x3fa7
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x5b4a
leaq 0xc0(%rsp), %rdi
callq 0x5b4a
jmp 0x3f73
jmp 0x3f70
jmp 0x3f70
cmpq $0x0, 0xc0(%rsp)
jne 0x3fb9
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3f90
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
leaq 0xa0(%rsp), %rdi
callq 0x5b80
movq 0x10(%rsp), %rdi
callq 0x3070
movq 0x18(%rsp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x34c0
callq 0x30e0
jmp 0x3fc0
movq %rax, %rdi
callq 0x5bbb