// File: /workspace/github_c_makefile_star2_O0/wuxb45[P]SLB/lib1.c
// Function: cuckoo_expand_worker
static void *
cuckoo_expand_worker(void * const ptr)
{
  struct cuckoo_expand_worker_info * const info = (typeof(info))ptr;
  struct cuckoo * const map = info->map;
  struct __cuckoo_level * const level0 = info->level0;
  struct __cuckoo_level * const level1 = info->level1;
  u64 uniq;
  while ((uniq = atomic_fetch_add(&(info->uniq), 64)) < KVMAP_HLOCK_NR) {
    for (u64 lidx = uniq; lidx < (uniq + 64); lidx++) {
      spinlock_lock(&(map->hlocks[lidx]));
      const u64 power0 = level0->power;
      const u64 hi_nr = UINT64_C(1) << (power0 - KVMAP_MIN_LEVEL);
      const u64 lo_nr = UINT64_C(1) << KVMAP_BASE_LEVEL;
      const u64 mid = lidx << KVMAP_BASE_LEVEL;
      for (u64 hi = 0; hi < hi_nr; hi++) {
        for (u64 lo = 0; lo < lo_nr; lo++) {
          const u64 hidx0 = (hi << KVMAP_MIN_LEVEL) | mid | lo;
          debug_assert(kvmap_hlocks_index(hidx0) == lidx);
          struct __kvmap_slot * const slot = &(level0->table[hidx0]);
          for (u64 k = 0; k < 8; k++) {
            if (slot->e[k].ptr) {
              struct kv * const curr = __u64_to_ptr(slot->e[k].ptr);
              const u64 hash2[2] = {cuckoo_hash(curr, 0), cuckoo_hash(curr, 1), };
              const u64 hash = __cuckoo_hidx(hash2[0], power0) == hidx0 ? hash2[0] : hash2[1];
              debug_assert(__cuckoo_hidx(hash, power0) == hidx0);
              level1->table[__cuckoo_hidx(hash, level1->power)].e[k] = slot->e[k];
              slot->e[k].ptr = 0;
              slot->e[k].pkey = 0;
            }
          }
        }
      }
      info->bm_updater(map->bm, lidx);
      spinlock_unlock(&(map->hlocks[lidx]));
    }
  }
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq $0x40, -0x38(%rbp)
movq -0x38(%rbp), %rax
lock
xaddq %rax, 0x8(%rcx)
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x400, %rax            # imm = 0x400
jae 0x19558
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x40, %rcx
cmpq %rcx, %rax
jae 0x19553
movq -0x18(%rbp), %rdi
addq $0x50, %rdi
movq -0x48(%rbp), %rax
shlq $0x6, %rax
addq %rax, %rdi
callq 0x6e50
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
subq $0x10, %rcx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x58(%rbp)
movq $0x40, -0x60(%rbp)
movq -0x48(%rbp), %rax
shlq $0x6, %rax
movq %rax, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x19511
movq $0x0, -0x78(%rbp)
cmpq $0x40, -0x78(%rbp)
jae 0x194fe
movq -0x70(%rbp), %rax
shlq $0x10, %rax
orq -0x68(%rbp), %rax
orq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x12d40
cmpq -0x48(%rbp), %rax
sete %al
movzbl %al, %edi
andl $0x1, %edi
callq 0x7640
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
cmpq $0x8, -0x90(%rbp)
jae 0x194eb
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x10, %rax
cmpq $0x0, %rax
je 0x194d2
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
shrq $0x10, %rdi
callq 0xf220
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10bb0
movq %rax, -0xb0(%rbp)
movq -0x98(%rbp), %rdi
movl $0x1, %esi
callq 0x10bb0
movq %rax, -0xa8(%rbp)
movq -0xb0(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x18cb0
cmpq -0x80(%rbp), %rax
jne 0x19402
movq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x19410
movq -0xa8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x18cb0
cmpq -0x80(%rbp), %rax
sete %al
movzbl %al, %edi
andl $0x1, %edi
callq 0x7640
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0xb8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x18cb0
movq %rax, %rcx
movq -0xc8(%rbp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
andq $0xffff, %rdx           # imm = 0xFFFF
orq $0x0, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
andq $-0x10000, %rdx         # imm = 0xFFFF0000
orq $0x0, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x194d4
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x1935d
jmp 0x194ed
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x192ff
jmp 0x19500
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x192e9
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x100d8(%rcx), %rdi
movq -0x48(%rbp), %rsi
callq *%rax
movq -0x18(%rbp), %rdi
addq $0x50, %rdi
movq -0x48(%rbp), %rax
shlq $0x6, %rax
addq %rax, %rdi
callq 0x6ed0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x19280
jmp 0x1924a
xorl %eax, %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)