// File: /workspace/github_cpp_makefile_star2_O3/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, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq 0x10(%rdi), %r13
movq 0x10(%rsi), %rax
movq $0x0, 0x10(%rsi)
testq %rax, %rax
je 0x34b3
movb $0x0, (%rax)
movq 0x18(%r12), %rax
movq $0x0, 0x18(%r12)
testq %rax, %rax
je 0x34c9
movb $0x0, (%rax)
leaq 0x8(%rsp), %rbp
movq (%r12), %rcx
movq 0x8(%r12), %r8
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x36a4
testl %eax, %eax
js 0x35a1
movl %eax, %ecx
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r12, %r8
callq 0x38e0
testb %al, %al
je 0x34ce
movq 0x8(%rsp), %rax
movq %rax, (%r15)
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
movq (%r15), %rcx
movq (%r12), %rax
cmpq %rax, %rcx
je 0x352b
cmpq 0x8(%r12), %rcx
jne 0x35b8
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 0x35d7
movq 0x28(%r14), %rcx
movzwl 0x8(%r12), %edx
movq 0x10(%rcx), %rcx
shll $0x6, %edx
xchgb %al, (%rcx,%rdx)
testb %al, %al
je 0x35f6
movq (%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x3, %rcx
addq 0x18(%r14), %rcx
movq (%rbx), %rdx
xorl %eax, %eax
cmpb $0x1, 0x24(%rdx,%rcx)
jne 0x35a6
leaq 0x21f8(%rip), %rdi      # 0x5781
leaq 0x1cee(%rip), %rsi      # 0x527e
leaq 0x22e1(%rip), %rcx      # 0x5878
movl $0x4fc, %edx            # imm = 0x4FC
callq 0x20f0
movl $0x1, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x228a(%rip), %rdi      # 0x5849
leaq 0x1cb8(%rip), %rsi      # 0x527e
leaq 0x22ab(%rip), %rcx      # 0x5878
movl $0x4f7, %edx            # imm = 0x4F7
callq 0x20f0
leaq 0x1f7f(%rip), %rdi      # 0x555d
leaq 0x1c99(%rip), %rsi      # 0x527e
leaq 0x228c(%rip), %rcx      # 0x5878
movl $0x4f9, %edx            # imm = 0x4F9
callq 0x20f0
leaq 0x212d(%rip), %rdi      # 0x572a
leaq 0x1c7a(%rip), %rsi      # 0x527e
leaq 0x226d(%rip), %rcx      # 0x5878
movl $0x4fb, %edx            # imm = 0x4FB
callq 0x20f0
movq %rax, %rdi
cmpl $0x1, %edx
jne 0x3631
callq 0x2090
callq 0x21e0
movl $0x5, %eax
jmp 0x35a6
callq 0x2210