// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: g_for_each_closure
static s7_pointer g_for_each_closure(s7_scheme *sc, s7_pointer f, s7_pointer seq)
                {
                    s7_pointer body;

                    body = closure_body(f);
                    if (!no_cell_opt(body))
                    {
                        s7_function func;
                        s7_pointer old_e, expr, pars, val, slot;

                        old_e = sc->envir;
                        pars = closure_args(f);

                        if (is_float_vector(seq))
                            val = real_zero;
                        else
                        {
                            if ((is_int_vector(seq)) || (is_byte_vector(seq)))
                                val = small_int(0);
                            else val = sc->F;
                        }

                        new_frame_with_slot(sc, closure_let(f), sc->envir, car(pars), val);
                        slot = let_slots(sc->envir);

                        if (is_null(cdr(body)))
                        {
                            expr = car(body);
                            func = s7_optimize_nr(sc, body);
                        }
                        else
                        {
                            expr = cons(sc, sc->begin_symbol, body);
                            sc->v = expr; /* GC protection? */
                            func = s7_cell_optimize(sc, cons(sc, expr, sc->nil), true);
                        }

                        if (func)
                        {
                            if (is_pair(seq))
                            {
                                s7_pointer x, y;
                                for (x = seq, y = x; is_pair(x); )
                                {
                                    slot_set_value(slot, car(x));
                                    func(sc, expr);
                                    x = cdr(x);
                                    if (is_pair(x))
                                    {
                                        slot_set_value(slot, car(x));
                                        func(sc, expr);
                                        y = cdr(y);
                                        x = cdr(x);
                                        if (x == y) return(sc->unspecified);
                                    }
                                }
                                return(sc->unspecified);
                            }

                            if (is_float_vector(seq))
                            {
                                s7_double *vals;
                                s7_int i, len;
                                len = vector_length(seq);
                                vals = float_vector_floats(seq);

                                if ((len > 1000) &&
                                        (!tree_has_setters(sc, body)))
                                {
                                    s7_pointer sv;
                                    sv = s7_make_mutable_real(sc, 0.0);
                                    slot_set_value(slot, sv);
                                    for (i = 0; i < len; i++)
                                    {
                                        real(sv) = vals[i];
                                        func(sc, expr);
                                    }
                                    return(sc->unspecified);
                                }
                                for (i = 0; i < len; i++)
                                {
                                    slot_set_value(slot, make_real(sc, vals[i]));
                                    func(sc, expr);
                                }
                                return(sc->unspecified);
                            }

                            /* if no set! vector|list|let|hash-table-set! set-car!|cdr! mutable arg? */
                            if (is_int_vector(seq))
                            {
                                s7_int *vals;
                                s7_int i, len;
                                len = vector_length(seq);
                                vals = int_vector_ints(seq);

                                if ((len > 1000) &&
                                        (!tree_has_setters(sc, body)))
                                {
                                    s7_pointer sv;
                                    sv = make_mutable_integer(sc, 0);
                                    slot_set_value(slot, sv);
                                    /* since there are no setters, the inner step is also mutable if there is one
                                     *    func=opt_cell_any_nr, sc->opts[0]->v[0].fp(sc->opts[0]) fp=opt_do_1 -> mutable version
                                     *    see opt_do_1
                                     */
                                    for (i = 0; i < len; i++)
                                    {
                                        integer(sv) = vals[i];
                                        func(sc, expr);
                                    }
                                    return(sc->unspecified);
                                }

                                for (i = 0; i < len; i++)
                                {
                                    slot_set_value(slot, make_integer(sc, vals[i]));
                                    func(sc, expr);
                                }
                                return(sc->unspecified);
                            }

                            sc->z = seq;
                            if (!is_iterator(sc->z))
                                sc->z = s7_make_iterator(sc, sc->z);
                            seq = sc->z;
                            push_stack_no_let(sc, OP_GC_PROTECT, seq, f);
                            sc->z = sc->nil;
                            while (true)
                            {
                                slot_set_value(slot, s7_iterate(sc, seq));
                                if (iterator_is_at_end(seq))
                                {
                                    unstack(sc);
                                    /* free_cell(sc, seq); */ /* 16-Jan-19 */
                                    return(sc->unspecified);
                                }
                                func(sc, expr);
                            }
                        }
                        set_no_cell_opt(body);
                        sc->envir = old_e;
                    }

                    if ((is_null(cdr(body))) &&
                            (is_pair(seq)))
                    {
                        s7_pointer c;
                        c = make_counter(sc, seq);
                        counter_set_result(c, seq);
                        push_stack(sc, OP_FOR_EACH_2, c, f);
                        return(sc->unspecified);
                    }

                    sc->z = seq;
                    if (!is_iterator(sc->z))
                        sc->z = s7_make_iterator(sc, sc->z);
                    push_stack(sc, OP_FOR_EACH_1, make_counter(sc, sc->z), f);
                    sc->z = sc->nil;
                    return(sc->unspecified);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %rbx
movq 0x10(%rsi), %rsi
testb $0x4, 0x3(%rsi)
jne 0xa1e25
movq 0x8(%rbp), %rax
movb (%r12), %cl
addb $-0x16, %cl
cmpb $0x3, %cl
jae 0xa1c05
movzbl %cl, %ecx
leaq 0x73189(%rip), %rdx     # 0x114d88
movq (%rdx,%rcx,8), %rcx
jmp 0xa1c0c
leaq 0x120(%rbx), %rcx
movq 0x8(%rbx), %rdx
movq %rdx, (%rsp)
movq (%rcx), %r15
movq 0x8(%rax), %r14
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
movq %rsi, 0x10(%rsp)
ja 0xa1c44
movq %rbx, %rdi
callq 0x9c27
movq 0x10(%rsp), %rsi
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x20001c, (%rax)       # imm = 0x20001C
movq 0x250(%rbx), %rcx
incq %rcx
movq %rcx, 0x250(%rbx)
movq %rcx, 0x18(%rax)
movq 0x18(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq %rax, 0x8(%rbx)
movq 0x90(%rbx), %rcx
leaq -0x8(%rcx), %rdx
movq %rdx, 0x90(%rbx)
movq -0x8(%rcx), %rcx
movq $0x20, (%rcx)
movq %r14, 0x8(%rcx)
movq %r15, 0x10(%rcx)
movq %rcx, 0x18(%r14)
movq 0x250(%rbx), %rdx
movq %rdx, 0x20(%r14)
incl 0x28(%r14)
andq $0x0, 0x18(%rcx)
movq %rcx, 0x8(%rax)
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsi), %rax
cmpq 0x110(%rbx), %rax
je 0xa1d7b
movq 0x1808(%rbx), %r15
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xa1d05
movq %rbx, %rdi
callq 0x9c27
movq 0x10(%rsp), %rsi
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r14
movq $0x200001, (%r14)       # imm = 0x200001
movq %r15, 0x8(%r14)
movq %rsi, 0x10(%r14)
movq %r14, 0x4d0(%rbx)
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r15
cmpq 0x98(%rbx), %rax
ja 0xa1d50
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rsi
movq $0x200001, (%rsi)       # imm = 0x200001
movq %r14, 0x8(%rsi)
movq %r15, 0x10(%rsi)
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xa21e1
jmp 0xa1d87
movq 0x8(%rsi), %r14
movq %rbx, %rdi
callq 0x38c23
movq %rax, %r15
testq %rax, %rax
je 0xa1e14
movzbl (%r12), %eax
cmpl $0x17, %eax
je 0xa2048
cmpl $0x16, %eax
je 0xa1f9d
cmpl $0x1, %eax
jne 0xa20e5
movb $0x1, %al
movq %r12, %rbp
cmpb $0x1, %al
sete %al
testb $0x1, %al
je 0xa1f87
movq 0x8(%rbp), %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rcx)
movq %rbx, %rdi
movq %r14, %rsi
callq *%r15
movq 0x10(%rbp), %rbp
xorl %eax, %eax
cmpb $0x1, (%rbp)
jne 0xa1dbd
movq 0x8(%rbp), %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rcx)
movq %rbx, %rdi
movq %r14, %rsi
callq *%r15
movq 0x10(%r12), %r12
movq 0x10(%rbp), %rbp
cmpq %r12, %rbp
je 0xa1f87
movb (%rbp), %al
jmp 0xa1db8
movq 0x10(%rsp), %rsi
orb $0x4, 0x3(%rsi)
movq (%rsp), %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rsi), %rax
cmpq 0x110(%rbx), %rax
jne 0xa1ece
cmpb $0x1, (%r12)
jne 0xa1ece
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xa1e60
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x1f, (%rax)
movq 0x110(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %r12, 0x10(%rax)
andq $0x0, 0x28(%rax)
movq 0x110(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r12, 0x8(%rax)
movq 0x50(%rbx), %rcx
movq %rbp, (%rcx)
movq 0x8(%rbx), %rcx
movq 0x50(%rbx), %rdx
movq %rcx, 0x8(%rdx)
movq 0x50(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x50(%rbx), %rax
movq $0x1fa, 0x18(%rax)      # imm = 0x1FA
addq $0x20, 0x50(%rbx)
jmp 0xa1f87
movq %r12, 0x4f0(%rbx)
cmpb $0x1d, (%r12)
je 0xa1eee
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa3c7
movq %rax, 0x4f0(%rbx)
movq 0x50(%rbx), %rax
movq %rbp, (%rax)
movq 0x8(%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x4f0(%rbx), %r14
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xa1f27
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x1f, (%rax)
movq 0x110(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %r14, 0x10(%rax)
andq $0x0, 0x28(%rax)
movq 0x110(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq 0x50(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x50(%rbx), %rax
movq $0x1f9, 0x18(%rax)      # imm = 0x1F9
addq $0x20, 0x50(%rbx)
movq 0x110(%rbx), %rax
movq %rax, 0x4f0(%rbx)
movq 0x130(%rbx), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r12), %rax
movq 0x10(%r12), %rcx
movq %rcx, (%rsp)
movq %rax, %r13
cmpq $0x3e9, %rax            # imm = 0x3E9
jl 0xa1fcb
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0xa2238
testb %al, %al
je 0xa2160
xorl %r12d, %r12d
testq %r13, %r13
cmovleq %r12, %r13
cmpq %r12, %r13
je 0xa1f87
movq (%rsp), %rax
movq (%rax,%r12,8), %rbp
cmpq $0x7ff, %rbp            # imm = 0x7FF
ja 0xa1ff8
leaq 0x7395e(%rip), %rax     # 0x115950
movq (%rax,%rbp,8), %rax
jmp 0xa2031
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xa2017
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %rbp, 0x8(%rax)
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rcx)
movq %rbx, %rdi
movq %r14, %rsi
callq *%r15
incq %r12
jmp 0xa1fd5
movq 0x8(%r12), %rbp
movq 0x10(%r12), %r13
cmpq $0x3e9, %rbp            # imm = 0x3E9
jl 0xa2070
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0xa2238
testb %al, %al
je 0xa219c
xorl %r12d, %r12d
testq %rbp, %rbp
cmovleq %r12, %rbp
cmpq %r12, %rbp
je 0xa1f87
movsd (%r13,%r12,8), %xmm0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xa20b3
movq %rbx, %rdi
movsd %xmm0, (%rsp)
callq 0x9c27
movsd (%rsp), %xmm0
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xd, (%rax)
movsd %xmm0, 0x8(%rax)
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rcx)
movq %rbx, %rdi
movq %r14, %rsi
callq *%r15
incq %r12
jmp 0xa207a
movq %r12, 0x4f0(%rbx)
cmpb $0x1d, (%r12)
je 0xa2101
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa3c7
movq %rax, %r12
movq 0x50(%rbx), %rax
movq %rbp, (%rax)
movq 0x50(%rbx), %rax
movq %r12, 0x10(%rax)
movq 0x50(%rbx), %rax
movq $0x1, 0x18(%rax)
addq $0x20, 0x50(%rbx)
movq 0x110(%rbx), %rax
movq %rax, 0x4f0(%rbx)
movq %rbx, %rdi
movq %r12, %rsi
callq *0x28(%r12)
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rcx)
testb $-0x80, 0x3(%r12)
je 0xa2156
movq %rbx, %rdi
movq %r14, %rsi
callq *%r15
jmp 0xa212f
addq $-0x20, 0x50(%rbx)
jmp 0xa1f87
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7c936
movq %rax, %rbp
movq 0x8(%rsp), %rax
movq %rbp, 0x10(%rax)
cmpq %r12, %r13
je 0xa1f87
movq (%rsp), %rax
movq (%rax,%r12,8), %rax
movq %rax, 0x8(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq *%r15
incq %r12
jmp 0xa2179
xorps %xmm0, %xmm0
movq %rbx, %rdi
callq 0xc0fe
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rsp)
movq %rcx, 0x10(%rax)
xorl %r12d, %r12d
cmpq %r12, %rbp
je 0xa1f87
movsd (%r13,%r12,8), %xmm0
movq (%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq *%r15
incq %r12
jmp 0xa21ba