// File: /workspace/github_cpp_makefile_star2_O2/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 %r13d, %r13d
xorl %edi, %edi
callq 0x2120
movl %eax, %edi
callq 0x2130
movq 0x7169(%rip), %rbx      # 0x9fd8
leaq 0x3394(%rip), %rsi      # 0x620a
movq %rbx, %rdi
callq 0x2140
movl 0x7adc(%rip), %esi      # 0xa960
movq %rax, %rdi
callq 0x2210
leaq 0x3387(%rip), %rsi      # 0x621a
movq %rax, %rdi
callq 0x2140
leaq 0x3294(%rip), %r14      # 0x6136
movq %rax, %rdi
movq %r14, %rsi
callq 0x2140
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0x20(%rsp), %rbp
movaps %xmm0, (%rbp)
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x7ebe(%rip), %r15      # 0xad90
leaq 0x3543(%rip), %rsi      # 0x641c
movq %r15, %rdi
callq 0x549a
movq %r12, (%rax)
leaq 0x3535(%rip), %rsi      # 0x6420
movq %r15, %rdi
callq 0x549a
movq %rbp, (%rax)
leaq 0x3527(%rip), %rsi      # 0x6424
movq %r15, %rdi
callq 0x549a
leaq 0x10(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x34fc(%rip), %r12      # 0x6410
cmpl $0xa, %r13d
je 0x2f57
xorl %r15d, %r15d
cmpq $0xc, %r15
je 0x2f52
movl (%r15,%r12), %eax
movl %eax, 0x7a37(%rip)      # 0xa964
callq 0x27a8
callq 0x293b
callq 0x2a8f
callq 0x2c33
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
addq $0x4, %r15
jmp 0x2f1d
incl %r13d
jmp 0x2f14
xorl %eax, %eax
cmpq $0xc, %rax
je 0x314a
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl (%rax,%r12), %eax
movl %eax, 0x79ed(%rip)      # 0xa964
leaq 0x7e12(%rip), %rdi      # 0xad90
leaq 0x79df(%rip), %rsi      # 0xa964
callq 0x549a
movq (%rax), %rax
cvtsi2ssl (%rax), %xmm1
movss 0x306b(%rip), %xmm0     # 0x6004
divss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
movl 0x79bb(%rip), %esi      # 0xa964
movq 0x7028(%rip), %rbx      # 0x9fd8
movq %rbx, %rdi
callq 0x2210
movq %rax, %rdi
leaq 0x3262(%rip), %rsi      # 0x6224
callq 0x2140
movq %rax, %rdi
movss 0x4(%rsp), %xmm0
callq 0x20d0
movq %rax, %rdi
leaq 0x3154(%rip), %r13      # 0x6133
movq %r13, %rsi
callq 0x2140
movq %rax, %rdi
leaq 0x3145(%rip), %r14      # 0x6136
movq %r14, %rsi
callq 0x2140
leaq 0x7d90(%rip), %rbp      # 0xad90
movq %rbp, %rdi
leaq 0x795a(%rip), %r15      # 0xa964
movq %r15, %rsi
callq 0x549a
movq (%rax), %rax
cvtsi2ssl 0x4(%rax), %xmm0
divss 0x2fe2(%rip), %xmm0     # 0x6004
movss %xmm0, 0x4(%rsp)
movl 0x7936(%rip), %esi      # 0xa964
movq %rbx, %rdi
callq 0x2210
movq %rax, %rdi
leaq 0x3215(%rip), %rsi      # 0x6255
callq 0x2140
movq %rax, %rdi
movss 0x4(%rsp), %xmm0
callq 0x20d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x2140
movq %rax, %rdi
movq %r14, %rsi
callq 0x2140
movq %rbp, %rdi
movq %r15, %rsi
callq 0x549a
movq (%rax), %rax
cvtsi2ssl 0x8(%rax), %xmm0
divss 0x2f80(%rip), %xmm0     # 0x6004
movss %xmm0, 0x4(%rsp)
movl 0x78d4(%rip), %esi      # 0xa964
movq %rbx, %rdi
callq 0x2210
movq %rax, %rdi
leaq 0x31e2(%rip), %rsi      # 0x6284
callq 0x2140
movq %rax, %rdi
movss 0x4(%rsp), %xmm0
callq 0x20d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x2140
movq %rax, %rdi
movq %r14, %rsi
callq 0x2140
movq %rbp, %rdi
leaq 0x788f(%rip), %rsi      # 0xa964
callq 0x549a
movq (%rax), %rax
cvtsi2ssl 0xc(%rax), %xmm0
divss 0x2f1a(%rip), %xmm0     # 0x6004
movss %xmm0, 0x4(%rsp)
movl 0x786e(%rip), %esi      # 0xa964
movq %rbx, %rdi
callq 0x2210
movq %rax, %rdi
leaq 0x31ad(%rip), %rsi      # 0x62b5
callq 0x2140
movq %rax, %rdi
movss 0x4(%rsp), %xmm0
callq 0x20d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x2140
movq %rax, %rdi
movq %r14, %rsi
callq 0x2140
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
movq 0x8(%rsp), %rax
addq $0x4, %rax
jmp 0x2f59
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop