// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: lambda_star_set_args
static inline s7_pointer lambda_star_set_args(s7_scheme *sc)
                {
                    bool allow_other_keys;
                    s7_pointer lx, cx, zx, code, args, slot;

                    code = sc->code;
                    args = sc->args;
                    cx = closure_args(code);
                    slot = let_slots(sc->envir);
                    allow_other_keys = ((is_pair(cx)) && (allows_other_keys(cx)));
                    lx = sc->args;
                    zx = sc->nil;
                    while ((is_pair(cx)) &&
                            (is_pair(lx)))
                    {
                        if (car(cx) == sc->key_rest_symbol)           /* the rest arg: a default is not allowed here (see check_lambda_star_args) */
                        {
                            /* next arg is bound to trailing args from this point as a list */
                            zx = sc->key_rest_symbol;
                            cx = cdr(cx);
                            if ((is_keyword(car(lx))) &&
                                    (is_pair(cdr(lx))) &&
                                    (keyword_symbol(car(lx)) == car(cx)))
                                return(s7_error(sc, sc->wrong_type_arg_symbol,
                                            set_elist_3(sc, wrap_string(sc, "can't set rest arg ~S to ~S via keyword", 39), car(cx), cadr(lx))));
                            lambda_star_argument_set_value(sc, car(cx), lx, slot, false);
                            lx = cdr(lx);
                            cx = cdr(cx);
                            slot = next_slot(slot);
                        }
                        else
                        {
                            s7_pointer car_lx;
                            car_lx = car(lx);
                            if (is_keyword(car_lx))
                            {
                                s7_pointer sym;
                                if (!is_pair(cdr(lx)))
                                {
                                    if (!sc->accept_all_keyword_arguments)
                                        return(s7_error(sc, sc->wrong_type_arg_symbol,
                                                    set_elist_4(sc, wrap_string(sc, "~A: keyword argument's value is missing: ~S in ~S", 49), closure_name(sc, code), lx, args)));
                                    slot_set_value(slot, car_lx);
                                    set_checked_slot(slot);
                                    lx = cdr(lx);
                                }
                                else
                                {
                                    sym = keyword_symbol(car_lx);
                                    if (lambda_star_argument_set_value(sc, sym, cadr(lx), slot, true) == sc->no_value)
                                    {
                                        /* if default value is a key, go ahead and use this value.
                                         *    (define* (f (a :b)) a) (f :c)
                                         * this has become much trickier than I anticipated...
                                         */
                                        if (allow_other_keys)
                                        {
                                            /* in CL: (defun hi (&key (a 1) &allow-other-keys) a) (hi :b :a :a 3) -> 3
                                             * in s7: (define* (hi (a 1) :allow-other-keys) a)    (hi :b :a :a 3) -> 3
                                             */
                                            lx = cddr(lx);
                                        }
                                        else
                                        {
                                            if (!sc->accept_all_keyword_arguments)
                                                return(s7_error(sc, sc->wrong_type_arg_symbol,
                                                            set_elist_4(sc, wrap_string(sc, "~A: unknown key: ~S in ~S", 25), closure_name(sc, code), lx, args)));
                                            slot_set_value(slot, car_lx);
                                            set_checked_slot(slot);
                                            lx = cdr(lx);
                                            cx = cdr(cx);
                                            slot = next_slot(slot);
                                        }
                                        continue;
                                    }
                                    lx = cddr(lx);
                                }
                                slot = next_slot(slot);
                            }
                            else                                  /* not a key/value pair */
                            {
                                if (is_checked_slot(slot))
                                    return(s7_error(sc, sc->wrong_type_arg_symbol, set_elist_3(sc, parameter_set_twice_string, slot_symbol(slot), sc->args)));
                                set_checked_slot(slot);
                                slot_set_value(slot, car(lx));
                                slot = next_slot(slot);
                                lx = cdr(lx);
                            }
                            cx = cdr(cx);
                        }
                    }
                    /* (let () (define* (hi (a 1) :allow-other-keys) a) (hi :a 2 32)) -> 'error */
                    /* (let () (define* (f (a :b)) a) (list (f) (f 1) (f :c) (f :a :c) (f :a 1) (f))) -> 'error */

                    /* check for trailing args with no :rest arg */
                    if (is_not_null(lx))
                    {
                        if ((is_not_null(cx)) ||
                                (zx == sc->key_rest_symbol))
                        {
                            if (is_symbol(cx))
                            {
                                if ((is_keyword(car(lx))) &&
                                        (is_pair(cdr(lx))) &&
                                        (keyword_symbol(car(lx)) == cx))
                                    return(s7_error(sc, sc->wrong_type_arg_symbol,
                                                set_elist_3(sc, wrap_string(sc, "can't set rest arg ~S to ~S via keyword", 39), cx, cadr(lx))));
                                slot_set_value(slot, lx);
                            }
                        }
                        else
                        {
                            if (!allow_other_keys)                       /* ((lambda* (a) a) :a 1 2) */
                                return(s7_error(sc, sc->wrong_number_of_args_symbol, set_elist_3(sc, too_many_arguments_string, closure_name(sc, code), args)));
                            /* check trailing args for repeated keys or keys with no values or values with no keys */
                            while (is_pair(lx))
                            {
                                if ((!is_keyword(car(lx))) ||     /* ((lambda* (a :allow-other-keys) a) :a 1 :b 2 3) */
                                        (!is_pair(cdr(lx))))          /* ((lambda* (a :allow-other-keys) a) :a 1 :b) */
                                    return(s7_error(sc, sc->wrong_type_arg_symbol,
                                                set_elist_3(sc, wrap_string(sc, "~A: not a key/value pair: ~S", 28), closure_name(sc, code), lx)));
                                slot = symbol_to_local_slot(sc, keyword_symbol(car(lx)), sc->envir);
                                if ((is_slot(slot)) &&
                                        (is_checked_slot(slot)))
                                    return(s7_error(sc, sc->wrong_type_arg_symbol, set_elist_3(sc, parameter_set_twice_string, slot_symbol(slot), sc->args)));
                                lx = cddr(lx);
                            }
                        }
                    }
                    return(sc->nil);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rcx), %r14
