// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]tundra/src/HashTable.hpp
// Function: void t2::HashTableGrow<0u>(t2::HashSet<0u>*)
void HashTableGrow(HashSet<kFlags>* self)
  {
    MemAllocHeap*  heap      = self->m_Heap;

    const uint32_t old_size  = self->m_TableSize;
    // start at 1<<7 (128), increase by 4x each time
    const uint32_t new_shift = std::max(self->m_TableSizeShift + 2, 7u);
    const uint32_t new_size  = 1 << new_shift;

    uint32_t* old_hashes = self->m_Hashes;
    const char** old_strings = self->m_Strings;

    uint32_t* new_hashes = HeapAllocateArrayZeroed<uint32_t>(heap, new_size);
    const char** new_strings = HeapAllocateArrayZeroed<const char*>(heap, new_size);

    const uint32_t new_mask = new_size - 1;

    for (uint32_t i = 0; i < old_size; ++i)
    {
      if (uint32_t h = old_hashes[i])
      {
        uint32_t index = h & new_mask;

        while (new_hashes[index] != 0)
        {
          index = (index + 1) & new_mask;
        }

        new_hashes[index] = h;
        new_strings[index] = old_strings[i];
      }
    }

    HeapFree(heap, old_strings);
    HeapFree(heap, old_hashes);

    // Commit
    self->m_Hashes         = new_hashes;
    self->m_Strings        = new_strings;
    self->m_TableSize      = new_size;
    self->m_TableSizeShift = new_shift;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
movl $0x7, -0x20(%rbp)
leaq -0x1c(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xc430
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0xc470
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0xc4c0
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x15f1f
movq -0x30(%rbp), %rax
movl -0x50(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0x15f12
movl -0x54(%rbp), %eax
andl -0x4c(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x40(%rbp), %rax
movl -0x58(%rbp), %ecx
cmpl $0x0, (%rax,%rcx,4)
je 0x15eef
movl -0x58(%rbp), %eax
addl $0x1, %eax
andl -0x4c(%rbp), %eax
movl %eax, -0x58(%rbp)
jmp 0x15ed4
movl -0x54(%rbp), %edx
movq -0x40(%rbp), %rax
movl -0x58(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x38(%rbp), %rax
movl -0x50(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq -0x48(%rbp), %rax
movl -0x58(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x15f14
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x15eb0
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x18960
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x18960
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x24(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x18(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)