// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: cuckoo_cuckoo_depth
static bool
cuckoo_cuckoo_depth(struct cuckoo * const map, const u64 hash, const struct kv * const kv, const u64 max_cuckoo)
{
  if (max_cuckoo == 0) {
    return cuckoo_cuckoo_local(map, hash, kv);
  }

  struct __kvmap_slot * const slot = cuckoo_hash_slot(map, hash);
  const u64 lidx0 = kvmap_hlocks_index(hash);
  for (u64 k = 0; k < 8; k++) {
    if (slot->e[k].ptr == 0) { // some slots may be released by other threads
      //cuckoo_put_entry(map, &(slot->e[k]), kv);
      kvmap_put_entry(&(map->mm), &(slot->e[k]), kv);
      return true;
    }
    const struct kv * const curr = __u64_to_ptr(slot->e[k].ptr);
    const u64 hash2[2] = {cuckoo_hash(curr, 0), cuckoo_hash(curr, 1), };
    for (u64 x = 0; x < 2; x++) {
      const u64 lidx1 = kvmap_hlocks_index(hash2[x]);
      if ((lidx1 != lidx0) && (cuckoo_trylock(map, lidx1))) {
        const bool r = cuckoo_cuckoo_depth(map, hash2[x], curr, max_cuckoo - 1lu);
        cuckoo_unlock(map, lidx1);
        if (r) {
          slot->e[k].ptr = 0;
          slot->e[k].pkey = 0;
          //cuckoo_put_entry(map, &(slot->e[k]), kv);
          kvmap_put_entry(&(map->mm), &(slot->e[k]), kv);
          return true;
        }
      }
    }
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r12
movq 0x100d8(%rdi), %rax
movq %rcx, -0x48(%rbp)
testq %rcx, %rcx
je 0x13413
testq %rax, %rax
je 0x132e1
movq %r13, %rcx
shrq $0x6, %rcx
movl %ecx, %edx
andl $0x3ff, %edx            # imm = 0x3FF
cmpq %rdx, (%rax)
jbe 0x132e1
shrl $0x6, %edx
shrxq %rcx, 0x10(%rax,%rdx,8), %rax
andl $0x1, %eax
jmp 0x132e3
xorl %eax, %eax
movq %r15, -0x38(%rbp)
leaq (%rax,%rax,2), %rcx
movq 0x10118(%r12,%rcx,8), %rax
movq 0x10128(%r12,%rcx,8), %rbx
testq %rax, %rax
je 0x13513
bzhiq %rbx, %r13, %rcx
shlq $0x6, %rcx
addq %rax, %rcx
movq %rcx, -0x30(%rbp)
shrl $0x6, %r13d
andl $0x3ff, %r13d           # imm = 0x3FF
leaq 0x50(%r12), %rax
movq %rax, -0x60(%rbp)
decq -0x48(%rbp)
xorl %edi, %edi
movq %r12, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq (%rax,%rdi,8), %r8
cmpq $0xffff, %r8            # imm = 0xFFFF
jbe 0x134e0
movq %rdi, -0x40(%rbp)
shrq $0x10, %r8
movq %r8, -0x58(%rbp)
movq (%r8), %r15
rorxq $0x2d, %r15, %r14
movb $0x1, %r12b
movl %r15d, %ebx
shrl $0x6, %ebx
andl $0x3ff, %ebx            # imm = 0x3FF
cmpq %r13, %rbx
je 0x133b1
shll $0x6, %ebx
addq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x6510
testl %eax, %eax
je 0x1338d
cmpl $0x10, %eax
je 0x133b1
jmp 0x13561
movq -0x50(%rbp), %rdi
movq %r15, %rsi
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0x1328b
movl %eax, %r15d
movq %rbx, %rdi
callq 0x6320
testb %r15b, %r15b
jne 0x133d8
movq %r14, %r15
testb $0x1, %r12b
movl $0x0, %r12d
jne 0x1335f
movq -0x40(%rbp), %rdi
incq %rdi
cmpq $0x8, %rdi
jne 0x13332
xorl %eax, %eax
jmp 0x1353a
movq -0x38(%rbp), %rcx
movq %rcx, %rax
shlq $0x10, %rax
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rsi
movq %rax, (%rdx,%rsi,8)
testq %rcx, %rcx
je 0x134c6
movq (%rcx), %rcx
movq %rcx, %rdx
shrq $0x20, %rdx
xorl %ecx, %edx
movl %edx, %ecx
shrl $0x10, %ecx
xorl %edx, %ecx
movzwl %cx, %ecx
jmp 0x134c8
testq %rax, %rax
je 0x1343b
movq %r13, %rcx
shrq $0x6, %rcx
movl %ecx, %edx
andl $0x3ff, %edx            # imm = 0x3FF
cmpq %rdx, (%rax)
jbe 0x1343b
shrl $0x6, %edx
shrxq %rcx, 0x10(%rax,%rdx,8), %rax
andl $0x1, %eax
jmp 0x1343d
xorl %eax, %eax
leaq (%rax,%rax,2), %rcx
movq 0x10118(%r12,%rcx,8), %rax
movq 0x10128(%r12,%rcx,8), %rbx
testq %rax, %rax
je 0x13549
bzhiq %rbx, %r13, %rdx
shlq $0x6, %rdx
movq (%rax,%rdx), %rsi
cmpq $0x10000, %rsi          # imm = 0x10000
jae 0x13474
xorl %ecx, %ecx
jmp 0x13498
leaq (%rdx,%rax), %rdi
addq $0x8, %rdi
xorl %ecx, %ecx
cmpq $0x7, %rcx
je 0x133d1
movq (%rdi,%rcx,8), %rsi
incq %rcx
cmpq $0xffff, %rsi           # imm = 0xFFFF
ja 0x1347e
addq %rdx, %rax
movq %r15, %rdx
shlq $0x10, %rdx
orq %rdx, %rsi
movq %rsi, (%rax,%rcx,8)
testq %r15, %r15
je 0x134d5
movq (%r15), %rsi
movq %rsi, %rdi
shrq $0x20, %rdi
xorl %esi, %edi
movl %edi, %esi
shrl $0x10, %esi
xorl %edi, %esi
movzwl %si, %esi
jmp 0x134d7
xorl %ecx, %ecx
orq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax,%rsi,8)
jmp 0x13538
xorl %esi, %esi
orq %rdx, %rsi
movq %rsi, (%rax,%rcx,8)
jmp 0x13538
movq -0x38(%rbp), %rcx
movq %rcx, %rax
shlq $0x10, %rax
orq %rax, %r8
movq -0x30(%rbp), %rdx
movq %r8, (%rdx,%rdi,8)
testq %rcx, %rcx
je 0x1352b
movq (%rcx), %rcx
movq %rcx, %rdx
shrq $0x20, %rdx
xorl %ecx, %edx
movl %edx, %ecx
shrl $0x10, %ecx
xorl %edx, %ecx
movzwl %cx, %ecx
jmp 0x1352d
leaq (%r12,%rcx,8), %r14
addq $0x10118, %r14          # imm = 0x10118
callq 0x66ef
movq (%r14), %rax
jmp 0x13304
xorl %ecx, %ecx
orq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax,%rdi,8)
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%r12,%rcx,8), %r14
addq $0x10118, %r14          # imm = 0x10118
callq 0x66ef
movq (%r14), %rax
jmp 0x1345a
xorl %edi, %edi
callq 0x6530