// File: bhhbazinga[P]LockFreeHashTable/./HazardPointer/reclaimer.h
// Function: Reclaimer::ReclaimNoHazardPointer()
void Reclaimer::ReclaimNoHazardPointer() {
  if (reclaim_map_.size() < kCoefficient * global_hp_list_.get_size()) {
    return;
  }

  // Used to speed up the inspection of the ptr.
  std::unordered_set<void*> not_allow_delete_set;
  std::atomic<InternalHazardPointer*>& head = global_hp_list_.head;
  InternalHazardPointer* p = head.load(std::memory_order_acquire);
  do {
    void* const ptr = p->ptr.load(std::memory_order_consume);
    if (nullptr != ptr) {
      not_allow_delete_set.insert(ptr);
    }
    p = p->next.load(std::memory_order_acquire);
  } while (p);

  for (auto it = reclaim_map_.begin(); it != reclaim_map_.end();) {
    if (not_allow_delete_set.find(it->first) == not_allow_delete_set.end()) {
      ReclaimNode* node = it->second;
      node->delete_func(node->ptr);
      reclaim_pool_.Push(node);
      it = reclaim_map_.erase(it);
    } else {
      ++it;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
addq $0x20, %rdi
callq 0x4240
movq %rax, %rcx
movq -0xc0(%rbp), %rax
movq %rcx, -0xb8(%rbp)
movq 0x60(%rax), %rdi
callq 0x4260
movq %rax, %rcx
movq -0xb8(%rbp), %rax
shlq $0x2, %rcx
cmpq %rcx, %rax
jae 0x2c35
jmp 0x2e28
leaq -0x40(%rbp), %rdi
callq 0x42e0
movq -0xc0(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movl $0x2, %esi
callq 0x4300
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x3ec0
movq %rax, -0x58(%rbp)
xorl %eax, %eax
cmpq -0x58(%rbp), %rax
je 0x2cc9
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4380
movb %dl, -0xc9(%rbp)
movq %rax, -0xc8(%rbp)
jmp 0x2c99
movb -0xc9(%rbp), %al
movq -0xc8(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movb %al, -0x70(%rbp)
jmp 0x2cc9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x44b0
jmp 0x2e31
movq -0x50(%rbp), %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x4300
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x2c5f
movq -0xc0(%rbp), %rdi
addq $0x20, %rdi
callq 0x3f40
movq %rax, -0x80(%rbp)
movq -0xc0(%rbp), %rdi
addq $0x20, %rdi
callq 0x3fa0
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3f70
testb $0x1, %al
jne 0x2d2e
jmp 0x2e1f
leaq -0x80(%rbp), %rdi
callq 0x3fd0
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x43f0
movq %rax, -0xd8(%rbp)
jmp 0x2d4c
movq -0xd8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4420
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x43c0
testb $0x1, %al
jne 0x2d86
jmp 0x2e11
leaq -0x80(%rbp), %rdi
callq 0x3fd0
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movq (%rax), %rsi
callq 0x4030
jmp 0x2db2
movq -0xc0(%rbp), %rdi
addq $0x58, %rdi
movq -0xa0(%rbp), %rsi
callq 0x4450
jmp 0x2dcb
movq -0xc0(%rbp), %rdi
addq $0x20, %rdi
movq -0x80(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rsi
callq 0x4090
movq %rax, -0xe0(%rbp)
jmp 0x2df6
movq -0xe0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x2e1a
leaq -0x80(%rbp), %rdi
callq 0x4480
jmp 0x2cfe
leaq -0x40(%rbp), %rdi
callq 0x44b0
addq $0xe0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x2230
nopw (%rax,%rax)