// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: spp::sparsetable<std::pair<unsigned int const, unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::resize(unsigned long)
void resize(size_type new_size)
    {
        group_size_type sz = num_groups(new_size);
        group_size_type old_sz = (group_size_type)(_last_group - _first_group);

        if (sz != old_sz)
        {
            // resize group array
            // ------------------
            group_type *first = 0, *last = 0;
            if (sz)
            {
                _alloc_group_array(sz, first, last);
                memcpy(first, _first_group, sizeof(*first) * (std::min)(sz, old_sz));
            }

            if (sz < old_sz)
            {
                for (group_type *g = _first_group + sz; g != _last_group; ++g)
                    g->destruct(_alloc);
            }
            else
                std::uninitialized_fill(first + old_sz, last, group_type());

            _free_group_array(_first_group, _last_group);
            _first_group = first;
            _last_group  = last;
        }
#if 0
        // used only in test program
        // todo: fix if sparsetable to be used directly
        // --------------------------------------------
        if (new_size < _table_size)
        {
            // lower num_buckets, clear last group
            if (pos_in_group(new_size) > 0)     // need to clear inside last group
                groups.back().erase(_alloc, groups.back().begin() + pos_in_group(new_size),
                                    groups.back().end());
            _num_buckets = 0;                   // refigure # of used buckets
            for (const group_type *group = _first_group; group != _last_group; ++group)
                _num_buckets += group->num_nonempty();
        }
#endif
        _table_size = new_size;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq -0x1(%rsi), %r12
shrq $0x5, %r12
incq %r12
xorl %r15d, %r15d
cmpq $0x1, %rsi
cmovaeq %r12, %r15
movq (%rdi), %rcx
movq 0x8(%rdi), %rbp
movq %rbp, %rax
subq %rcx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rbx
cmpq %rbx, %r15
je 0x2423
movq %rcx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
testq %rsi, %rsi
je 0x23aa
leaq (,%r12,8), %rax
leaq (%rax,%rax,2), %r13
leaq (%rax,%rax,2), %rdi
addq $0x18, %rdi
callq 0x10f0
movq %r13, %rcx
addq %rax, %r13
movq $-0x1, (%rax,%rcx)
cmpq %r12, %rbx
cmovbq %rbx, %r12
shlq $0x3, %r12
leaq (%r12,%r12,2), %rdx
movq %rax, %r12
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x10b0
jmp 0x23b0
xorl %r13d, %r13d
xorl %r12d, %r12d
cmpq %rbx, %r15
jae 0x23e5
leaq (%r15,%r15,2), %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,8), %rbx
cmpq %rbp, %rbx
je 0x240a
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x23df
callq 0x10d0
movq $0x0, (%rbx)
movq 0x8(%r14), %rbp
addq $0x18, %rbx
jmp 0x23c2
leaq (%rbx,%rbx,2), %rax
leaq (%r12,%rax,8), %rax
cmpq %r13, %rax
je 0x240a
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movw $0x0, 0x10(%rax)
leaq 0x18(%rax), %rcx
movq %rcx, %rax
cmpq %r13, %rcx
jne 0x23f5
movq (%r14), %rdi
testq %rdi, %rdi
je 0x2417
callq 0x10d0
movq %r12, (%r14)
movq %r13, 0x8(%r14)
movq 0x10(%rsp), %rsi
movq %rsi, 0x10(%r14)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq