// File: bhhbazinga[P]LockFreeHashTable/test.cc
// Function: TestConcurrentFind()
void TestConcurrentFind() {
  std::vector<std::thread> threads;
  for (int i = 0; i < kMaxThreads; ++i) {
    threads.push_back(std::thread(onFind, kMaxThreads));
  }

  start = true;
  auto t1_ = std::chrono::steady_clock::now();
  for (int i = 0; i < kMaxThreads; ++i) {
    threads[i].join();
  }
  auto t2_ = std::chrono::steady_clock::now();

  int ms =
      std::chrono::duration_cast<std::chrono::milliseconds>(t2_ - t1_).count();
  elements2timespan[maxElements][1] += ms;
  std::cout << maxElements << " elements find concurrently, timespan=" << ms
            << "ms"
            << "\n";

  start = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
leaq -0x18(%rbp), %rdi
callq 0x5190
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0x176cc(%rip), %eax     # 0x1a960
jge 0x32fd
leaq -0x3cd(%rip), %rsi      # 0x2ed0
leaq 0x176bc(%rip), %rdx     # 0x1a960
leaq -0x28(%rbp), %rdi
callq 0x51e0
jmp 0x32af
leaq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x51b0
jmp 0x32be
leaq -0x28(%rbp), %rdi
callq 0x52a0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x328b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x347b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x52a0
jmp 0x347b
leaq 0x17a88(%rip), %rdi     # 0x1ad8c
movl $0x1, %esi
callq 0x52d0
callq 0x2180
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x17639(%rip), %eax     # 0x1a960
jge 0x334d
movslq -0x44(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x5300
movq %rax, %rdi
callq 0x21f0
jmp 0x3340
jmp 0x3342
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x331e
callq 0x2180
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x53d0
movq %rax, -0x70(%rbp)
jmp 0x3369
movq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x53a0
movq %rax, -0x78(%rbp)
jmp 0x3380
movq -0x78(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5420
movq %rax, -0x80(%rbp)
jmp 0x3397
movq -0x80(%rbp), %rax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x8c(%rbp)
leaq 0x179e2(%rip), %rdi     # 0x1ad90
leaq 0x175af(%rip), %rsi     # 0x1a964
callq 0x5440
movq %rax, -0x88(%rbp)
jmp 0x33c3
movl -0x8c(%rbp), %edx
movq -0x88(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %ecx
addl %edx, %ecx
movl %ecx, 0x4(%rax)
movl 0x17583(%rip), %esi     # 0x1a964
movq 0x16bf0(%rip), %rdi     # 0x19fd8
callq 0x2200
movq %rax, -0x98(%rbp)
jmp 0x33f6
movq -0x98(%rbp), %rdi
leaq 0xde50(%rip), %rsi      # 0x11254
callq 0x2130
movq %rax, -0xa0(%rbp)
jmp 0x3412
movq -0xa0(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x2200
movq %rax, -0xa8(%rbp)
jmp 0x342a
movq -0xa8(%rbp), %rdi
leaq 0xde17(%rip), %rsi      # 0x1124f
callq 0x2130
movq %rax, -0xb0(%rbp)
jmp 0x3446
movq -0xb0(%rbp), %rdi
leaq 0xddfe(%rip), %rsi      # 0x11252
callq 0x2130
jmp 0x345b
leaq 0x1792a(%rip), %rdi     # 0x1ad8c
xorl %esi, %esi
callq 0x52d0
leaq -0x18(%rbp), %rdi
callq 0x5470
addq $0xb0, %rsp
popq %rbp
retq
leaq -0x18(%rbp), %rdi
callq 0x5470
movq -0x30(%rbp), %rdi
callq 0x2230
nopl (%rax)