// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_list_values
static s7_pointer g_list_values(s7_scheme *sc, s7_pointer args)
                {
#define H_list_values "(list-values ...) returns its arguments in a list (internal to quasiquote)"
#define Q_list_values s7_make_circular_signature(sc, 1, 2, sc->is_list_symbol, sc->T)

                    /* list-values can't be replaced by list(-n) because (list-values (values)) -> () and anything can be #<values> (see s7test) */
                    s7_pointer x;
                    bool checked = false;

                    for (x = args; is_pair(x); x = cdr(x))
                    {
                        if (is_pair(car(x)))
                        {
                            if (is_checked(car(x)))
                                checked = true;
                        }
                        else
                        {
                            if (car(x) == sc->no_value) /* unchecked_car|cdr unrolled here is not faster */
                                break;
                        }
                    }
                    if (is_null(x))
                    {
                        if (checked)
                        {
                            sc->u = args;
                            check_heap_size(sc, 8192);
#if S7_DEBUGGING
                            if (tree_is_cyclic(sc, args))
                            {
                                fprintf(stderr, "%s[%d]: hit a cyclic list?\n", __func__, __LINE__);
                                abort();
                            }
#endif
                            return(copy_tree(sc, args)); /* copy_tree can't handle cyclic trees */
                        }
                        return((is_immutable(args)) ? copy_list(sc, args) : args);
                    }
                    /* if a macro expands into a recursive function with a macro argument as its body (or reasonable facsimile thereof),
                     *   and the safety (as in safe_closure) of the body changes from safe to unsafe, then (due to the checked bits
                     *   protecting against cycles in optimize_expression|syntax), the possible safe_closure call will not be fixed,
                     *   the safe_closure's assumption about the saved local frame will be violated, and we'll get "<arg> unbound".
                     *   examples:
                     *     (define-macro (badmac tst) `(let loop ((x 1)) (if (> x 0) (loop (- x 1)) ,tst)))
                     *     (badmac (vector 0))
                     *     (badmac (let ((x (lambda () 1))) (eq? x x)))
                     *     (define-macro (badmac1 tst) `(let () (define (badf x) (if (> x 0) (badf (- x 1)) ,tst)) (badf 1)))
                     *     (badmac1 (vector 0))
                     *     (badmac1 (let ((x (lambda () 1))) (eq? x x)))
                     * clear_all_optimizations assumes its argument has no cycles, and automatically calling copy_tree slows
                     *   everything down intolerably, so...
                     * if the checked bit is on in a macro expansion, that means we're re-expanding this macro, and therefore
                     *   have to copy the tree.
                     * we can't set_cdr(pc...) as in earlier versions of this code -- might be an embedded permanent list
                     */

                    /* splice out #<values>, (list-values (apply-values ())) -> () etc */
                    sc->w = sc->nil;
                    for (x = args; is_pair(x); x = cdr(x))
                        if (car(x) != sc->no_value)
                            sc->w = cons(sc, car(x), sc->w);
                    sc->u = sc->nil;
                    if (is_pair(sc->w))
                    {
                        x = safe_reverse_in_place(sc, sc->w);
                        sc->w = sc->nil;
                        return(x);
                    }
                    return(sc->nil);
                }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movb $0x0, 0x37(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xa1b87
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xa1b5a
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
andq $0x400000, %rax         # imm = 0x400000
cmpq $0x0, %rax
je 0xa1b58
movb $0x1, 0x37(%rsp)
jmp 0xa1b75
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x138(%rcx), %rax
jne 0xa1b73
jmp 0xa1b87
jmp 0xa1b75
jmp 0xa1b77
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x38(%rsp)
jmp 0xa1b1d
movq 0x38(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x110(%rcx), %rax
jne 0xa1c21
testb $0x1, 0x37(%rsp)
je 0xa1bde
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x4c8(%rax)
movq 0x48(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x34cc0
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0xdcc20
movq %rax, 0x50(%rsp)
jmp 0xa1da9
movq 0x40(%rsp), %rax
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0xa1c08
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x44270
movq %rax, 0x8(%rsp)
jmp 0xa1c12
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0xa1da9
movq 0x48(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movq 0x40(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xa1d2d
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x138(%rcx), %rax
je 0xa1d18
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq 0x4d8(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0xa1cb2
movq 0x48(%rsp), %rdi
callq 0xc670
movq 0x48(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x4d8(%rax)
jmp 0xa1d1a
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x38(%rsp)
jmp 0xa1c43
movq 0x48(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x4c8(%rax)
movq 0x48(%rsp), %rax
movq 0x4d8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xa1d98
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x4d8(%rax), %rsi
callq 0xe460
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0xa1da9
movq 0x48(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)