// 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>::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 $0x28, %rsp
movq %r8, %rax
movq %rdi, 0x18(%rsp)
movq %r9, 0x10(%rsp)
cmpq %r9, %r8
jae 0x4b12
movq %rcx, %r8
movq %rdx, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, 0x8(%rsp)
movq $-0x1, %r11
movq $-0x1, %rdx
shlq %cl, %rdx
movl %r8d, %ecx
shlq %cl, %r11
notq %rdx
notq %r11
leaq (,%rax,8), %rcx
leaq (%rcx,%rcx,4), %r8
movq 0x8(%rsp), %rcx
addq %rax, %rcx
movq 0x18(%rsp), %rdi
movq 0x18(%rdi), %r14
movq %r8, 0x20(%rsp)
addq %r8, %r14
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpb $0x1, 0x24(%r14,%r15)
jne 0x4aca
movl (%r14,%r15,8), %r10d
movl %edx, %ebx
andl %r10d, %ebx
movl %r11d, %r13d
andl %r10d, %r13d
movq %rax, %rbp
xorq %rbx, %rbp
movq %r13, %r8
xorq %rcx, %r8
orq %rbp, %r8
je 0x4a89
movl %r10d, %r8d
shrl $0x10, %r8d
xorl %r10d, %r8d
movl %r8d, %r9d
shrl $0x8, %r9d
xorl %r8d, %r9d
movzbl %r9b, %edi
movabsq $0x46a4a7935bd1e995, %r8 # imm = 0x46A4A7935BD1E995
imulq %r8, %rdi
addq %r8, %rdi
xorq %r10, %rdi
movq %rdi, %r10
andq %rdx, %r10
andq %r11, %rdi
movq %rax, %r8
xorq %r10, %r8
movq %rdi, %r9
xorq %rcx, %r9
orq %r8, %r9
jne 0x4ad9
leaq 0x1(%r12), %rdi
movq %rcx, %r9
leaq (%r9,%r9,4), %r9
shlq $0x3, %r9
addq 0x10(%rsi), %r9
cmpb $0x1, 0x24(%r12,%r9)
je 0x4b21
movb 0x20(%r14,%r15), %r8b
movb %r8b, 0x20(%r9,%r12)
movl (%r14,%r15,8), %r8d
movl %r8d, (%r9,%r12,8)
movl 0x4(%r14,%r15,8), %r8d
movl %r8d, 0x4(%r9,%r12,8)
movb $0x1, 0x24(%r9,%r12)
movq %rdi, %r12
incq %r15
cmpq $0x4, %r15
jne 0x4a17
jmp 0x4afb
xorq %rbx, %r13
xorq %r10, %rdi
orq %rdi, %r8
sete %r8b
movq %r12, %rdi
movq %rax, %r9
movq %r15, %r12
orq %r13, %rbp
je 0x4a91
testb %r8b, %r8b
jne 0x4a91
jmp 0x4b40
incq %rax
movq 0x20(%rsp), %r8
addq $0x28, %r8
cmpq 0x10(%rsp), %rax
jne 0x49f8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14e1(%rip), %rdi      # 0x6009
leaq 0x5a8(%rip), %rsi       # 0x50d7
leaq 0x14e5(%rip), %rcx      # 0x601b
movl $0xc9, %edx
callq 0x20f0
leaq 0x1815(%rip), %rdi      # 0x635c
leaq 0x730(%rip), %rsi       # 0x527e
leaq 0x187a(%rip), %rcx      # 0x63cf
movl $0x669, %edx            # imm = 0x669
callq 0x20f0
nop