// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/libcuckoo/./cuckoohash_map.hh
// Function: cuckoohash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>, 4ul>::cuckoo_status cuckoohash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>, 4ul>::run_cuckoo<std::integral_constant<bool, false>>(cuckoohash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>, 4ul>::TwoBuckets&, unsigned long&, unsigned long&)
cuckoo_status run_cuckoo(TwoBuckets &b, size_type &insert_bucket,
                           size_type &insert_slot) {
    // We must unlock the buckets here, so that cuckoopath_search and
    // cuckoopath_move can lock buckets as desired without deadlock.
    // cuckoopath_move has to move something out of one of the original
    // buckets as its last operation, and it will lock both buckets and
    // leave them locked after finishing. This way, we know that if
    // cuckoopath_move succeeds, then the buckets needed for insertion are
    // still locked. If cuckoopath_move fails, the buckets are unlocked and
    // we try again. This unlocking does present two problems. The first is
    // that another insert on the same key runs and, finding that the key
    // isn't in the table, inserts the key into the table. Then we insert
    // the key into the table, causing a duplication. To check for this, we
    // search the buckets for the key we are trying to insert before doing
    // so (this is done in cuckoo_insert, and requires that both buckets are
    // locked). Another problem is that an expansion runs and changes the
    // hashpower, meaning the buckets may not be valid anymore. In this
    // case, the cuckoopath functions will have thrown a hashpower_changed
    // exception, which we catch and handle here.
    size_type hp = hashpower();
    b.unlock();
    CuckooRecords cuckoo_path;
    bool done = false;
    try {
      while (!done) {
        const int depth =
            cuckoopath_search<TABLE_MODE>(hp, cuckoo_path, b.i1, b.i2);
        if (depth < 0) {
          break;
        }

        if (cuckoopath_move<TABLE_MODE>(hp, cuckoo_path, depth, b)) {
          insert_bucket = cuckoo_path[0].bucket;
          insert_slot = cuckoo_path[0].slot;
          assert(insert_bucket == b.i1 || insert_bucket == b.i2);
          assert(TABLE_MODE() == locked_table_mode() ||
                 !get_current_locks()[lock_ind(b.i1)].try_lock());
          assert(TABLE_MODE() == locked_table_mode() ||
                 !get_current_locks()[lock_ind(b.i2)].try_lock());
          assert(!buckets_[insert_bucket].occupied(insert_slot));
          done = true;
          break;
        }
      }
    } catch (hashpower_changed &) {
      // The hashpower changed while we were trying to cuckoo, which means
      // we want to retry. b.i1 and b.i2 should not be locked
      // in this case.
      return failure_under_expansion;
    }
    return done ? ok : failure;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, (%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq 0x10(%rdi), %r13
movq %rsi, %rdi
callq 0x35fc
leaq 0x8(%rsp), %rbx
pushq $0x1
popq %rbp
movq (%r12), %rcx
movq 0x8(%r12), %r8
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x3620
testl %eax, %eax
js 0x34c3
movl %eax, %ecx
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r12, %r8
callq 0x382a
testb %al, %al
je 0x341e
movq 0x8(%rsp), %rax
movq %rax, (%r15)
movq 0x10(%rsp), %rax
movq (%rsp), %rdi
movq %rax, (%rdi)
movq (%r15), %rcx
movq (%r12), %rax
cmpq %rax, %rcx
je 0x347b
cmpq 0x8(%r12), %rcx
jne 0x34d7
movq 0x28(%r14), %rcx
movzwl %ax, %edx
movq 0x10(%rcx), %rcx
shll $0x6, %edx
movb $0x1, %al
movb $0x1, %sil
xchgb %sil, (%rcx,%rdx)
testb %sil, %sil
je 0x34f6
movq 0x28(%r14), %rcx
movzwl 0x8(%r12), %edx
movq 0x10(%rcx), %rcx
shll $0x6, %edx
xchgb %al, (%rcx,%rdx)
testb %al, %al
je 0x3515
imulq $0x28, (%r15), %rax
addq 0x18(%r14), %rax
movq (%rdi), %rcx
xorl %ebp, %ebp
cmpb $0x1, 0x24(%rcx,%rax)
je 0x3534
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x237b(%rip), %rdi      # 0x5859
leaq 0x1da9(%rip), %rsi      # 0x528e
leaq 0x239c(%rip), %rcx      # 0x5888
movl $0x4f7, %edx            # imm = 0x4F7
callq 0x20f0
leaq 0x2070(%rip), %rdi      # 0x556d
leaq 0x1d8a(%rip), %rsi      # 0x528e
leaq 0x237d(%rip), %rcx      # 0x5888
movl $0x4f9, %edx            # imm = 0x4F9
callq 0x20f0
leaq 0x221e(%rip), %rdi      # 0x573a
leaq 0x1d6b(%rip), %rsi      # 0x528e
leaq 0x235e(%rip), %rcx      # 0x5888
movl $0x4fb, %edx            # imm = 0x4FB
callq 0x20f0
leaq 0x2256(%rip), %rdi      # 0x5791
leaq 0x1d4c(%rip), %rsi      # 0x528e
leaq 0x233f(%rip), %rcx      # 0x5888
movl $0x4fc, %edx            # imm = 0x4FC
callq 0x20f0
movq %rax, %rdi
cmpl $0x1, %edx
jne 0x356d
callq 0x2090
callq 0x21e0
pushq $0x5
popq %rbp
jmp 0x34c3
callq 0x2210