// File: /workspace/github_cpp_makefile_star2_O1/bhhbazinga[P]LockFreeHashTable/test.cc
// Function: main
int main(int argc, char const* argv[]) {
  (void)argc;
  (void)argv;

  srand(std::time(0));

  std::cout << "Benchmark with " << kMaxThreads << " threads:"
            << "\n";

  int elements[] = {kElements1, kElements2, kElements3};
  int timespan1[] = {0, 0, 0, 0};
  int timespan2[] = {0, 0, 0, 0};
  int timespan3[] = {0, 0, 0, 0};

  elements2timespan[kElements1] = timespan1;
  elements2timespan[kElements2] = timespan2;
  elements2timespan[kElements3] = timespan3;

  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 3; ++j) {
      maxElements = elements[j];
      TestConcurrentInsert();
      TestConcurrentFind();
      TestConcurrentDelete();
      TestConcurrentInsertAndFindAndDequeue();
      std::cout << "\n";
    }
  }

  for (int i = 0; i < 3; ++i) {
    maxElements = elements[i];
    float avg = static_cast<float>(elements2timespan[maxElements][0]) / 10.0f;
    std::cout << maxElements
              << " elements insert concurrently, average timespan=" << avg
              << "ms"
              << "\n";
    avg = static_cast<float>(elements2timespan[maxElements][1]) / 10.0f;
    std::cout << maxElements
              << " elements find concurrently, average timespan=" << avg << "ms"
              << "\n";
    avg = static_cast<float>(elements2timespan[maxElements][2]) / 10.0f;
    std::cout << maxElements
              << " elements delete concurrently, average timespan=" << avg
              << "ms"
              << "\n";
    avg = static_cast<float>(elements2timespan[maxElements][3]) / 10.0f;
    std::cout << maxElements
              << " elements insert & find & delete concurrently, average timespan="
              << avg << "ms"
              << "\n";
    std::cout << "\n";
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x2110
movl %eax, %edi
callq 0x2120
movq 0x6f0d(%rip), %rbx      # 0x9fd8
leaq 0x3110(%rip), %rsi      # 0x61e2
movl $0xf, %edx
movq %rbx, %rdi
callq 0x2150
movl 0x787b(%rip), %esi      # 0xa960
movq %rbx, %rdi
callq 0x2210
movq %rax, %r15
leaq 0x30fb(%rip), %rsi      # 0x61f2
movl $0x9, %edx
movq %rax, %rdi
callq 0x2150
leaq 0x3003(%rip), %r14      # 0x610e
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x2150
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
leaq 0x20(%rsp), %rbp
movaps %xmm0, (%rbp)
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x7c50(%rip), %r15      # 0xad90
leaq 0x32ad(%rip), %rsi      # 0x63f4
movq %r15, %rdi
callq 0x5642
movq %r13, (%rax)
leaq 0x329f(%rip), %rsi      # 0x63f8
movq %r15, %rdi
callq 0x5642
movq %rbp, (%rax)
leaq 0x3291(%rip), %rsi      # 0x63fc
movq %r15, %rdi
callq 0x5642
leaq 0x10(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x3266(%rip), %r13      # 0x63e8
xorl %r15d, %r15d
movl (%r15,%r13), %eax
movl %eax, 0x77d5(%rip)      # 0xa964
callq 0x2903
callq 0x2ad3
callq 0x2c62
callq 0x2e43
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2150
addq $0x4, %r15
cmpq $0xc, %r15
jne 0x3185
incl %r12d
cmpl $0xa, %r12d
jne 0x3182
xorl %r14d, %r14d
movl (%r14,%r13), %eax
movl %eax, 0x7791(%rip)      # 0xa964
leaq 0x7bb6(%rip), %rdi      # 0xad90
leaq 0x7783(%rip), %r15      # 0xa964
movq %r15, %rsi
callq 0x5642
movq (%rax), %rax
cvtsi2ssl (%rax), %xmm1
movss 0x2e0c(%rip), %xmm0     # 0x6004
divss %xmm0, %xmm1
movss %xmm1, 0xc(%rsp)
movl 0x775c(%rip), %esi      # 0xa964
movq 0x6dc9(%rip), %rdi      # 0x9fd8
callq 0x2210
movq %rax, %r12
movl $0x30, %edx
movq %rax, %rdi
leaq 0x2fd6(%rip), %rsi      # 0x61fc
callq 0x2150
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rsp), %xmm0
movq %r12, %rdi
callq 0x21d0
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x2ebd(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2eac(%rip), %rsi      # 0x610e
callq 0x2150
leaq 0x7b22(%rip), %rbx      # 0xad90
movq %rbx, %rdi
movq %r15, %rbp
movq %r15, %rsi
callq 0x5642
movq (%rax), %rax
xorps %xmm0, %xmm0
cvtsi2ssl 0x4(%rax), %xmm0
divss 0x2d75(%rip), %xmm0     # 0x6004
movss %xmm0, 0xc(%rsp)
movl 0x76c9(%rip), %esi      # 0xa964
movq 0x6d36(%rip), %r15      # 0x9fd8
movq %r15, %rdi
callq 0x2210
movq %rax, %r12
movl $0x2e, %edx
movq %rax, %rdi
leaq 0x2f71(%rip), %rsi      # 0x622d
callq 0x2150
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rsp), %xmm0
movq %r12, %rdi
callq 0x21d0
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x2e27(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2e16(%rip), %rsi      # 0x610e
callq 0x2150
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5642
movq (%rax), %rax
xorps %xmm0, %xmm0
cvtsi2ssl 0x8(%rax), %xmm0
divss 0x2ce9(%rip), %xmm0     # 0x6004
movss %xmm0, 0xc(%rsp)
movl 0x763d(%rip), %esi      # 0xa964
movq %r15, %rdi
callq 0x2210
movq %rax, %r12
movl $0x30, %edx
movq %rax, %rdi
leaq 0x2f1b(%rip), %rsi      # 0x625c
callq 0x2150
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rsp), %xmm0
movq %r12, %rdi
callq 0x21d0
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x2da2(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2d91(%rip), %rsi      # 0x610e
callq 0x2150
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5642
movq (%rax), %rax
xorps %xmm0, %xmm0
cvtsi2ssl 0xc(%rax), %xmm0
divss 0x2c64(%rip), %xmm0     # 0x6004
movss %xmm0, 0xc(%rsp)
movl 0x75b8(%rip), %esi      # 0xa964
movq %r15, %rdi
callq 0x2210
movq %rax, %r12
movl $0x40, %edx
movq %rax, %rdi
leaq 0x2ec7(%rip), %rsi      # 0x628d
callq 0x2150
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rsp), %xmm0
movq %r12, %rdi
callq 0x21d0
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x2d1d(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2d0c(%rip), %rbx      # 0x610e
movq %rbx, %rsi
callq 0x2150
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2150
addq $0x4, %r14
cmpq $0xc, %r14
jne 0x31c9
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop