// File: /workspace/github_cpp_makefile_star2_O2/chahk0129[P]hash_bench/./index/cuckoo_hash.h
// Function: CuckooHash<char [32]>::find_path[abi:cxx11](unsigned long, bool)
vector<pair<size_t,string>> CuckooHash<Key_t>::find_path(size_t target, bool flag) {
  vector<pair<size_t,string>> path;
  path.reserve(kCuckooThreshold);
  string key_v(table[target].key);
  path.emplace_back(target, key_v);
  auto cur = target;
  auto i = 0;
  do {
    const char* key = table[cur].key;
    if(memcmp(key, INVALID<Key_t>, sizeof(Key_t)) == 0){ 
	    break;
    }
    auto f_hash = hash_funcs[0](key, sizeof(Key_t), _seed);
    auto s_hash = hash_funcs[1](key, sizeof(Key_t), _seed);

    auto f_idx = f_hash % capacity;
    auto s_idx = s_hash % capacity;

    if (f_idx == cur) {
	    string s_idx_key(table[s_idx].key);
	    path.emplace_back(s_idx, s_idx_key);
	    cur = s_idx;
    } else if (s_idx == cur) {
	    string f_idx_key(table[f_idx].key);
	    path.emplace_back(f_idx, f_idx_key);
	    cur = f_idx;
    } else {  // something terribly wrong
	    cout << "E: " << f_idx << " " << s_idx << " " << cur << " " << target << endl;
	    cout << key << endl;
	    exit(1);
    }
    i++;
  } while (i < kCuckooThreshold);

  if (i == kCuckooThreshold) {
    path.resize(0);
  }

  return move(path);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movq %rdx, 0x28(%rsp)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x10(%rsi), %rsi
callq 0x9e5a
imulq $0x28, %rbx, %rbx
addq 0x38(%r14), %rbx
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x65c4
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x9efc
movq %r12, 0x50(%rsp)
leaq 0x58(%rsp), %rdi
callq 0xa10e
leaq 0x30(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x9f38
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
pushq $0x20
popq %rbx
leaq 0xf(%rsp), %r15
leaq 0x58(%rsp), %r12
movq %r15, %r13
imulq $0x28, 0x10(%rsp), %r15
addq 0x38(%r14), %r15
movq %r15, %rdi
leaq 0xaa5a(%rip), %rsi      # 0x142e0
movq %rbx, %rdx
callq 0x2200
testl %eax, %eax
je 0x9995
movq 0x8(%r14), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2040
movq %rbx, %rsi
movq %rax, %rbx
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x82f2
movq %rax, %rsi
movq 0x30(%r14), %rdi
movq %rbx, %rax
xorl %edx, %edx
divq %rdi
movq %rdx, %rcx
movq %rdx, 0x20(%rsp)
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movq %rdx, 0x18(%rsp)
movq 0x10(%rsp), %rax
cmpq %rax, %rcx
jne 0x992a
imulq $0x28, %rdx, %rbx
addq 0x38(%r14), %rbx
movq %r13, %r15
movq %r13, %rdi
callq 0x65c4
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x9efc
movq %r15, %rdi
callq 0xa10e
leaq 0x30(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %r12, %rdx
callq 0x9f38
pushq $0x20
popq %rbx
movq 0x18(%rsp), %rax
jmp 0x9976
cmpq %rax, %rdx
jne 0x99f8
imulq $0x28, %rcx, %rbx
addq 0x38(%r14), %rbx
movq %r13, %r15
movq %r13, %rdi
callq 0x65c4
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x9efc
movq %r15, %rdi
callq 0xa10e
leaq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x9f38
pushq $0x20
popq %rbx
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r12, %rdi
callq 0x20a0
incq %rbp
movq 0x10(%r14), %rax
cmpq %rbp, %rax
ja 0x986f
jmp 0x9999
movq 0x10(%r14), %rax
movslq %ebp, %rcx
cmpq %rcx, %rax
jne 0x99ad
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x9f7a
leaq 0x30(%rsp), %rbx
movaps (%rbx), %xmm0
movq 0x50(%rsp), %r14
movups %xmm0, (%r14)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x78(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x9e38
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa5c1(%rip), %rdi      # 0x13fc0
leaq 0x29ef(%rip), %rsi      # 0xc3f5
callq 0x21d0
movq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x2110
leaq 0x2a42(%rip), %rsi      # 0xc461
movq %rax, %rdi
callq 0x21d0
movq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x2110
leaq 0x2a26(%rip), %rsi      # 0xc461
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x2110
leaq 0x2a0a(%rip), %rsi      # 0xc461
movq %rax, %rdi
callq 0x21d0
movq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
callq 0x20c0
movq 0xa545(%rip), %rdi      # 0x13fc0
movq %r15, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x20c0
pushq $0x1
popq %rdi
callq 0x2210
jmp 0x9acf
jmp 0x9acf
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xa10e
jmp 0x9adc
movq %rax, %rbx
jmp 0x9adc
jmp 0x9acf
jmp 0x9ab1
jmp 0x9ac0
movq %rax, %rbx
leaq 0xf(%rsp), %rdi
callq 0xa10e
jmp 0x9ad2
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x20a0
jmp 0x9ad2
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x20a0
leaq 0x30(%rsp), %rdi
callq 0x9e38
movq %rbx, %rdi
callq 0x2340