// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rax
movq %rsi, %rbx
leaq -0x1(%rsi), %rax
shrq $0x5, %rax
incq %rax
xorl %ebp, %ebp
cmpq $0x1, %rsi
cmovaeq %rax, %rbp
movq %rdi, %r14
movq (%rdi), %r12
movq 0x8(%rdi), %rax
subq %r12, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r15
cmpq %r15, %rbp
je 0x241d
testq %rbx, %rbx
je 0x2390
leaq (,%rbp,8), %rax
leaq (%rax,%rax,2), %r13
leaq (%rax,%rax,2), %rdi
addq $0x18, %rdi
callq 0x10f0
movq %rax, %rdi
movq %r13, %rax
addq %rdi, %r13
movq $-0x1, (%rdi,%rax)
cmpq %rbp, %r15
movq %rbp, %rax
cmovbq %r15, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
movq %rdi, (%rsp)
movq %r12, %rsi
callq 0x10b0
jmp 0x239b
xorl %r13d, %r13d
movq $0x0, (%rsp)
cmpq %r15, %rbp
jae 0x23d9
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq (%r12,%rax,8), %r15
cmpq 0x8(%r14), %r15
movq (%rsp), %r12
je 0x2402
movq (%r15), %rdi
testq %rdi, %rdi
je 0x23cd
callq 0x10d0
movq $0x0, (%r15)
addq $0x18, %r15
cmpq 0x8(%r14), %r15
jne 0x23b9
jmp 0x2402
leaq (%r15,%r15,2), %rax
movq (%rsp), %r12
leaq (%r12,%rax,8), %rax
cmpq %r13, %rax
je 0x2402
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movw $0x0, 0x10(%rax)
leaq 0x18(%rax), %rcx
movq %rcx, %rax
cmpq %r13, %rcx
jne 0x23ed
movq (%r14), %rdi
testq %rdi, %rdi
je 0x2416
callq 0x10d0
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq %r12, (%r14)
movq %r13, 0x8(%r14)
movq %rbx, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq