// 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>::move_buckets(libcuckoo_bucket_container<unsigned int, unsigned int, std::allocator<std::pair<unsigned int const, unsigned int>>, unsigned char, 4ul>&, unsigned long, unsigned long, unsigned long, unsigned long)
void move_buckets(buckets_t &new_buckets, size_type current_hp,
                    size_type new_hp, size_type start_ind, size_type end_ind) {
    for (size_type old_bucket_ind = start_ind; old_bucket_ind < end_ind;
         ++old_bucket_ind) {
      // By doubling the table size, the index_hash and alt_index of
      // each key got one bit added to the top, at position
      // current_hp, which means anything we have to move will either
      // be at the same bucket position, or exactly
      // hashsize(current_hp) later than the current bucket
      bucket &old_bucket = buckets_[old_bucket_ind];
      const size_type new_bucket_ind = old_bucket_ind + hashsize(current_hp);
      size_type new_bucket_slot = 0;

      // For each occupied slot, either move it into its same position in the
      // new buckets container, or to the first available spot in the new
      // bucket in the new buckets container.
      for (size_type old_bucket_slot = 0; old_bucket_slot < slot_per_bucket();
           ++old_bucket_slot) {
        if (!old_bucket.occupied(old_bucket_slot)) {
          continue;
        }
        const hash_value hv = hashed_key(old_bucket.key(old_bucket_slot));
        const size_type old_ihash = index_hash(current_hp, hv.hash);
        const size_type old_ahash =
            alt_index(current_hp, hv.partial, old_ihash);
        const size_type new_ihash = index_hash(new_hp, hv.hash);
        const size_type new_ahash = alt_index(new_hp, hv.partial, new_ihash);
        size_type dst_bucket_ind, dst_bucket_slot;
        if ((old_bucket_ind == old_ihash && new_ihash == new_bucket_ind) ||
            (old_bucket_ind == old_ahash && new_ahash == new_bucket_ind)) {
          // We're moving the key to the new bucket
          dst_bucket_ind = new_bucket_ind;
          dst_bucket_slot = new_bucket_slot++;
        } else {
          // We're moving the key to the old bucket
          assert((old_bucket_ind == old_ihash && new_ihash == old_ihash) ||
                 (old_bucket_ind == old_ahash && new_ahash == old_ahash));
          dst_bucket_ind = old_bucket_ind;
          dst_bucket_slot = old_bucket_slot;
        }
        new_buckets.setKV(dst_bucket_ind, dst_bucket_slot++,
                          old_bucket.partial(old_bucket_slot),
                          old_bucket.movable_key(old_bucket_slot),
                          std::move(old_bucket.mapped(old_bucket_slot)));
      }
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x20(%rsp)
movq %r8, %r14
movq %rcx, %rax
movq %rdx, %rcx
pushq $0x1
popq %rdx
shlq %cl, %rdx
movq %rdx, 0x18(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, 0x10(%rsp)
pushq $-0x1
popq %rdx
movq %rdx, %rsi
shlq %cl, %rsi
movl %eax, %ecx
shlq %cl, %rdx
notq %rsi
movq %rsi, (%rsp)
notq %rdx
movq %rdx, 0x8(%rsp)
imulq $0x28, %r8, %rcx
cmpq 0x20(%rsp), %r14
jae 0x4c42
movq 0x18(%rsp), %rax
leaq (%r14,%rax), %rbp
movq 0x10(%rsp), %rax
movq 0x18(%rax), %r15
movq %rcx, 0x28(%rsp)
addq %rcx, %r15
movq %r15, %r13
xorl %r12d, %r12d
xorl %edx, %edx
cmpq $0x4, %r12
je 0x4c31
cmpb $0x1, 0x24(%r15,%r12)
jne 0x4c03
movl (%r15,%r12,8), %edi
movq (%rsp), %rsi
andl %edi, %esi
movq 0x8(%rsp), %rax
andl %edi, %eax
movq %r14, %rcx
xorq %rsi, %rcx
movq %rax, %r8
xorq %rbp, %r8
orq %rcx, %r8
je 0x4be2
movl %edi, %r8d
shrl $0x10, %r8d
xorl %edi, %r8d
movl %r8d, %r9d
shrl $0x8, %r9d
xorl %r8d, %r9d
movzbl %r9b, %r8d
movabsq $0x46a4a7935bd1e995, %r9 # imm = 0x46A4A7935BD1E995
imulq %r9, %r8
addq %r9, %r8
xorq %rdi, %r8
movq %r8, %rdi
andq (%rsp), %rdi
andq 0x8(%rsp), %r8
movq %r14, %r9
xorq %rdi, %r9
movq %r8, %r10
xorq %rbp, %r10
orq %r9, %r10
jne 0x4c0f
leaq 0x1(%rdx), %rbx
movq %rbp, %rsi
movzbl 0x20(%r15,%r12), %ecx
leaq 0x4(%r13), %r9
movq 0x30(%rsp), %rdi
movq %r13, %r8
callq 0x4020
movq %rbx, %rdx
incq %r12
addq $0x8, %r13
jmp 0x4b61
xorq %rsi, %rax
xorq %rdi, %r8
orq %r8, %r9
sete %dil
movq %rdx, %rbx
movq %r14, %rsi
movq %r12, %rdx
orq %rax, %rcx
je 0x4be9
testb %dil, %dil
jne 0x4be9
jmp 0x4c51
incq %r14
movq 0x28(%rsp), %rcx
addq $0x28, %rcx
jmp 0x4b34
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1977(%rip), %rdi      # 0x65cf
leaq 0x62f(%rip), %rsi       # 0x528e
leaq 0x19dc(%rip), %rcx      # 0x6642
movl $0x669, %edx            # imm = 0x669
callq 0x20f0