// File: /workspace/github_cpp_makefile_star2_O3/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 0x6f87(%rip), %rbx      # 0x9fd8
leaq 0x318a(%rip), %rsi      # 0x61e2
movl $0xf, %edx
movq %rbx, %rdi
callq 0x2150
movl 0x78f5(%rip), %esi      # 0xa960
movq %rbx, %rdi
callq 0x2210
movq %rax, %r15
leaq 0x3175(%rip), %rsi      # 0x61f2
movl $0x9, %edx
movq %rax, %rdi
callq 0x2150
leaq 0x307d(%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 0x7cca(%rip), %r15      # 0xad90
leaq 0x3327(%rip), %rsi      # 0x63f4
movq %r15, %rdi
callq 0x54fa
movq %r13, (%rax)
leaq 0x3319(%rip), %rsi      # 0x63f8
movq %r15, %rdi
callq 0x54fa
movq %rbp, (%rax)
leaq 0x330b(%rip), %rsi      # 0x63fc
movq %r15, %rdi
callq 0x54fa
leaq 0x10(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x32e0(%rip), %r13      # 0x63e8
xorl %r15d, %r15d
movl (%r15,%r13), %eax
movl %eax, 0x784f(%rip)      # 0xa964
callq 0x2889
callq 0x2a59
callq 0x2be8
callq 0x2dc9
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2150
addq $0x4, %r15
cmpq $0xc, %r15
jne 0x310b
incl %r12d
cmpl $0xa, %r12d
jne 0x3108
xorl %r14d, %r14d
movl (%r14,%r13), %eax
movl %eax, 0x780b(%rip)      # 0xa964
leaq 0x7c30(%rip), %rdi      # 0xad90
leaq 0x77fd(%rip), %r15      # 0xa964
movq %r15, %rsi
callq 0x54fa
movq (%rax), %rax
cvtsi2ssl (%rax), %xmm1
movss 0x2e86(%rip), %xmm0     # 0x6004
divss %xmm0, %xmm1
movss %xmm1, 0xc(%rsp)
movl 0x77d6(%rip), %esi      # 0xa964
movq 0x6e43(%rip), %rdi      # 0x9fd8
callq 0x2210
movq %rax, %r12
movl $0x30, %edx
movq %rax, %rdi
leaq 0x3050(%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 0x2f37(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2f26(%rip), %rsi      # 0x610e
callq 0x2150
leaq 0x7b9c(%rip), %rbx      # 0xad90
movq %rbx, %rdi
movq %r15, %rbp
movq %r15, %rsi
callq 0x54fa
movq (%rax), %rax
xorps %xmm0, %xmm0
cvtsi2ssl 0x4(%rax), %xmm0
divss 0x2def(%rip), %xmm0     # 0x6004
movss %xmm0, 0xc(%rsp)
movl 0x7743(%rip), %esi      # 0xa964
movq 0x6db0(%rip), %r15      # 0x9fd8
movq %r15, %rdi
callq 0x2210
movq %rax, %r12
movl $0x2e, %edx
movq %rax, %rdi
leaq 0x2feb(%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 0x2ea1(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2e90(%rip), %rsi      # 0x610e
callq 0x2150
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x54fa
movq (%rax), %rax
xorps %xmm0, %xmm0
cvtsi2ssl 0x8(%rax), %xmm0
divss 0x2d63(%rip), %xmm0     # 0x6004
movss %xmm0, 0xc(%rsp)
movl 0x76b7(%rip), %esi      # 0xa964
movq %r15, %rdi
callq 0x2210
movq %rax, %r12
movl $0x30, %edx
movq %rax, %rdi
leaq 0x2f95(%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 0x2e1c(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2e0b(%rip), %rsi      # 0x610e
callq 0x2150
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x54fa
movq (%rax), %rax
xorps %xmm0, %xmm0
cvtsi2ssl 0xc(%rax), %xmm0
divss 0x2cde(%rip), %xmm0     # 0x6004
movss %xmm0, 0xc(%rsp)
movl 0x7632(%rip), %esi      # 0xa964
movq %r15, %rdi
callq 0x2210
movq %rax, %r12
movl $0x40, %edx
movq %rax, %rdi
leaq 0x2f41(%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 0x2d97(%rip), %rsi      # 0x610b
callq 0x2150
movl $0x1, %edx
movq %r12, %rdi
leaq 0x2d86(%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 0x314f
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop