// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: g_for_each
static s7_pointer g_for_each(s7_scheme *sc, s7_pointer args)
                {
#define H_for_each "(for-each proc object . objects) applies proc to each element of the objects traversed in parallel. \
                    Each object can be a list, string, vector, hash-table, or any other sequence."
#define Q_for_each s7_make_circular_signature(sc, 2, 3, sc->is_unspecified_symbol, sc->is_procedure_symbol, sc->is_sequence_symbol)

                    s7_pointer f;
                    s7_int len;
                    bool arity_ok = false;

                    /* try the normal case first */
                    f = car(args);                                /* the function */
                    len = safe_list_length(cdr(args));

                    if (is_closure(f))                            /* not lambda* that might get confused about arg names */
                    {
                        if ((len == 1) &&
                                (is_pair(closure_args(f))) &&
                                (is_null(cdr(closure_args(f)))))
                            arity_ok = true;
                    }
                    else
                    {
                        if (!is_applicable(f))
                            return(method_or_bust_with_type(sc, f, sc->for_each_symbol, args, something_applicable_string, 1));
                    }

                    if ((!arity_ok) &&
                            (!s7_is_aritable(sc, f, len)))
                        return(s7_error(sc, sc->wrong_number_of_args_symbol,
                                    set_elist_3(sc, wrap_string(sc, "for-each ~A: ~A args?", 21), f, small_int(len))));

                    /* if function is safe c func, do the for-each locally */
                    if ((is_safe_procedure(f)) &&
                            (is_c_function(f)))
                    {
                        s7_function func;
                        s7_pointer iters;

                        if (for_each_arg_is_null(sc, cdr(args))) return(sc->unspecified);

                        func = c_function_call(f);    /* presumably this is either display/write, or method call? */
                        sc->z = make_iterators(sc, args);
                        sc->z = cons(sc, sc->z, make_list(sc, len, sc->nil));
                        push_stack_no_let(sc, OP_GC_PROTECT, sc->args, sc->z); /* temporary GC protection */
                        if (len == 1)
                        {
                            s7_pointer x, y;
                            x = caar(sc->z);
                            y = cdr(sc->z);
                            sc->z = sc->nil;
                            while (true)
                            {
                                set_car(y, s7_iterate(sc, x));
                                if (iterator_is_at_end(x))
                                {
                                    /* not pop_stack here since that can clobber sc->code et al, and if this for-each call is
                                     *   being treated as safe, c_call(for-each) assumes everywhere that sc->code is left alone.
                                     */
                                    unstack(sc);
                                    /* free_cell(sc, x); */ /* 16-Jan-19 */
                                    return(sc->unspecified);
                                }
                                func(sc, y);
                            }
                        }
                        iters = sc->z;
                        sc->z = sc->nil;
                        while (true)
                        {
                            s7_pointer x, y;
                            for (x = car(iters), y = cdr(iters); is_pair(x); x = cdr(x), y = cdr(y))
                            {
                                set_car(y, s7_iterate(sc, car(x)));
                                if (iterator_is_at_end(car(x)))
                                {
                                    unstack(sc);
                                    return(sc->unspecified);
                                }
                            }
                            func(sc, cdr(iters));
                        }
                    }

                    set_current_code(sc, sc->code);
                    /* if closure call is straightforward, use OP_FOR_EACH_1 */
                    if ((len == 1) &&
                            (is_closure(f)) &&                        /* not lambda* that might get confused about arg names */
                            (closure_arity_to_int(sc, f) == 1) &&     /* not a rest arg: not is_pair: (lambda (x . args) arg) */
                            (!is_constant_symbol(sc, car(closure_args(f)))))
                        return(g_for_each_closure(sc, f, cadr(args)));

                    if (for_each_arg_is_null(sc, cdr(args))) return(sc->unspecified);

                    push_stack(sc, OP_FOR_EACH, cons(sc, make_iterators(sc, args), make_list(sc, len, sc->nil)), f);
                    sc->z = sc->nil;
                    return(sc->unspecified);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %rbx
movq 0x8(%rsi), %r15
movq 0x10(%rsi), %rdi
callq 0x313be
movq %rax, %r14
movzbl (%r15), %eax
cmpq $0x28, %rax
jne 0x64ae3
cmpq $0x1, %r14
jne 0x64af4
movq 0x8(%r15), %rax
cmpb $0x1, (%rax)
jne 0x64af4
movq 0x10(%rax), %rax
cmpq 0x110(%rbx), %rax
jne 0x64af4
jmp 0x64b0a
leaq 0xbf8c6(%rip), %rcx     # 0x1243b0
cmpb $0x0, (%rax,%rcx)
je 0x64c8f
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x32378
testb %al, %al
je 0x64c1b
movq (%r15), %rax
btl $0x15, %eax
setae %cl
cmpb $0x30, %al
setb %al
orb %cl, %al
jne 0x64cbd
movq 0x10(%r12), %rsi
movq %rbx, %rdi
callq 0xcc716
testb %al, %al
jne 0x64e0d
movq 0x10(%r15), %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0xcc76d
movq %rax, %r15
movq %rax, 0x4f0(%rbx)
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2ddf5
movq %rax, %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x64b83
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %rax, 0x4f0(%rbx)
movq 0x50(%rbx), %rcx
movq %rax, (%rcx)
movq 0x10(%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x50(%rbx), %rax
movq $0x1, 0x18(%rax)
addq $0x20, 0x50(%rbx)
movq 0x4f0(%rbx), %r15
cmpq $0x1, %r14
jne 0x64db0
movq 0x8(%r15), %rax
movq 0x10(%r15), %r14
movq 0x8(%rax), %r15
movq 0x110(%rbx), %rax
movq %rax, 0x4f0(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq *0x28(%r15)
movq %rax, 0x8(%r14)
testb $-0x80, 0x3(%r15)
je 0x64e08
movq %rbx, %rdi
movq %r14, %rsi
callq *%r13
jmp 0x64bf7
movq 0x1900(%rbx), %r12
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x831a0(%rip), %rcx     # 0xe7de6
movq %rcx, 0x10(%rax)
movq $0x15, 0x8(%rax)
leaq 0xb0cf7(%rip), %rcx     # 0x115950
movq (%rcx,%r14,8), %rcx
movq 0x6e8(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %r15, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2cdc0
jmp 0x64e14
movq 0xf18(%rbx), %rdx
movq 0xbf983(%rip), %r8      # 0x124620
pushq $0x1
popq %r9
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcf9a
movq (%rbx), %rax
movq %rax, 0x28(%rbx)
cmpq $0x1, %r14
jne 0x64cf8
cmpb $0x28, (%r15)
jne 0x64cf8
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa2581
cmpl $0x1, %eax
jne 0x64cf8
movq 0x8(%r15), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x72bfa
testb %al, %al
je 0x64e26
movq 0x10(%r12), %rsi
movq %rbx, %rdi
callq 0xcc716
testb %al, %al
jne 0x64e0d
movq 0x50(%rbx), %rax
movq %r15, (%rax)
movq 0x8(%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xcc76d
movq %rax, %r15
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2ddf5
movq %rax, %r14
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x64d62
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
movq 0x50(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x50(%rbx), %rax
movq $0x1f8, 0x18(%rax)      # imm = 0x1F8
addq $0x20, 0x50(%rbx)
movq 0x110(%rbx), %rax
movq 0x130(%rbx), %r12
movq %rax, 0x4f0(%rbx)
jmp 0x64e14
movq 0x110(%rbx), %rax
movq %rax, 0x4f0(%rbx)
leaq 0x8(%r15), %r14
addq $0x10, %r15
movq %r15, %r12
movq %r14, %rbp
movq (%rbp), %rbp
cmpb $0x1, (%rbp)
jne 0x64dfd
movq (%r12), %r12
movq 0x8(%rbp), %rsi
movq %rbx, %rdi
callq *0x28(%rsi)
movq %rax, 0x8(%r12)
movq 0x8(%rbp), %rax
testb $-0x80, 0x3(%rax)
je 0x64e08
addq $0x10, %rbp
addq $0x10, %r12
jmp 0x64dcc
movq (%r15), %rsi
movq %rbx, %rdi
callq *%r13
jmp 0x64dc6
addq $-0x20, 0x50(%rbx)
movq 0x130(%rbx), %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r12), %rax
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa1bc0