// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
movq %rsi, %rcx
cmpb $0x1, (%rcx)
jne 0x65f8d
movq 0x8(%rcx), %rdx
cmpb $0x1, (%rdx)
jne 0x65f7e
movb 0x2(%rdx), %dl
andb $0x40, %dl
shrb $0x6, %dl
orb %dl, %al
jmp 0x65f87
cmpq 0x138(%rbx), %rdx
je 0x65f8d
movq 0x10(%rcx), %rcx
jmp 0x65f63
movq 0x110(%rbx), %r15
cmpq %r15, %rcx
je 0x66033
movq %r15, 0x4d8(%rbx)
cmpb $0x1, (%r14)
jne 0x66004
movq 0x8(%r14), %r12
cmpq 0x138(%rbx), %r12
je 0x65ffe
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x65fd6
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 %r12, 0x8(%rax)
movq %r15, 0x10(%rax)
movq %rax, 0x4d8(%rbx)
movq %rax, %r15
movq 0x10(%r14), %r14
jmp 0x65fa4
movq 0x110(%rbx), %r14
movq %r14, 0x4c8(%rbx)
cmpb $0x1, (%r15)
jne 0x66068
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa833
movq 0x110(%rbx), %rcx
movq %rcx, 0x4d8(%rbx)
jmp 0x6606b
testb $0x1, %al
je 0x66061
movq %r14, 0x4c8(%rbx)
movl $0x2000, %esi           # imm = 0x2000
movq %rbx, %rdi
callq 0x2f187
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x7c76d
testb $0x1, 0x3(%r14)
jne 0x66077
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x35492