// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/libcuckoo/./cuckoohash_map.hh
// Function: int cuckoohash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>, 4ul>::cuckoopath_search<std::integral_constant<bool, false>>(unsigned long, std::array<cuckoohash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>, 4ul>::CuckooRecord, 5ul>&, unsigned long, unsigned long)
int cuckoopath_search(const size_type hp, CuckooRecords &cuckoo_path,
                        const size_type i1, const size_type i2) {
    b_slot x = slot_search<TABLE_MODE>(hp, i1, i2);
    if (x.depth == -1) {
      return -1;
    }
    // Fill in the cuckoo path slots from the end to the beginning.
    for (int i = x.depth; i >= 0; i--) {
      cuckoo_path[i].slot = x.pathcode % slot_per_bucket();
      x.pathcode /= slot_per_bucket();
    }
    // Fill in the cuckoo_path buckets and keys from the beginning to the
    // end, using the final pathcode to figure out which bucket the path
    // starts on. Since data could have been modified between slot_search
    // and the computation of the cuckoo path, this could be an invalid
    // cuckoo_path.
    CuckooRecord &first = cuckoo_path[0];
    if (x.pathcode == 0) {
      first.bucket = i1;
    } else {
      assert(x.pathcode == 1);
      first.bucket = i2;
    }
    {
      const auto lock_manager = lock_one(hp, first.bucket, TABLE_MODE());
      const bucket &b = buckets_[first.bucket];
      if (!b.occupied(first.slot)) {
        // We can terminate here
        return 0;
      }
      first.hv = hashed_key(b.key(first.slot));
    }
    for (int i = 1; i <= x.depth; ++i) {
      CuckooRecord &curr = cuckoo_path[i];
      const CuckooRecord &prev = cuckoo_path[i - 1];
      assert(prev.bucket == index_hash(hp, prev.hv.hash) ||
             prev.bucket ==
                 alt_index(hp, prev.hv.partial, index_hash(hp, prev.hv.hash)));
      // We get the bucket that this slot is on by computing the alternate
      // index of the previous bucket
      curr.bucket = alt_index(hp, prev.hv.partial, prev.bucket);
      const auto lock_manager = lock_one(hp, curr.bucket, TABLE_MODE());
      const bucket &b = buckets_[curr.bucket];
      if (!b.occupied(curr.slot)) {
        // We can terminate here
        return i;
      }
      curr.hv = hashed_key(b.key(curr.slot));
    }
    return x.depth;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbp
movq %rcx, %r13
movq %rdx, %rbx
movq %rdi, %r15
movq %rsi, 0x18(%rsp)
movq %rcx, %rdx
movq %r8, %rcx
callq 0x3be8
movq %rdx, %r12
movl %r12d, %eax
shrl $0x10, %eax
cmpb $-0x1, %al
je 0x3876
movsbl %al, %eax
testl %eax, %eax
js 0x3712
movl %eax, %eax
shlq $0x5, %rax
movl %r12d, %ecx
andl $0x3, %ecx
movq %rcx, 0x8(%rbx,%rax)
movzwl %r12w, %ecx
shrl $0x2, %ecx
andl $0xffff0000, %r12d      # imm = 0xFFFF0000
orl %ecx, %r12d
addq $-0x20, %rax
cmpq $-0x20, %rax
jne 0x36ec
testw %r12w, %r12w
je 0x3728
movzwl %r12w, %eax
cmpl $0x1, %eax
jne 0x38c0
movq %rbp, %r13
movq %r13, (%rbx)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
callq 0x3db0
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
leaq (%rcx,%rcx,4), %rcx
shlq $0x3, %rcx
addq 0x18(%r15), %rcx
cmpb $0x1, 0x24(%rax,%rcx)
jne 0x387d
movl (%rcx,%rax,8), %eax
movl %eax, %ecx
shrl $0x10, %ecx
xorl %eax, %ecx
movl %ecx, %edx
shrl $0x8, %edx
xorl %ecx, %edx
movq %rax, 0x10(%rbx)
movb %dl, 0x18(%rbx)
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x3783
movb $0x0, (%rax)
shrl $0x10, %r12d
movsbl %r12b, %eax
testl %eax, %eax
jle 0x3892
movq $-0x1, %rbp
movq 0x18(%rsp), %rcx
shlq %cl, %rbp
movabsq $0x46a4a7935bd1e995, %r13 # imm = 0x46A4A7935BD1E995
notq %rbp
movq %rax, 0x20(%rsp)
leal 0x1(%rax), %r12d
addq $0x38, %rbx
movl $0x0, 0xc(%rsp)
movl $0x1, %r14d
movq -0x38(%rbx), %rax
movq -0x28(%rbx), %rdx
movq %rdx, %rsi
andq %rbp, %rsi
movzbl -0x20(%rbx), %ecx
imulq %r13, %rcx
addq %r13, %rcx
cmpq %rsi, %rax
je 0x37f7
xorq %rcx, %rdx
andq %rbp, %rdx
cmpq %rdx, %rax
jne 0x38a1
xorq %rax, %rcx
andq %rbp, %rcx
movq %rcx, -0x18(%rbx)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq 0x18(%rsp), %rdx
callq 0x3db0
movq -0x18(%rbx), %rax
movq -0x10(%rbx), %rcx
leaq (%rax,%rax,4), %rdx
shlq $0x3, %rdx
addq 0x18(%r15), %rdx
movb 0x24(%rcx,%rdx), %al
testb %al, %al
je 0x3849
movl (%rdx,%rcx,8), %ecx
movl %ecx, %edx
shrl $0x10, %edx
xorl %ecx, %edx
movl %edx, %esi
shrl $0x8, %esi
xorl %edx, %esi
movq %rcx, -0x8(%rbx)
movb %sil, (%rbx)
jmp 0x384e
movl %r14d, 0xc(%rsp)
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x385b
movb $0x0, (%rcx)
testb %al, %al
je 0x388e
incq %r14
addq $0x20, %rbx
cmpq %r14, %r12
jne 0x37ca
movq 0x20(%rsp), %rax
jmp 0x3892
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3892
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x388a
movb $0x0, (%rax)
xorl %eax, %eax
jmp 0x3892
movl 0xc(%rsp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x22bf(%rip), %rdi      # 0x5b67
leaq 0x19cf(%rip), %rsi      # 0x527e
leaq 0x2135(%rip), %rcx      # 0x59eb
movl $0x538, %edx            # imm = 0x538
callq 0x20f0
leaq 0x2114(%rip), %rdi      # 0x59db
leaq 0x19b0(%rip), %rsi      # 0x527e
leaq 0x2116(%rip), %rcx      # 0x59eb
movl $0x527, %edx            # imm = 0x527
callq 0x20f0
nop