cmpb $0x1, (%r14)
movq %rcx, 0x8(%rsp)
jne 0xdd3c8
movb 0x3(%r14), %cl
andb $0x2, %cl
shrb %cl
movl %ecx, 0x4(%rsp)
jmp 0xdd3d0
movl $0x0, 0x4(%rsp)
movq 0x8(%rax), %r12
movq 0x110(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %r15
movb (%r14), %al
cmpb $0x1, %al
jne 0xdd69b
cmpb $0x1, (%r15)
jne 0xdd69b
movq 0x1890(%rbx), %r13
cmpq %r13, 0x8(%r14)
je 0xdd600
movq 0x8(%r15), %r13
testb $-0x80, 0x6(%r13)
jne 0xdd441
movq (%r12), %rax
btl $0x16, %eax
jb 0xdd48a
orq $0x400000, %rax         # imm = 0x400000
movq %rax, (%r12)
movq 0x8(%r15), %rax
movq %rax, 0x10(%r12)
movq 0x18(%r12), %r12
movq 0x10(%r15), %r15
jmp 0xdd5e4
leaq 0x10(%r15), %rbp
movq 0x10(%r15), %rax
cmpb $0x1, (%rax)
jne 0xdd4da
movq 0x8(%r13), %rcx
movq 0x20(%rcx), %rcx
movq 0x18(%rcx), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %r12, %rcx
movl $0x1, %r8d
callq 0xdd98c
cmpq 0x138(%rbx), %rax
je 0xdd5a3
movq (%rbp), %rbp
addq $0x10, %rbp
jmp 0xdd4ee
movq 0x1940(%rbx), %rsi
movq 0x7dbf8(%rip), %rax     # 0x15b090
movq 0x8(%r12), %rcx
movq 0x10(%rbx), %rdx
movq 0x6e8(%rbx), %rdi
movq %rax, 0x8(%rdi)
movq 0x10(%rdi), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdx, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
movq %rsi, 0x18(%rsp)
callq 0x3b366
movl $0x1, %eax
jmp 0xdd5ea
cmpb $0x0, 0x24d(%rbx)
je 0xdd500
movq %r13, 0x10(%r12)
orb $0x40, 0x2(%r12)
movq (%rbp), %r15
movq 0x18(%r12), %r12
xorl %eax, %eax
movb $0x1, %cl
jmp 0xdd5e0
movq 0x1940(%rbx), %rax
movq %rax, 0x18(%rsp)
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %r13
leal 0x1(%rcx), %eax
andl $0x7, %eax
movl %eax, 0x7dc(%rbx)
leaq 0x4340a(%rip), %rax     # 0x12093b
movq %rax, 0x10(%r13)
movq $0x31, 0x8(%r13)
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0xa05a7
cmpb $0xa, (%rax)
je 0xdd560
movq 0x28(%rbx), %rax
cmpb $0x1, (%rax)
cmovneq 0x8(%rsp), %rax
movq 0x6f0(%rbx), %rcx
movq %r13, 0x8(%rcx)
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rax
movq %r15, 0x8(%rax)
movq 0x10(%rax), %rax
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x6f0(%rbx), %rdx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x3b366
movl $0x1, %eax
jmp 0xdd5de
cmpb $0x0, 0x4(%rsp)
je 0xdd5b4
movq (%rbp), %rbp
addq $0x10, %rbp
jmp 0xdd5d5
cmpb $0x0, 0x24d(%rbx)
je 0xdd659
movq %r13, 0x10(%r12)
orb $0x40, 0x2(%r12)
movq 0x10(%r14), %r14
movq 0x18(%r12), %r12
movq (%rbp), %r15
movl $0x2, %eax
xorl %ecx, %ecx
testb %cl, %cl
je 0xdd5ea
movq 0x10(%r14), %r14
xorl %eax, %eax
cmpl $0x2, %eax
je 0xdd3e5
testl %eax, %eax
je 0xdd3e5
jmp 0xdd6da
movq 0x10(%r14), %r14
movq 0x8(%r15), %rax
testb $-0x80, 0x6(%rax)
je 0xdd62d
movq 0x10(%r15), %rcx
cmpb $0x1, (%rcx)
jne 0xdd62d
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
cmpq 0x8(%r14), %rax
je 0xdd911
movq 0x8(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0xdd98c
movq 0x10(%r15), %r15
movq 0x10(%r14), %r14
movq 0x18(%r12), %r12
movq %r13, 0x20(%rsp)
jmp 0xdd3e5
movq 0x1940(%rbx), %rax
movq %rax, 0x18(%rsp)
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %r13
leal 0x1(%rcx), %eax
andl $0x7, %eax
movl %eax, 0x7dc(%rbx)
leaq 0x43332(%rip), %rax     # 0x1209bc
movq %rax, 0x10(%r13)
movq $0x19, 0x8(%r13)
jmp 0xdd53d
movq 0x110(%rbx), %rcx
cmpq %rcx, %r15
je 0xdd6da
cmpq %rcx, %r14
je 0xdd6e9
cmpb $0xa, %al
jne 0xdd6da
movq 0x8(%r15), %rax
testb $-0x80, 0x6(%rax)
je 0xdd6d5
movq 0x10(%r15), %rcx
cmpb $0x1, (%rcx)
jne 0xdd6d5
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
cmpq %r14, 0x18(%rax)
je 0xdd80e
movq %r15, 0x10(%r12)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rcx
cmpq 0x1890(%rbx), %rcx
je 0xdd6ac
cmpb $0x0, 0x4(%rsp)
je 0xdd7a7
cmpb $0x1, (%r15)
jne 0xdd6da
leaq 0x128(%rbx), %rax
movq 0x8(%r15), %rdx
testb $-0x80, 0x6(%rdx)
je 0xdd86d
movq 0x10(%r15), %rcx
cmpb $0x1, (%rcx)
jne 0xdd86d
movq 0x8(%rdx), %rdx
movq 0x20(%rdx), %rdx
movq 0x18(%rdx), %rsi
movq 0x8(%rbx), %rdx
cmpb $0x1c, (%rdx)
jne 0xdd771
cmpq $0x0, 0x20(%rsi)
movq %rax, %r8
je 0xdd778
movq 0x8(%rdx), %rdx
movq %rax, %r8
testq %rdx, %rdx
sete %dil
je 0xdd778
cmpq %rsi, 0x8(%rdx)
je 0xdd79d
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
sete %dil
jne 0xdd759
movq %rax, %r8
jmp 0xdd778
addq $0x10, %rsi
movq %rsi, %r8
movq (%r8), %rdx
cmpb $0x20, (%rdx)
jne 0xdd78a
testb $0x40, 0x2(%rdx)
jne 0xdd8f9
movq 0x10(%rcx), %r15
cmpb $0x1, (%r15)
je 0xdd70f
jmp 0xdd6da
movq %rax, %r8
testb %dil, %dil
jne 0xdd778
jmp 0xdd77b
movq 0x1900(%rbx), %r15
movq 0x7d8e3(%rip), %r14     # 0x15b098
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0xa05a7
cmpb $0xa, (%rax)
je 0xdd7dc
movq 0x28(%rbx), %rax
cmpb $0x1, (%rax)
cmoveq %rax, %r12
movq %r12, %rax
movq 0x6e8(%rbx), %rcx
movq %r14, 0x8(%rcx)
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rax
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0xdd979
movq 0x1940(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x4315b(%rip), %rcx     # 0x120994
movq %rcx, 0x10(%rax)
movq $0x27, 0x8(%rax)
movq 0x10(%r15), %rcx
movq 0x8(%rcx), %rcx
movq 0x6e8(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %r14, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0xdd96f
movq 0x1940(%rbx), %r12
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %r14
leal 0x1(%rcx), %eax
andl $0x7, %eax
movl %eax, 0x7dc(%rbx)
leaq 0x4313d(%rip), %rax     # 0x1209d6
movq %rax, 0x10(%r14)
movq $0x1c, 0x8(%r14)
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq 0x8(%rsp), %r13
movq %r13, %rsi
callq 0xa05a7
cmpb $0xa, (%rax)
je 0xdd8cc
movq 0x28(%rbx), %rax
cmpb $0x1, (%rax)
cmoveq %rax, %r13
movq %r13, %rax
movq 0x6e8(%rbx), %rcx
movq %r14, 0x8(%rcx)
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rax
movq %r15, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
movq %r12, %rsi
jmp 0xdd979
movq 0x1940(%rbx), %rsi
movq 0x7d789(%rip), %rax     # 0x15b090
movq 0x8(%rdx), %rcx
movq 0x10(%rbx), %rdx
jmp 0xdd954
movq 0x1940(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x43058(%rip), %rcx     # 0x120994
movq %rcx, 0x10(%rax)
movq $0x27, 0x8(%rax)
movq 0x8(%r14), %rcx
movq 0x10(%r15), %rdx
movq 0x8(%rdx), %rdx
movq 0x6e8(%rbx), %rdi
movq %rax, 0x8(%rdi)
movq 0x10(%rdi), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdx, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3b366