// File: /workspace/github_c_makefile_star2_O2/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 0x70de3
movq %rsi, %rax
movq %r14, %rsi
cmpq %rax, %r14
jge 0x70dfc
movq %r14, %rsi
cmpq %rax, %rsi
jge 0x70dfc
addq %rsi, %rsi
movq %rsi, 0xa8(%rbx)
jmp 0x70dd2
cmpq $0x7d0000, %r14         # imm = 0x7D0000
setl %cl
incb %cl
movq %r14, %rsi
shlq %cl, %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 0x70e40
movq 0xa8(%rbx), %rcx
shlq $0x3, %rcx
leaq 0x716bf(%rip), %rdx     # 0xe24f0
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd5c7
movq 0x88(%rbx), %rdi
movq 0xa8(%rbx), %rsi
shlq $0x3, %rsi
callq 0x8510
movq %rax, 0x88(%rbx)
testq %rax, %rax
jne 0x70e8b
movq 0xa8(%rbx), %rcx
shlq $0x3, %rcx
leaq 0x71676(%rip), %rdx     # 0xe24eb
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd5c7
movq 0x88(%rbx), %rax
leaq 0x200(%rax), %rcx
movq %rcx, 0x98(%rbx)
addq %r15, %rax
sarq $0x3, %r15
movq %rax, 0x90(%rbx)
movq 0xa8(%rbx), %rbp
movq %rbp, %r12
subq %r14, %r12
pushq $0x30
popq %rsi
movq %r12, %rdi
callq 0x8360
movq %rax, %r13
movq %r14, %rcx
cmpq %rbp, %rcx
jge 0x713ff
movq 0x80(%rbx), %rdx
movq %rax, (%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rsi
movq %rsi, 0x90(%rbx)
movq %rax, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x30(%rax), %rsi
movq %rsi, 0x8(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x60(%rax), %rsi
movq %rsi, 0x10(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x90(%rax), %rsi
movq %rsi, 0x18(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0xc0(%rax), %rsi
movq %rsi, 0x20(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0xf0(%rax), %rsi
movq %rsi, 0x28(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x120(%rax), %rsi
movq %rsi, 0x30(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x150(%rax), %rsi
movq %rsi, 0x38(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x180(%rax), %rsi
movq %rsi, 0x40(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x1b0(%rax), %rsi
movq %rsi, 0x48(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x1e0(%rax), %rsi
movq %rsi, 0x50(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x210(%rax), %rsi
movq %rsi, 0x58(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x240(%rax), %rsi
movq %rsi, 0x60(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x270(%rax), %rsi
movq %rsi, 0x68(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x2a0(%rax), %rsi
movq %rsi, 0x70(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x2d0(%rax), %rsi
movq %rsi, 0x78(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x300(%rax), %rsi
movq %rsi, 0x80(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x330(%rax), %rsi
movq %rsi, 0x88(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x360(%rax), %rsi
movq %rsi, 0x90(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x390(%rax), %rsi
movq %rsi, 0x98(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x3c0(%rax), %rsi
movq %rsi, 0xa0(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x3f0(%rax), %rsi
movq %rsi, 0xa8(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x420(%rax), %rsi
movq %rsi, 0xb0(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x450(%rax), %rsi
movq %rsi, 0xb8(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x480(%rax), %rsi
movq %rsi, 0xc0(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x4b0(%rax), %rsi
movq %rsi, 0xc8(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x4e0(%rax), %rsi
movq %rsi, 0xd0(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x510(%rax), %rsi
movq %rsi, 0xd8(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x540(%rax), %rsi
movq %rsi, 0xe0(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x570(%rax), %rsi
movq %rsi, 0xe8(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x5a0(%rax), %rsi
movq %rsi, 0xf0(%rdx,%rcx,8)
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
movq 0x80(%rbx), %rdx
leaq 0x5d0(%rax), %rsi
movq %rsi, 0xf8(%rdx,%rcx,8)
addq $0x20, %rcx
movq 0x90(%rbx), %rdx
leaq 0x8(%rdx), %rdi
movq %rdi, 0x90(%rbx)
movq %rsi, (%rdx)
addq $0x600, %rax            # imm = 0x600
jmp 0x70ec5
pushq $0x20
popq %rdi
callq 0x8480
movq %r13, (%rax)
imulq $0x30, %r12, %rcx
addq %r13, %rcx
movq %rcx, 0x8(%rax)
movq %r14, 0x10(%rax)
movq 0x2a68(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x2a68(%rbx)
movq 0x90(%rbx), %rax
movq 0xa8(%rbx), %rcx
movq %rax, 0xa0(%rbx)
testb $0x2, 0x21c(%rbx)
je 0x7146c
leaq 0x710d2(%rip), %rdx     # 0xe2522
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
movq %r15, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0xd5c7
movq 0xa8(%rbx), %rcx
cmpq 0xb8(%rbx), %rcx
jge 0x71484
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x710c3(%rip), %rsi     # 0xe254e
movq %rbx, %rdi
callq 0x94d4
movq 0x820(%rbx), %rcx
movslq 0x7dc(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
incl %edx
andl $0x7, %edx
movl %edx, 0x7dc(%rbx)
leaq 0x710a4(%rip), %rdx     # 0xe255b
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 0x2cdc0