// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r13
movq 0x100d8(%rdi), %rax
movq %rcx, -0x48(%rbp)
testq %rcx, %rcx
je 0x13985
testq %rax, %rax
je 0x13848
movq %r14, %rcx
shrq $0x6, %rcx
movl %ecx, %edx
andl $0x3ff, %edx            # imm = 0x3FF
cmpq %rdx, (%rax)
jbe 0x13848
shrl $0x6, %edx
shrxq %rcx, 0x10(%rax,%rdx,8), %rax
andl $0x1, %eax
jmp 0x1384a
xorl %eax, %eax
movq %r12, -0x38(%rbp)
leaq (%rax,%rax,2), %rax
leaq 0x10118(,%rax,8), %rbx
addq %r13, %rbx
movq 0x10(%rbx), %r15
cmpq $0x0, (%rbx)
je 0x13aac
bzhiq %r15, %r14, %rax
shlq $0x6, %rax
addq (%rbx), %rax
movq %rax, -0x30(%rbp)
shrl $0x6, %r14d
andl $0x3ff, %r14d           # imm = 0x3FF
movq %r13, -0x50(%rbp)
leaq 0x50(%r13), %rax
movq %rax, -0x58(%rbp)
decq -0x48(%rbp)
xorl %eax, %eax
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq (%rax,%rdi,8), %r13
cmpq $0xffff, %r13           # imm = 0xFFFF
jbe 0x13a75
movq %rdi, -0x40(%rbp)
shrq $0x10, %r13
movq (%r13), %rax
movq %rax, -0x70(%rbp)
rorxq $0x2d, %rax, %rax
movq %rax, -0x68(%rbp)
xorl %r12d, %r12d
movq -0x70(%rbp,%r12,8), %r15
movl %r15d, %ebx
shrl $0x6, %ebx
andl $0x3ff, %ebx            # imm = 0x3FF
cmpq %r14, %rbx
je 0x13923
shll $0x6, %ebx
addq -0x58(%rbp), %rbx
movq %rbx, %rdi
callq 0x6510
testl %eax, %eax
je 0x13900
cmpl $0x10, %eax
je 0x13923
jmp 0x13acf
movq -0x50(%rbp), %rdi
movq %r15, %rsi
movq %r13, %rdx
movq -0x48(%rbp), %rcx
callq 0x137f2
movl %eax, %r15d
movq %rbx, %rdi
callq 0x6320
testb %r15b, %r15b
jne 0x1394a
incq %r12
cmpq $0x1, %r12
je 0x138cd
movq -0x40(%rbp), %rcx
leaq 0x1(%rcx), %rax
cmpq $0x8, %rax
jne 0x13898
cmpq $0x7, %rcx
setb %al
jmp 0x13a66
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 0x13a4c
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 0x13a4e
testq %rax, %rax
je 0x139ad
movq %r14, %rcx
shrq $0x6, %rcx
movl %ecx, %edx
andl $0x3ff, %edx            # imm = 0x3FF
cmpq %rdx, (%rax)
jbe 0x139ad
shrl $0x6, %edx
shrxq %rcx, 0x10(%rax,%rdx,8), %rax
andl $0x1, %eax
jmp 0x139af
xorl %eax, %eax
leaq (%rax,%rax,2), %rax
leaq 0x10118(,%rax,8), %rbx
addq %r13, %rbx
movq 0x10(%rbx), %r15
cmpq $0x0, (%rbx)
je 0x13ac5
bzhiq %r15, %r14, %rsi
movq (%rbx), %rcx
shlq $0x6, %rsi
movq (%rcx,%rsi), %rdi
cmpq $0x10000, %rdi          # imm = 0x10000
jae 0x139eb
movb $0x1, %al
xorl %edx, %edx
jmp 0x13a1a
leaq (%rsi,%rcx), %rax
addq $0x8, %rax
xorl %edx, %edx
cmpq $0x7, %rdx
je 0x13942
movq (%rax,%rdx,8), %rdi
incq %rdx
cmpq $0xffff, %rdi           # imm = 0xFFFF
ja 0x139f5
leaq -0x1(%rdx), %rax
cmpq $0x7, %rax
setb %al
addq %rsi, %rcx
movq %r12, %rsi
shlq $0x10, %rsi
orq %rsi, %rdi
movq %rdi, (%rcx,%rdx,8)
testq %r12, %r12
je 0x13a5d
movq (%r12), %rdi
movq %rdi, %r8
shrq $0x20, %r8
xorl %edi, %r8d
movl %r8d, %edi
shrl $0x10, %edi
xorl %r8d, %edi
movzwl %di, %edi
jmp 0x13a5f
xorl %ecx, %ecx
orq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax,%rsi,8)
movb $0x1, %al
jmp 0x13a66
xorl %edi, %edi
orq %rsi, %rdi
movq %rdi, (%rcx,%rdx,8)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x30(%rbp), %rsi
movzwl (%rsi,%rdi,8), %ecx
movq -0x38(%rbp), %rdx
movq %rdx, %rax
shlq $0x10, %rax
orq %rax, %rcx
movq %rcx, (%rsi,%rdi,8)
testq %rdx, %rdx
je 0x13ab6
movq (%rdx), %rcx
movq %rcx, %rdx
shrq $0x20, %rdx
xorl %ecx, %edx
movl %edx, %ecx
shrl $0x10, %ecx
xorl %edx, %ecx
movzwl %cx, %ecx
jmp 0x13ab8
callq 0x66ef
jmp 0x1386b
xorl %ecx, %ecx
orq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax,%rdi,8)
jmp 0x13a59
callq 0x66ef
jmp 0x139cc
xorl %edi, %edi
callq 0x6530