// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: resize_heap_to
static void resize_heap_to(s7_scheme *sc, int64_t size)
    {
        int64_t old_size, old_free, k;
        s7_cell *cells;
        s7_pointer p;
        heap_block_t *hp;

        old_size = sc->heap_size;
        old_free = sc->free_heap_top - sc->free_heap;
        if (size == 0)
        {
            if (sc->heap_size < 8192000)
                sc->heap_size *= 4;          /* *8 if < 1M (or whatever) doesn't make much difference */
            else sc->heap_size *= 2;
        }
        else
        {
            if (size > sc->heap_size)
                while (sc->heap_size < size) sc->heap_size *= 2;
        }
        /* do not call new_cell here! */

        sc->heap = (s7_cell **)realloc(sc->heap, sc->heap_size * sizeof(s7_cell *));
        if (!(sc->heap))
            s7_warn(sc, 256, "heap reallocation failed! tried to get %" print_s7_int " bytes\n", (int64_t)(sc->heap_size * sizeof(s7_cell *)));

        sc->free_heap = (s7_cell **)realloc(sc->free_heap, sc->heap_size * sizeof(s7_cell *));
        if (!(sc->free_heap))
            s7_warn(sc, 256, "free heap reallocation failed! tried to get %" print_s7_int " bytes\n", (int64_t)(sc->heap_size * sizeof(s7_cell *)));

        sc->free_heap_trigger = (s7_cell **)(sc->free_heap + GC_TRIGGER_SIZE);
        sc->free_heap_top = sc->free_heap + old_free; /* incremented below, added old_free 21-Aug-12?!? */

        cells = (s7_cell *)calloc(sc->heap_size - old_size, sizeof(s7_cell));
        for (p = cells, k = old_size; k < sc->heap_size;)
        {
            LOOP_8(sc->heap[k++] = p; (*sc->free_heap_top++) = p++);
            LOOP_8(sc->heap[k++] = p; (*sc->free_heap_top++) = p++);
            LOOP_8(sc->heap[k++] = p; (*sc->free_heap_top++) = p++);
            LOOP_8(sc->heap[k++] = p; (*sc->free_heap_top++) = p++);
        }
        hp = (heap_block_t *)malloc(sizeof(heap_block_t));
        hp->start = (intptr_t)cells;
        hp->end = (intptr_t)cells + ((sc->heap_size - old_size) * sizeof(s7_cell));
        hp->offset = old_size;
        hp->next = sc->heap_blocks;
        sc->heap_blocks = hp;

        sc->previous_free_heap_top = sc->free_heap_top;

        if (show_heap_stats(sc))
            s7_warn(sc, 256, "heap grows to %" print_s7_int " (old free/size: %" print_s7_int "/%" print_s7_int ")\n", sc->heap_size, old_free, old_size);

        if (sc->heap_size >= sc->max_heap_size)
            s7_error(sc, make_symbol(sc, "heap-too-big"), set_elist_1(sc, wrap_string(sc, "heap has grown past (*s7* 'max-heap-size)", 41)));
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x90(%rdi), %r15
movq 0xa8(%rdi), %r14
testq %rsi, %rsi
je 0x8c50d
movq %rsi, %rax
movq %r14, %rsi
cmpq %rax, %r14
jge 0x8c52b
movq %r14, %rsi
addq %rsi, %rsi
cmpq %rax, %rsi
jl 0x8c503
jmp 0x8c524
cmpq $0x7cffff, %r14         # imm = 0x7CFFFF
jg 0x8c520
leaq (,%r14,4), %rsi
jmp 0x8c524
leaq (%r14,%r14), %rsi
movq %rsi, 0xa8(%rbx)
subq 0x88(%rbx), %r15
movq 0x80(%rbx), %rdi
shlq $0x3, %rsi
callq 0x8510
movq %rax, 0x80(%rbx)
testq %rax, %rax
jne 0x8c56f
movq 0xa8(%rbx), %rcx
shlq $0x3, %rcx
leaq 0x89ff0(%rip), %rdx     # 0x116550
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeea2
movq 0x88(%rbx), %rdi
movq 0xa8(%rbx), %rsi
shlq $0x3, %rsi
callq 0x8510
movq %rax, %rbp
movq %rax, 0x88(%rbx)
testq %rax, %rax
jne 0x8c5bd
movq 0xa8(%rbx), %rcx
shlq $0x3, %rcx
leaq 0x89fa4(%rip), %rdx     # 0x11654b
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeea2
movq 0x88(%rbx), %rbp
leaq 0x200(%rbp), %rax
movq %rax, 0x98(%rbx)
addq %r15, %rbp
movq %rbp, 0x90(%rbx)
movq 0xa8(%rbx), %r12
movq %r12, %rdi
subq %r14, %rdi
movl $0x30, %esi
callq 0x8360
movq %r12, %r13
subq %r14, %r13
movq %rax, (%rsp)
jle 0x8cb46
movq %r14, %r8
movq %rax, %rcx
movq 0x80(%rbx), %rdx
movq %rcx, (%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rsi
movq %rsi, 0x90(%rbx)
movq %rcx, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x30(%rcx), %rsi
movq %rsi, 0x8(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x60(%rcx), %rsi
movq %rsi, 0x10(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x90(%rcx), %rsi
movq %rsi, 0x18(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0xc0(%rcx), %rsi
movq %rsi, 0x20(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0xf0(%rcx), %rsi
movq %rsi, 0x28(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x120(%rcx), %rsi
movq %rsi, 0x30(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x150(%rcx), %rsi
movq %rsi, 0x38(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x180(%rcx), %rsi
movq %rsi, 0x40(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x1b0(%rcx), %rsi
movq %rsi, 0x48(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x1e0(%rcx), %rsi
movq %rsi, 0x50(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x210(%rcx), %rsi
movq %rsi, 0x58(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x240(%rcx), %rsi
movq %rsi, 0x60(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x270(%rcx), %rsi
movq %rsi, 0x68(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x2a0(%rcx), %rsi
movq %rsi, 0x70(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x2d0(%rcx), %rsi
movq %rsi, 0x78(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x300(%rcx), %rsi
movq %rsi, 0x80(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x330(%rcx), %rsi
movq %rsi, 0x88(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x360(%rcx), %rsi
movq %rsi, 0x90(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x390(%rcx), %rsi
movq %rsi, 0x98(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x3c0(%rcx), %rsi
movq %rsi, 0xa0(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x3f0(%rcx), %rsi
movq %rsi, 0xa8(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x420(%rcx), %rsi
movq %rsi, 0xb0(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x450(%rcx), %rsi
movq %rsi, 0xb8(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x480(%rcx), %rsi
movq %rsi, 0xc0(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x4b0(%rcx), %rsi
movq %rsi, 0xc8(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x4e0(%rcx), %rsi
movq %rsi, 0xd0(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x510(%rcx), %rsi
movq %rsi, 0xd8(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x540(%rcx), %rsi
movq %rsi, 0xe0(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x570(%rcx), %rsi
movq %rsi, 0xe8(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x5a0(%rcx), %rsi
movq %rsi, 0xf0(%rdx,%r8,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x5d0(%rcx), %rsi
movq %rsi, 0xf8(%rdx,%r8,8)
addq $0x20, %r8
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
addq $0x600, %rcx            # imm = 0x600
cmpq %r12, %r8
jl 0x8c602
movq 0x90(%rbx), %rbp
movq 0xa8(%rbx), %r12
movl $0x20, %edi
callq 0x8480
movq (%rsp), %rdx
movq %rdx, (%rax)
leaq (,%r13,2), %rcx
addq %r13, %rcx
shlq $0x4, %rcx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
movq %r14, 0x10(%rax)
movq 0x2a68(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x2a68(%rbx)
movq %rbp, 0xa0(%rbx)
testb $0x2, 0x21c(%rbx)
je 0x8cbbd
sarq $0x3, %r15
leaq 0x899e4(%rip), %rdx     # 0x116582
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0xeea2
movq 0xa8(%rbx), %r12
cmpq 0xb8(%rbx), %r12
jge 0x8cbd5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x899d2(%rip), %rsi     # 0x1165ae
movq %rbx, %rdi
callq 0x9afc
movq 0x820(%rbx), %rcx
movslq 0x7dc(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
incl %edx
andl $0x7, %edx
movl %edx, 0x7dc(%rbx)
leaq 0x899b3(%rip), %rdx     # 0x1165bb
movq %rdx, 0x10(%rcx)
movq $0x29, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rcx, 0x8(%rdx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x38dfa