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

  cnt = 0;
  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();

  assert(cnt + old_size == static_cast<int>(ht.size()));
  int ms =
      std::chrono::duration_cast<std::chrono::milliseconds>(t2_ - t1_).count();
  elements2timespan[maxElements][2] += ms;
  std::cout << maxElements << " elements delete concurrently, timespan=" << ms
            << "ms"
            << "\n";

  cnt = 0;
  start = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
leaq 0x174c6(%rip), %rdi     # 0x1a968
callq 0x5110
movl %eax, -0x4(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5190
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl 0x1749d(%rip), %eax     # 0x1a960
jge 0x352c
leaq -0x57c(%rip), %rsi      # 0x2f50
leaq 0x1748d(%rip), %rdx     # 0x1a960
leaq -0x30(%rbp), %rdi
callq 0x51e0
jmp 0x34de
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x51b0
jmp 0x34ed
leaq -0x30(%rbp), %rdi
callq 0x52a0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x34ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x372a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x52a0
jmp 0x372a
leaq 0x17855(%rip), %rdi     # 0x1ad88
xorl %esi, %esi
callq 0x54d0
leaq 0x1784b(%rip), %rdi     # 0x1ad8c
movl $0x1, %esi
callq 0x52d0
callq 0x2180
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl 0x173fc(%rip), %eax     # 0x1a960
jge 0x358a
movslq -0x4c(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x5300
movq %rax, %rdi
callq 0x21f0
jmp 0x357d
jmp 0x357f
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x355b
callq 0x2180
movq %rax, -0x58(%rbp)
leaq 0x177ee(%rip), %rdi     # 0x1ad88
callq 0x5320
movl -0x4(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x7c(%rbp)
leaq 0x173ba(%rip), %rdi     # 0x1a968
callq 0x5110
movq %rax, -0x78(%rbp)
jmp 0x35b9
movl -0x7c(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl %ecx, %eax
jne 0x35c6
jmp 0x35e5
leaq 0xdc07(%rip), %rdi      # 0x111d4
leaq 0xdc2e(%rip), %rsi      # 0x11202
movl $0x7a, %edx
leaq 0xdc9b(%rip), %rcx      # 0x1127b
callq 0x20c0
leaq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x53d0
movq %rax, -0x88(%rbp)
jmp 0x35fb
movq -0x88(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x53a0
movq %rax, -0x90(%rbp)
jmp 0x3618
movq -0x90(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5420
movq %rax, -0x98(%rbp)
jmp 0x3635
movq -0x98(%rbp), %rax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0xa4(%rbp)
leaq 0x17741(%rip), %rdi     # 0x1ad90
leaq 0x1730e(%rip), %rsi     # 0x1a964
callq 0x5440
movq %rax, -0xa0(%rbp)
jmp 0x3664
movl -0xa4(%rbp), %edx
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %ecx
addl %edx, %ecx
movl %ecx, 0x8(%rax)
movl 0x172e2(%rip), %esi     # 0x1a964
movq 0x1694f(%rip), %rdi     # 0x19fd8
callq 0x2200
movq %rax, -0xb0(%rbp)
jmp 0x3697
movq -0xb0(%rbp), %rdi
leaq 0xdbf2(%rip), %rsi      # 0x11297
callq 0x2130
movq %rax, -0xb8(%rbp)
jmp 0x36b3
movq -0xb8(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x2200
movq %rax, -0xc0(%rbp)
jmp 0x36cb
movq -0xc0(%rbp), %rdi
leaq 0xdb76(%rip), %rsi      # 0x1124f
callq 0x2130
movq %rax, -0xc8(%rbp)
jmp 0x36e7
movq -0xc8(%rbp), %rdi
leaq 0xdb5d(%rip), %rsi      # 0x11252
callq 0x2130
jmp 0x36fc
leaq 0x17685(%rip), %rdi     # 0x1ad88
xorl %esi, %esi
callq 0x54d0
leaq 0x1767b(%rip), %rdi     # 0x1ad8c
xorl %esi, %esi
callq 0x52d0
leaq -0x20(%rbp), %rdi
callq 0x5470
addq $0xd0, %rsp
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x5470
movq -0x38(%rbp), %rdi
callq 0x2230
nopl (%rax)