// File: /workspace/github_c_makefile_star2_O3/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), %rax
cmpb $0x1, (%rax)
jne 0x7d499
xorl %r14d, %r14d
incq %r14
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0x7d462
movb (%r15), %al
cmpb $0x28, %al
jne 0x7d4a3
cmpq $0x1, %r14
jne 0x7d4b7
movq 0x8(%r15), %rax
movl $0x1, %r14d
cmpb $0x1, (%rax)
jne 0x7d4b7
movq 0x10(%rax), %rax
cmpq 0x110(%rbx), %rax
jne 0x7d4b7
jmp 0x7d4c9
movb (%r15), %al
xorl %r14d, %r14d
cmpb $0x28, %al
je 0x7d4b7
movzbl %al, %eax
leaq 0xd7f03(%rip), %rcx     # 0x1553b0
cmpb $0x0, (%rax,%rcx)
je 0x7d5a4
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3f86f
testb %al, %al
je 0x7d530
movq (%r15), %rax
btl $0x15, %eax
setae %cl
cmpb $0x30, %al
setb %al
orb %cl, %al
jne 0x7d5d4
movq 0x10(%r12), %rax
cmpb $0x1, (%rax)
jne 0x7d6d0
xorl %esi, %esi
leaq 0xd7f39(%rip), %rcx     # 0x155430
movq 0x8(%rax), %rdx
movzbl (%rdx), %edi
cmpb $0x0, (%rdi,%rcx)
je 0x7d512
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0x7d4f7
jmp 0x7d6c6
cmpq 0x110(%rbx), %rdx
jne 0x7d8d9
movq 0x10(%rax), %rax
movb $0x1, %sil
cmpb $0x1, (%rax)
je 0x7d4f7
jmp 0x7d8c0
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 0x9e8eb(%rip), %rcx     # 0x11be46
movq %rcx, 0x10(%rax)
movq $0x15, 0x8(%rax)
leaq 0xc93e2(%rip), %rcx     # 0x146950
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 0x38dfa
jmp 0x7d8c7
movq 0xf18(%rbx), %rdx
movq 0xd806e(%rip), %r8      # 0x155620
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rcx
movl $0x1, %r9d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe659
movq (%rbx), %rax
movq %rax, 0x28(%rbx)
cmpq $0x1, %r14
jne 0x7d676
cmpb $0x28, (%r15)
jne 0x7d676
movq %rbx, %rdi
movq %r15, %rsi
callq 0xccf45
cmpl $0x1, %eax
jne 0x7d676
movq 0x8(%r15), %rax
movq 0x8(%rax), %rax
movq (%rax), %rcx
btl $0x18, %ecx
jb 0x7d676
btq $0x30, %rcx
jae 0x7d654
movq 0x8(%rbx), %rdx
movq 0x18(%rdx), %rdi
movq 0x20(%rax), %rsi
movl $0x18, %ecx
cmpq %rsi, %rdi
je 0x7d645
jle 0x7d63c
movq 0x10(%rdx), %rdx
movq 0x18(%rdx), %rdi
cmpq %rdi, %rsi
jl 0x7d62f
cmpq %rsi, %rdi
jne 0x7d92f
movq (%rax,%rcx), %rsi
cmpb $0x20, (%rsi)
jne 0x7d654
testb $0x1, 0x3(%rsi)
jne 0x7d676
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 0xcc3ca
movq 0x10(%r12), %rax
cmpb $0x1, (%rax)
jne 0x7d7bf
xorl %esi, %esi
leaq 0xd7da3(%rip), %rcx     # 0x155430
movq 0x8(%rax), %rdx
movzbl (%rdx), %edi
cmpb $0x0, (%rdi,%rcx)
je 0x7d6a8
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0x7d68d
jmp 0x7d7b5
cmpq 0x110(%rbx), %rdx
jne 0x7d904
movq 0x10(%rax), %rax
movb $0x1, %sil
cmpb $0x1, (%rax)
je 0x7d68d
jmp 0x7d8c0
testb $0x1, %sil
jne 0x7d8c0
movq 0x10(%r15), %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0xffcc5
movq %rax, %r15
movq %rax, 0x4f0(%rbx)
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a029
movq %rax, %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x7d71d
movq %rbx, %rdi
callq 0xa550
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 0x7d862
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 0x7d8bb
movq %rbx, %rdi
movq %r14, %rsi
callq *%r13
jmp 0x7d791
testb $0x1, %sil
jne 0x7d8c0
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 0xffcc5
movq %rax, %r15
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a029
movq %rax, %r14
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x7d814
movq %rbx, %rdi
callq 0xa550
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 0x7d8c7
movq 0x110(%rbx), %rax
movq %rax, 0x4f0(%rbx)
leaq 0x10(%r15), %r14
movq 0x8(%r15), %r12
cmpb $0x1, (%r12)
jne 0x7d8b0
movq %r14, %rbp
movq (%rbp), %rbp
movq 0x8(%r12), %rsi
movq %rbx, %rdi
callq *0x28(%rsi)
movq %rax, 0x8(%rbp)
movq 0x8(%r12), %rax
testb $-0x80, 0x3(%rax)
je 0x7d8bb
addq $0x10, %rbp
movq 0x10(%r12), %r12
cmpb $0x1, (%r12)
je 0x7d882
movq (%r14), %rsi
movq %rbx, %rdi
callq *%r13
jmp 0x7d874
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 0xf18(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x140(%rbx), %rcx
movq 0xcd31e(%rip), %r8      # 0x14ac10
movq %rbx, %rdi
callq 0xed2a
testq %rax, %rax
jne 0x7d8c0
jmp 0x7d6d0
movq 0xf18(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x140(%rbx), %rcx
movq 0xcd2f3(%rip), %r8      # 0x14ac10
movq %rbx, %rdi
callq 0xed2a
testq %rax, %rax
jne 0x7d8c0
jmp 0x7d7bf
movl $0x10, %ecx
cmpb $0x1c, (%rdx)
jne 0x7d645
movq 0x8(%rdx), %rsi
testq %rsi, %rsi
je 0x7d956
cmpq %rax, 0x8(%rsi)
je 0x7d649
movq 0x18(%rsi), %rsi
jmp 0x7d941
movq 0x10(%rdx), %rdx
jmp 0x7d934