// File: /workspace/github_cpp_makefile_star2_O2/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 $0x18, %rsp
movq %r8, %rbp
movq %rcx, %r13
movq %rdx, %rbx
movq %rdi, %r15
movq %rsi, 0x8(%rsp)
movq %rcx, %rdx
movq %r8, %rcx
callq 0x3b7a
movq %rdx, %r12
movl %r12d, %eax
shrl $0x10, %eax
cmpb $-0x1, %al
je 0x37c1
movsbl %al, %eax
testl %eax, %eax
js 0x3688
movl %r12d, %ecx
andl $0x3, %ecx
movl %eax, %edx
shlq $0x5, %rdx
movq %rcx, 0x8(%rbx,%rdx)
movzwl %r12w, %ecx
shrl $0x2, %ecx
andl $0xffff0000, %r12d      # imm = 0xFFFF0000
orl %ecx, %r12d
decl %eax
jmp 0x365e
testw %r12w, %r12w
je 0x369e
movzwl %r12w, %eax
cmpl $0x1, %eax
jne 0x380a
movq %rbp, %r13
movq %r13, (%rbx)
movq %rsp, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rcx
callq 0x3d66
imulq $0x28, (%rbx), %rax
addq 0x18(%r15), %rax
movq 0x8(%rbx), %rcx
cmpb $0x1, 0x24(%rcx,%rax)
jne 0x37c6
movl (%rax,%rcx,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 (%rsp), %rax
testq %rax, %rax
je 0x36ef
movb $0x0, (%rax)
pushq $-0x1
popq %r14
movq 0x8(%rsp), %rcx
shlq %cl, %r14
shrl $0x10, %r12d
movsbl %r12b, %eax
movl %eax, 0x14(%rsp)
notq %r14
movsbq %r12b, %r12
addq $0x38, %rbx
xorl %ebp, %ebp
pushq $0x1
popq %r13
cmpq %r12, %r13
jg 0x37d6
movq -0x38(%rbx), %rax
movq -0x28(%rbx), %rdx
movq %rdx, %rsi
andq %r14, %rsi
movzbl -0x20(%rbx), %ecx
movabsq $0x46a4a7935bd1e995, %rdi # imm = 0x46A4A7935BD1E995
imulq %rdi, %rcx
addq %rdi, %rcx
cmpq %rsi, %rax
je 0x3758
xorq %rcx, %rdx
andq %r14, %rdx
cmpq %rdx, %rax
jne 0x37eb
xorq %rax, %rcx
andq %r14, %rcx
movq %rcx, -0x18(%rbx)
movq %rsp, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
callq 0x3d66
imulq $0x28, -0x18(%rbx), %rcx
addq 0x18(%r15), %rcx
movq -0x10(%rbx), %rdx
movb 0x24(%rdx,%rcx), %al
testb %al, %al
je 0x37a1
movl (%rcx,%rdx,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 0x37a4
movl %r13d, %ebp
movq (%rsp), %rcx
testq %rcx, %rcx
je 0x37b0
movb $0x0, (%rcx)
incq %r13
addq $0x20, %rbx
testb %al, %al
jne 0x3718
jmp 0x37da
pushq $-0x1
popq %rbp
jmp 0x37da
movq (%rsp), %rax
testq %rax, %rax
je 0x37d2
movb $0x0, (%rax)
xorl %ebp, %ebp
jmp 0x37da
movl 0x14(%rsp), %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2385(%rip), %rdi      # 0x5b77
leaq 0x1a95(%rip), %rsi      # 0x528e
leaq 0x21fb(%rip), %rcx      # 0x59fb
movl $0x538, %edx            # imm = 0x538
callq 0x20f0
leaq 0x21da(%rip), %rdi      # 0x59eb
leaq 0x1a76(%rip), %rsi      # 0x528e
leaq 0x21dc(%rip), %rcx      # 0x59fb
movl $0x527, %edx            # imm = 0x527
callq 0x20f0
nop