// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movb $0x0, 0x8f(%rsp)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x3a070
movq %rax, 0x90(%rsp)
movq 0x98(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
jne 0x9e6a6
cmpq $0x1, 0x90(%rsp)
jne 0x9e6a4
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x9e6a4
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x110(%rcx), %rax
jne 0x9e6a4
movb $0x1, 0x8f(%rsp)
jmp 0x9e708
movq 0x98(%rsp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x186846(%rip), %rax    # 0x224f00
testb $0x1, (%rax,%rcx)
jne 0x9e706
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0xa8(%rsp), %rax
movq 0xf18(%rax), %rdx
movq 0xa0(%rsp), %rcx
movq 0x186ae2(%rip), %r8     # 0x2251d0
movl $0x1, %r9d
callq 0x14130
movq %rax, 0xb0(%rsp)
jmp 0x9ede3
jmp 0x9e708
testb $0x1, 0x8f(%rsp)
jne 0x9e7c7
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x90(%rsp), %rdx
callq 0x3cbf0
testb $0x1, %al
jne 0x9e7c7
movq 0xa8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xa8(%rsp), %rax
movq 0x1900(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, (%rsp)
movq 0xa8(%rsp), %rdi
leaq 0x15562a(%rip), %rsi    # 0x1f3da1
movl $0x15, %edx
callq 0xb880
movq (%rsp), %rdi
movq %rax, %rsi
movq 0x98(%rsp), %rdx
movq 0x90(%rsp), %rcx
leaq 0x177ce1(%rip), %rax    # 0x216480
movq (%rax,%rcx,8), %rcx
callq 0xf240
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0xb0(%rsp)
jmp 0x9ede3
movq 0x98(%rsp), %rax
movq (%rax), %rax
andq $0x200000, %rax         # imm = 0x200000
cmpq $0x0, %rax
je 0x9eb97
movq 0x98(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x30, %eax
jl 0x9eb97
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x1cfd40
testb $0x1, %al
jne 0x9e815
jmp 0x9e831
movq 0xa8(%rsp), %rax
movq 0x130(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x9ede3
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x1cfe20
movq %rax, %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x4f0(%rax)
movq 0xa8(%rsp), %rax
movq 0x4f0(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x90(%rsp), %rax
movl %eax, %esi
movq 0xa8(%rsp), %rax
movq 0x110(%rax), %rdx
callq 0x32330
movq %rax, 0x60(%rsp)
movq 0xa8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x9e8d8
movq 0xa8(%rsp), %rdi
callq 0xc670
movq 0xa8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x60(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x70(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x4f0(%rax)
movq 0xa8(%rsp), %rax
movq 0x4f0(%rax), %rcx
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rax
movl $0x1, %ecx
movq %rcx, 0x18(%rax)
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x50(%rax)
cmpq $0x1, 0x90(%rsp)
jne 0x9ea87
movq 0xa8(%rsp), %rax
movq 0x4f0(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0xa8(%rsp), %rax
movq 0x4f0(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0xa8(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x4f0(%rax)
movq 0xa8(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xe430
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rsp), %rcx
movabsq $0x80000000, %rax       # imm = 0x80000000
andq (%rcx), %rax
cmpq $0x0, %rax
jne 0x9ea6e
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rcx
addq $-0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0xa8(%rsp), %rax
movq 0x130(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x9ede3
movq 0x80(%rsp), %rax
movq 0xa8(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq *%rax
jmp 0x9ea08
movq 0xa8(%rsp), %rax
movq 0x4f0(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0xa8(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x4f0(%rax)
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x9eb77
movq 0xa8(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0xe430
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rcx
movabsq $0x80000000, %rax       # imm = 0x80000000
andq (%rcx), %rax
cmpq $0x0, %rax
jne 0x9eb54
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rcx
addq $-0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0xa8(%rsp), %rax
movq 0x130(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x9ede3
jmp 0x9eb56
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x38(%rsp)
jmp 0x9ead5
movq 0x80(%rsp), %rax
movq 0xa8(%rsp), %rdi
movq 0x78(%rsp), %rcx
movq 0x10(%rcx), %rsi
callq *%rax
jmp 0x9eab9
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x28(%rax)
cmpq $0x1, 0x90(%rsp)
jne 0x9ec36
movq 0x98(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
jne 0x9ec36
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0x15cd60
cmpl $0x1, %eax
jne 0x9ec36
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
callq 0xc57c0
testb $0x1, %al
jne 0x9ec36
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdx
callq 0x15aca0
movq %rax, 0xb0(%rsp)
jmp 0x9ede3
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x1cfd40
testb $0x1, %al
jne 0x9ec55
jmp 0x9ec71
movq 0xa8(%rsp), %rax
movq 0x130(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x9ede3
jmp 0x9ec73
movq 0x98(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x1cfe20
movq %rax, 0x28(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x90(%rsp), %rax
movl %eax, %esi
movq 0xa8(%rsp), %rax
movq 0x110(%rax), %rdx
callq 0x32330
movq %rax, 0x20(%rsp)
movq 0xa8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x9ed18
movq 0xa8(%rsp), %rdi
callq 0xc670
movq 0xa8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rax
movl $0x1f8, %ecx            # imm = 0x1F8
movq %rcx, 0x18(%rax)
movq 0xa8(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0xa8(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x4f0(%rax)
movq 0xa8(%rsp), %rax
movq 0x130(%rax), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)