// File: 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:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x88(%rsp), %rdi
callq 0x21c0
movq 0x30(%rsp), %rcx
movq %rax, 0x80(%rsp)
movq 0x8(%rcx), %rax
movq (%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rax
cmpq 0x78(%rsp), %rax
je 0x36a2
movq $0x0, 0x70(%rsp)
movq $0x0, 0x68(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x35af
movq 0x30(%rsp), %rdi
movq 0x80(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x68(%rsp), %rcx
callq 0x2200
movq 0x30(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq (%rax), %rax
movq %rax, 0x28(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3cb0
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
imulq $0x18, (%rax), %rdx
callq 0x10d0
movq 0x80(%rsp), %rax
cmpq 0x78(%rsp), %rax
jae 0x360c
movq 0x30(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x80(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x60(%rsp)
movq 0x30(%rsp), %rcx
movq 0x60(%rsp), %rax
cmpq 0x8(%rcx), %rax
je 0x360a
movq 0x30(%rsp), %rsi
movq 0x60(%rsp), %rdi
addq $0x21, %rsi
callq 0x1a20
movq 0x60(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x60(%rsp)
jmp 0x35d7
jmp 0x3678
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x48(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x22d0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x2290
jmp 0x3652
leaq 0x48(%rsp), %rdi
callq 0x2310
jmp 0x3678
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x2310
jmp 0x36bb
movq 0x30(%rsp), %rsi
movq %rsi, %rdx
addq $0x8, %rdx
movq %rsi, %rdi
callq 0x1a60
movq 0x30(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rcx, (%rax)
movq 0x68(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x30(%rsp), %rax
movq 0x88(%rsp), %rcx
movq %rcx, 0x10(%rax)
addq $0x98, %rsp
retq
movq 0x40(%rsp), %rdi
callq 0x11a0
nopw %cs:(%rax,%rax)
nop