// File: /workspace/github_cpp_makefile_star2_O1/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 %rdi, 0x18(%rsp)
movq %r9, 0x10(%rsp)
cmpq %r9, %r8
jae 0x4bcc
movq %rcx, %rax
movq %rdx, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, 0x8(%rsp)
movabsq $0x46a4a7935bd1e995, %r10 # imm = 0x46A4A7935BD1E995
movq $-0x1, %r11
movq $-0x1, %rdx
shlq %cl, %rdx
movl %eax, %ecx
shlq %cl, %r11
notq %rdx
notq %r11
leaq (,%r8,8), %rax
leaq (%rax,%rax,4), %rdi
movq 0x8(%rsp), %rax
leaq (%r8,%rax), %rcx
movq 0x18(%rsp), %rax
movq 0x18(%rax), %r14
movq %rdi, 0x20(%rsp)
addq %rdi, %r14
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpb $0x1, 0x24(%r14,%r15)
jne 0x4b80
movl (%r14,%r15,8), %edi
movl %edx, %ebx
andl %edi, %ebx
movl %r11d, %r13d
andl %edi, %r13d
movq %r8, %rbp
xorq %rbx, %rbp
movq %r13, %r9
xorq %rcx, %r9
orq %rbp, %r9
je 0x4b3b
movl %edi, %eax
shrl $0x10, %eax
xorl %edi, %eax
movl %eax, %r9d
shrl $0x8, %r9d
xorl %eax, %r9d
movzbl %r9b, %r9d
imulq %r10, %r9
addq %r10, %r9
xorq %rdi, %r9
movq %r9, %rdi
andq %rdx, %rdi
andq %r11, %r9
cmpq %rdi, %r8
jne 0x4b8f
cmpq %rcx, %r9
jne 0x4b8f
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 0x4bdb
movb 0x20(%r14,%r15), %al
movb %al, 0x20(%r9,%r12)
movl (%r14,%r15,8), %eax
movl %eax, (%r9,%r12,8)
movl 0x4(%r14,%r15,8), %eax
movl %eax, 0x4(%r9,%r12,8)
movb $0x1, 0x24(%r9,%r12)
movq %rdi, %r12
incq %r15
cmpq $0x4, %r15
jne 0x4ade
jmp 0x4bb5
movq %r8, %rax
xorq %rdi, %rax
xorq %rbx, %r13
xorq %rdi, %r9
orq %rax, %r9
sete %bl
movq %r12, %rdi
movq %r8, %r9
movq %r15, %r12
orq %r13, %rbp
je 0x4b43
testb %bl, %bl
jne 0x4b43
jmp 0x4bfa
incq %r8
movq 0x20(%rsp), %rdi
addq $0x28, %rdi
cmpq 0x10(%rsp), %r8
jne 0x4abe
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x168a(%rip), %rdi      # 0x626c
leaq 0x4ee(%rip), %rsi       # 0x50d7
leaq 0x168e(%rip), %rcx      # 0x627e
movl $0xc9, %edx
callq 0x20f0
leaq 0x19be(%rip), %rdi      # 0x65bf
leaq 0x676(%rip), %rsi       # 0x527e
leaq 0x1a23(%rip), %rcx      # 0x6632
movl $0x669, %edx            # imm = 0x669
callq 0x20f0
nop