// File: /workspace/github_c_makefile_star2_O1/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 0x83618
xorl %r14d, %r14d
incq %r14
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0x8360a
jmp 0x8361b
xorl %r14d, %r14d
movzbl (%r15), %eax
cmpq $0x28, %rax
jne 0x83643
cmpq $0x1, %r14
jne 0x83654
movq 0x8(%r15), %rax
cmpb $0x1, (%rax)
jne 0x83654
movq 0x10(%rax), %rax
cmpq 0x110(%rbx), %rax
jne 0x83654
jmp 0x8366a
leaq 0xd9d66(%rip), %rcx     # 0x15d3b0
cmpb $0x0, (%rax,%rcx)
je 0x83a53
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x41fac
testb %al, %al
je 0x837e2
testb $0x20, 0x2(%r15)
je 0x83856
cmpb $0x30, (%r15)
jb 0x83856
movq 0x10(%r12), %r13
cmpb $0x1, (%r13)
jne 0x836fd
movl $0x0, (%rsp)
leaq 0xd9d97(%rip), %rbp     # 0x15d430
movq 0x8(%r13), %rdx
movzbl (%rdx), %esi
movb $0x1, %cl
cmpb $0x0, (%rsi,%rbp)
jne 0x836e3
cmpq 0x110(%rbx), %rdx
je 0x836dc
movq 0xf18(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x140(%rbx), %rcx
movq 0xcf546(%rip), %r8      # 0x152c10
movq %rbx, %rdi
callq 0xfac8
testq %rax, %rax
setne %al
xorl %ecx, %ecx
jmp 0x836e3
movb $0x1, %cl
movl %ecx, (%rsp)
movb $0x1, %cl
testb %cl, %cl
je 0x836f5
movq 0x10(%r13), %r13
cmpb $0x1, (%r13)
je 0x83699
movl (%rsp), %eax
testb $0x1, %al
jne 0x83b07
movq 0x10(%r15), %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0x109034
movq %rax, %r15
movq %rax, 0x4f0(%rbx)
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3c5b5
movq %rax, %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x83743
movq %rbx, %rdi
callq 0xb389
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 0x83a83
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 0x83b02
movq %rbx, %rdi
movq %r14, %rsi
callq *%r13
jmp 0x837be
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 0xa1529(%rip), %rcx     # 0x124d36
movq %rcx, 0x10(%rax)
movq $0x15, 0x8(%rax)
leaq 0xcb130(%rip), %rcx     # 0x14e950
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 0x3b366
jmp 0x83b0e
movq (%rbx), %rax
movq %rax, 0x28(%rbx)
cmpq $0x1, %r14
jne 0x8392f
cmpb $0x28, (%r15)
jne 0x8392f
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd584c
cmpl $0x1, %eax
jne 0x8392f
movq 0x8(%r15), %rax
movq 0x8(%rax), %rax
testb $0x1, 0x3(%rax)
jne 0x8392f
testb $0x1, 0x6(%rax)
je 0x8390d
movq 0x8(%rbx), %rdx
movq 0x18(%rdx), %rdi
movq 0x20(%rax), %rsi
movl $0x18, %ecx
cmpq %rsi, %rdi
je 0x838fe
jle 0x838c2
movq 0x10(%rdx), %rdx
movq 0x18(%rdx), %rdi
cmpq %rdi, %rsi
jl 0x838b5
cmpq %rsi, %rdi
je 0x838fe
movl $0x10, %ecx
cmpb $0x1c, (%rdx)
jne 0x838fe
movq 0x8(%rdx), %rdi
testq %rdi, %rdi
sete %r8b
je 0x838f0
cmpq %rax, 0x8(%rdi)
je 0x838ea
movq 0x18(%rdi), %rdi
jmp 0x838d5
xorl %r8d, %r8d
movq %rdi, %rsi
testb %r8b, %r8b
je 0x83902
movq 0x10(%rdx), %rdx
cmpb $0x1c, (%rdx)
je 0x838d1
movq (%rax,%rcx), %rsi
cmpb $0x20, (%rsi)
jne 0x8390d
testb $0x1, 0x3(%rsi)
jne 0x8392f
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 0xd4d40
movq 0x10(%r12), %r13
cmpb $0x1, (%r13)
jne 0x839ad
movl $0x0, (%rsp)
leaq 0xd9ae7(%rip), %rbp     # 0x15d430
movq 0x8(%r13), %rdx
movzbl (%rdx), %esi
movb $0x1, %cl
cmpb $0x0, (%rsi,%rbp)
jne 0x83993
cmpq 0x110(%rbx), %rdx
je 0x8398c
movq 0xf18(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x140(%rbx), %rcx
movq 0xcf296(%rip), %r8      # 0x152c10
movq %rbx, %rdi
callq 0xfac8
testq %rax, %rax
setne %al
xorl %ecx, %ecx
jmp 0x83993
movb $0x1, %cl
movl %ecx, (%rsp)
movb $0x1, %cl
testb %cl, %cl
je 0x839a5
movq 0x10(%r13), %r13
cmpb $0x1, (%r13)
je 0x83949
movl (%rsp), %eax
testb $0x1, %al
jne 0x83b07
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 0x109034
movq %rax, %r15
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3c5b5
movq %rax, %r14
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x839fb
movq %rbx, %rdi
callq 0xb389
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 0x83b0e
movq 0xf18(%rbx), %rdx
movq 0xd9bbf(%rip), %r8      # 0x15d620
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 0xf3da
movq 0x110(%rbx), %rax
movq %rax, 0x4f0(%rbx)
movq 0x8(%r15), %r14
cmpb $0x1, (%r14)
sete %bpl
jne 0x83af1
movq %r12, (%rsp)
movq %r13, %r12
movq 0x10(%r15), %r13
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq *0x28(%rsi)
movq %rax, 0x8(%r13)
movq 0x8(%r14), %rax
testb $-0x80, 0x3(%rax)
je 0x83ad6
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
sete %bpl
jne 0x83aea
movq 0x10(%r13), %r13
jmp 0x83aaa
addq $-0x20, 0x50(%rbx)
movq 0x130(%rbx), %rax
movq %r12, %r13
movq %rax, %r12
jmp 0x83afb
movq %r12, %r13
movq (%rsp), %r12
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq *%r13
testb %bpl, %bpl
je 0x83a91
jmp 0x83b0e
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