// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rdi, %rbx
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %r13
movq 0x8(%rcx), %rbp
movq 0x8(%rax), %r12
movb (%rbp), %al
movq %rax, 0x10(%rsp)
cmpb $0x1, %al
movq %rcx, 0x20(%rsp)
movq %r13, 0x30(%rsp)
jne 0xd4e0e
movq (%rbp), %rcx
movl %ecx, %eax
shrl $0x19, %eax
andl $0x1, %eax
movl %eax, 0x1c(%rsp)
leaq 0x110(%rbx), %rax
movq 0x110(%rbx), %r14
movq %rcx, 0x10(%rsp)
cmpb $0x1, %cl
jne 0xd4e2b
movq %rax, 0x28(%rsp)
movq %r14, 0x8(%rsp)
cmpb $0x1, (%r13)
jne 0xd4e32
movq 0x8(%rbp), %r14
cmpq 0x1890(%rbx), %r14
je 0xd4d53
movq 0x8(%r13), %r14
testb $-0x80, 0x6(%r14)
je 0xd4d9b
leaq 0x10(%r13), %r15
movq 0x10(%r13), %rax
cmpb $0x1, (%rax)
jne 0xd4dca
movq 0x8(%r14), %rcx
movq 0x20(%rcx), %rcx
movq 0x18(%rcx), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %r12, %rcx
movl $0x1, %r8d
callq 0xd51ff
cmpq 0x138(%rbx), %rax
jne 0xd4de4
btl $0x19, 0x10(%rsp)
jae 0xd4d1f
movq (%r15), %r15
addq $0x10, %r15
jmp 0xd4d40
cmpb $0x0, 0x24d(%rbx)
je 0xd4f9c
movq %r14, 0x10(%r12)
orb $0x40, 0x2(%r12)
movq 0x10(%rbp), %rbp
movq 0x18(%r12), %r12
movq (%r15), %r13
movb (%rbp), %al
cmpb $0x1, %al
je 0xd4ca4
jmp 0xd4e0c
movq 0x10(%rbp), %rbp
movq 0x8(%r13), %rax
testb $-0x80, 0x6(%rax)
je 0xd4d80
movq 0x10(%r13), %rcx
cmpb $0x1, (%rcx)
jne 0xd4d80
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
cmpq 0x8(%rbp), %rax
je 0xd51b7
movq 0x8(%rbp), %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0xd51ff
addq $0x10, %r13
jmp 0xd4dc5
movq (%r12), %rax
btl $0x16, %eax
jb 0xd512b
orq $0x400000, %rax         # imm = 0x400000
movq %rax, (%r12)
movq 0x8(%r13), %rax
movq %rax, 0x10(%r12)
addq $0x10, %r13
movq 0x8(%rsp), %r14
movq %r13, %r15
jmp 0xd4df0
cmpb $0x0, 0x24d(%rbx)
je 0xd517a
movq %r14, 0x10(%r12)
orb $0x40, 0x2(%r12)
jmp 0xd4deb
movq (%r15), %r15
addq $0x10, %r15
movq 0x8(%rsp), %r14
movq (%r15), %r13
movq 0x18(%r12), %r12
movq 0x10(%rbp), %rbp
movb (%rbp), %al
cmpb $0x1, %al
je 0xd4c9f
movq %r14, 0x8(%rsp)
jmp 0xd4e34
leaq 0x110(%rbx), %rax
movq 0x110(%rbx), %rcx
movq %rcx, 0x8(%rsp)
movl $0x0, 0x1c(%rsp)
jmp 0xd4e3e
movq %r14, 0x8(%rsp)
jmp 0xd4e3e
movb $0x1, %al
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rax
cmpq %rax, %r13
je 0xd4e7c
cmpq %rax, %rbp
je 0xd4e8b
cmpb $0xa, 0x10(%rsp)
jne 0xd4e7c
movq 0x8(%r13), %rax
testb $-0x80, 0x6(%rax)
je 0xd4e77
movq 0x10(%r13), %rcx
cmpb $0x1, (%rcx)
jne 0xd4e77
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
cmpq %rbp, 0x18(%rax)
je 0xd502f
movq %r13, 0x10(%r12)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
cmpq 0x1890(%rbx), %rax
je 0xd4e4b
cmpb $0x0, 0x1c(%rsp)
je 0xd4f35
cmpb $0x1, (%r13)
jne 0xd4e7c
leaq 0x128(%rbx), %rax
movq 0x8(%r13), %rdx
testb $-0x80, 0x6(%rdx)
je 0xd508e
movq 0x10(%r13), %rcx
cmpb $0x1, (%rcx)
jne 0xd508e
movq 0x8(%rdx), %rdx
movq 0x20(%rdx), %rdx
movq 0x18(%rdx), %rsi
movq 0x8(%rbx), %rdx
cmpb $0x1c, (%rdx)
jne 0xd4f0c
cmpq $0x0, 0x20(%rsi)
movq %rax, %rdi
je 0xd4f13
movq 0x8(%rdx), %rdx
movq %rax, %rdi
testq %rdx, %rdx
je 0xd4f13
cmpq %rsi, 0x8(%rdx)
je 0xd4f16
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
jne 0xd4ef8
movq %rax, %rdi
jmp 0xd4f13
addq $0x10, %rsi
movq %rsi, %rdi
movq (%rdi), %rdx
cmpb $0x20, (%rdx)
jne 0xd4f25
testb $0x40, 0x2(%rdx)
jne 0xd5117
movq 0x10(%rcx), %r13
cmpb $0x1, (%r13)
je 0xd4eb2
jmp 0xd4e7c
movq 0x1900(%rbx), %r15
movq 0x7e155(%rip), %r14     # 0x153098
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq 0x20(%rsp), %r12
movq %r12, %rsi
callq 0x99caa
cmpb $0xa, (%rax)
je 0xd4f6a
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 0x30(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0xd5167
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 0x42b04(%rip), %rax     # 0x117acc
movq %rax, 0x10(%r14)
movq $0x19, 0x8(%r14)
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x99caa
cmpb $0xa, (%rax)
je 0xd4ffb
movq 0x28(%rbx), %rax
cmpb $0x1, (%rax)
cmoveq %rax, %r15
movq %r15, %rax
movq 0x6f0(%rbx), %rcx
movq %r14, 0x8(%rcx)
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rax
movq %r13, 0x8(%rax)
movq 0x10(%rax), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x6f0(%rbx), %rdx
jmp 0xd510f
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 0x42a4a(%rip), %rcx     # 0x117aa4
movq %rcx, 0x10(%rax)
movq $0x27, 0x8(%rax)
movq 0x10(%r13), %rcx
movq 0x8(%rcx), %rcx
movq 0x6e8(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rbp, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0xd515d
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 0x42a2c(%rip), %rax     # 0x117ae6
movq %rax, 0x10(%r14)
movq $0x1c, 0x8(%r14)
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x99caa
cmpb $0xa, (%rax)
je 0xd50ed
movq 0x28(%rbx), %rax
cmpb $0x1, (%rax)
cmoveq %rax, %r15
movq %r15, %rax
movq 0x6e8(%rbx), %rcx
movq %r14, 0x8(%rcx)
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rax
movq %r13, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
movq %r12, %rsi
jmp 0xd5167
movq 0x1940(%rbx), %rsi
movq 0x7df6b(%rip), %rax     # 0x153090
movq 0x8(%rdx), %rcx
jmp 0xd513e
movq 0x1940(%rbx), %rsi
movq 0x7df57(%rip), %rax     # 0x153090
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
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x38dfa
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 0x428a5(%rip), %rax     # 0x117a4b
movq %rax, 0x10(%r14)
movq $0x31, 0x8(%r14)
jmp 0xd4fd4
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 0x428c2(%rip), %rcx     # 0x117aa4
movq %rcx, 0x10(%rax)
movq $0x27, 0x8(%rax)
movq 0x8(%rbp), %rcx
movq 0x10(%r13), %rdx
movq 0x8(%rdx), %rdx
jmp 0xd5142