// File: 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:
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x148(%rsp)
movq %rsi, 0x140(%rsp)
movq %rdx, 0x138(%rsp)
movq %rcx, 0x130(%rsp)
movq %r8, 0x128(%rsp)
movq 0x148(%rsp), %rdi
movq %rdi, 0x78(%rsp)
movq 0x140(%rsp), %rsi
movq 0x130(%rsp), %rdx
movq 0x128(%rsp), %rcx
callq 0x7120
movq %rdx, 0x110(%rsp)
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x118(%rsp)
movw 0x110(%rsp), %ax
movw %ax, 0x120(%rsp)
movb 0x112(%rsp), %al
movb %al, 0x122(%rsp)
movsbl 0x122(%rsp), %eax
cmpl $-0x1, %eax
jne 0x6524
movl $0xffffffff, 0x154(%rsp) # imm = 0xFFFFFFFF
jmp 0x6a47
movsbl 0x122(%rsp), %eax
movl %eax, 0x104(%rsp)
cmpl $0x0, 0x104(%rsp)
jl 0x65af
movzwl 0x120(%rsp), %eax
movq %rax, 0x68(%rsp)
callq 0x3ce0
movq %rax, %rcx
movq 0x68(%rsp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, 0x70(%rsp)
movq 0x138(%rsp), %rdi
movslq 0x104(%rsp), %rsi
callq 0x6fd0
movq 0x70(%rsp), %rdx
movq %rdx, 0x8(%rax)
callq 0x3ce0
movq %rax, %rcx
movzwl 0x120(%rsp), %eax
xorl %edx, %edx
divq %rcx
movw %ax, 0x120(%rsp)
movl 0x104(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x104(%rsp)
jmp 0x6533
movq 0x138(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6fd0
movq %rax, 0xf8(%rsp)
movzwl 0x120(%rsp), %eax
cmpl $0x0, %eax
jne 0x65ea
movq 0x130(%rsp), %rcx
movq 0xf8(%rsp), %rax
movq %rcx, (%rax)
jmp 0x662b
movzwl 0x120(%rsp), %eax
cmpl $0x1, %eax
jne 0x65f9
jmp 0x6618
leaq 0x840b(%rip), %rdi      # 0xea0b
leaq 0x7ca7(%rip), %rsi      # 0xe2ae
movl $0x527, %edx            # imm = 0x527
leaq 0x8408(%rip), %rcx      # 0xea1b
callq 0x2110
movq 0x128(%rsp), %rcx
movq 0xf8(%rsp), %rax
movq %rcx, (%rax)
movq 0x78(%rsp), %rsi
movq 0x140(%rsp), %rdx
movq 0xf8(%rsp), %rax
movq (%rax), %rcx
leaq 0xf0(%rsp), %rdi
callq 0x74e0
movq 0x78(%rsp), %rdi
addq $0x8, %rdi
movq 0xf8(%rsp), %rax
movq (%rax), %rsi
callq 0x4db0
movq %rax, 0x60(%rsp)
jmp 0x6670
movq 0x60(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rdi
movq 0xf8(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x6300
testb $0x1, %al
jne 0x66db
movl $0x0, 0x154(%rsp)
movl $0x1, 0xd0(%rsp)
jmp 0x6758
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7580
jmp 0x6a56
movq 0xe0(%rsp), %rdi
movq 0xf8(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x6370
movq %rax, 0x58(%rsp)
jmp 0x66fb
movq 0x58(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x4a60
movb %dl, 0x4f(%rsp)
movq %rax, 0x50(%rsp)
jmp 0x6715
movb 0x4f(%rsp), %al
movq 0x50(%rsp), %rcx
movq %rcx, 0xc0(%rsp)
movb %al, 0xc8(%rsp)
movq 0xf8(%rsp), %rax
movq 0xc0(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq 0xc8(%rsp), %rcx
movq %rcx, 0x18(%rax)
movl $0x0, 0xd0(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7580
movl 0xd0(%rsp), %eax
testl %eax, %eax
je 0x6777
jmp 0x6772
jmp 0x6a47
movl $0x1, 0xbc(%rsp)
movl 0xbc(%rsp), %eax
movsbl 0x122(%rsp), %ecx
cmpl %ecx, %eax
jg 0x6a38
movq 0x138(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x6fd0
movq %rax, 0xb0(%rsp)
movq 0x138(%rsp), %rdi
movl 0xbc(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x6fd0
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x140(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x4f50
movq 0x40(%rsp), %rcx
movq %rax, %rdx
movb $0x1, %al
cmpq %rdx, %rcx
movb %al, 0x4e(%rsp)
je 0x687f
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xa8(%rsp), %rax
movb 0x18(%rax), %al
movb %al, 0x37(%rsp)
movq 0x140(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x4f50
movq 0x28(%rsp), %rdi
movq %rax, %rdx
movb 0x37(%rsp), %al
movzbl %al, %esi
callq 0x4f80
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
sete %al
movb %al, 0x4e(%rsp)
movb 0x4e(%rsp), %al
testb $0x1, %al
jne 0x6889
jmp 0x688b
jmp 0x68aa
leaq 0x8305(%rip), %rdi      # 0xeb97
leaq 0x7a15(%rip), %rsi      # 0xe2ae
movl $0x538, %edx            # imm = 0x538
leaq 0x8176(%rip), %rcx      # 0xea1b
callq 0x2110
movq 0x140(%rsp), %rdi
movq 0xa8(%rsp), %rax
movzbl 0x18(%rax), %esi
movq (%rax), %rdx
callq 0x4f80
movq 0x78(%rsp), %rsi
movq %rax, %rcx
movq 0xb0(%rsp), %rax
movq %rcx, (%rax)
movq 0x140(%rsp), %rdx
movq 0xb0(%rsp), %rax
movq (%rax), %rcx
leaq 0xa0(%rsp), %rdi
callq 0x74e0
movq 0x78(%rsp), %rdi
addq $0x8, %rdi
movq 0xb0(%rsp), %rax
movq (%rax), %rsi
callq 0x4db0
movq %rax, 0x20(%rsp)
jmp 0x6919
movq 0x20(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rdi
movq 0xb0(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x6300
testb $0x1, %al
jne 0x6987
movl 0xbc(%rsp), %eax
movl %eax, 0x154(%rsp)
movl $0x1, 0xd0(%rsp)
jmp 0x6a04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7580
jmp 0x6a56
movq 0x90(%rsp), %rdi
movq 0xb0(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x6370
movq %rax, 0x18(%rsp)
jmp 0x69a7
movq 0x18(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x4a60
movb %dl, 0xf(%rsp)
movq %rax, 0x10(%rsp)
jmp 0x69c1
movb 0xf(%rsp), %al
movq 0x10(%rsp), %rcx
movq %rcx, 0x80(%rsp)
movb %al, 0x88(%rsp)
movq 0xb0(%rsp), %rax
movq 0x80(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq 0x88(%rsp), %rcx
movq %rcx, 0x18(%rax)
movl $0x0, 0xd0(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7580
movl 0xd0(%rsp), %eax
testl %eax, %eax
je 0x6a20
jmp 0x6a1e
jmp 0x6a47
jmp 0x6a22
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0x6782
movsbl 0x122(%rsp), %eax
movl %eax, 0x154(%rsp)
movl 0x154(%rsp), %eax
addq $0x158, %rsp            # imm = 0x158
retq
movq 0xd8(%rsp), %rdi
callq 0x2240
nopw %cs:(%rax,%rax)
nopl (%rax)