// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: set_c_function_star_args
static s7_pointer set_c_function_star_args(s7_scheme *sc)
                {
                    int32_t i, j, n_args;
                    s7_pointer arg, par, call_args, func;
                    s7_pointer *df;

                    func = sc->code;
                    n_args = c_function_all_args(func);     /* not counting keywords, I think */
                    if (is_safe_procedure(func))
                        call_args = c_function_call_args(func);
                    else call_args = protected_make_list(sc, c_function_optional_args(func), sc->F);

                    /* assume at the start that there are no keywords */
                    for (i = 0, arg = sc->args, par = call_args; (i < n_args) && (is_pair(arg)); i++, arg = cdr(arg), par = cdr(par))
                    {
                        if (!is_keyword(car(arg)))
                            set_car(par, car(arg));
                        else
                        {
                            s7_pointer kpar, karg;
                            int32_t ki;
                            /* oops -- there are keywords, change scanners (much duplicated code...)
                             *   setting checked on the call_args here rather than parsing the parameters to use add_symbol_to_list
                             */
                            for (kpar = call_args; kpar != par; kpar = cdr(kpar))
                                set_checked(kpar);
                            for (; is_pair(kpar); kpar = cdr(kpar))
                                clear_checked(kpar);
                            df = c_function_arg_names(func);
                            for (ki = i, karg = arg, kpar = par; (ki < n_args) && (is_pair(karg)); ki++, karg = cdr(karg), kpar = cdr(kpar))
                            {
                                if (!is_keyword(car(karg)))
                                {
                                    if (is_checked(kpar))
                                        return(s7_error(sc, sc->wrong_type_arg_symbol, set_elist_3(sc, parameter_set_twice_string, car(kpar), sc->args)));
                                    set_checked(kpar);
                                    set_car(kpar, car(karg));
                                }
                                else
                                {
                                    s7_pointer p;
                                    for (j = 0, p = call_args; j < n_args; j++, p = cdr(p))
                                        if (df[j] == car(karg))
                                            break;
                                    if (j == n_args)
                                        return(s7_error(sc, sc->wrong_type_arg_symbol,
                                                    set_elist_2(sc, wrap_string(sc, "~A: not a parameter name?", 25), car(karg))));
                                    if (is_checked(p))
                                        return(s7_error(sc, sc->wrong_type_arg_symbol, set_elist_3(sc, parameter_set_twice_string, car(p), sc->args)));
                                    if (!is_pair(cdr(karg)))
                                        return(s7_error(sc, sc->error_symbol, set_elist_3(sc, value_is_missing_string, func, car(karg))));
                                    set_checked(p);
                                    karg = cdr(karg);
                                    set_car(p, car(karg));
                                }
                            }
                            if (!is_null(karg))
                                return(s7_error(sc, sc->wrong_number_of_args_symbol, set_elist_3(sc, too_many_arguments_string, func, sc->args)));
                            if (ki < n_args)
                            {
                                df = c_function_arg_defaults(func);
                                if (c_func_has_simple_defaults(func))
                                {
                                    for (ki = i, kpar = par; ki < n_args; ki++, kpar = cdr(kpar))
                                        if (!is_checked(kpar))
                                            set_car(kpar, df[ki]);
                                }
                                else
                                {
                                    for (ki = i, kpar = par; ki < n_args; ki++, kpar = cdr(kpar))
                                        if (!is_checked(kpar))
                                        {
                                            s7_pointer defval;
                                            defval = df[ki];
                                            if (is_symbol(defval))
                                                set_car(kpar, lookup_checked(sc, defval));
                                            else
                                            {
                                                if (is_pair(defval))
                                                    set_car(kpar, s7_eval(sc, defval, sc->nil));
                                                else set_car(kpar, defval);
                                            }}}}
                            return(call_args);
                        }
                    }
                    if (!is_null(arg))
                        return(s7_error(sc, sc->wrong_number_of_args_symbol, set_elist_3(sc, too_many_arguments_string, func, sc->args)));
                    if (i < n_args)
                        fill_star_defaults(sc, func, i, n_args, par);
                    return(call_args);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rbp
movq 0x28(%rbp), %r15
movl %r15d, %ebx
testb $0x20, 0x2(%rbp)
jne 0x3624a
movq 0x20(%rbp), %rsi
movq 0x120(%r14), %rdx
movq %r14, %rdi
callq 0x7d146
movq %rax, %r11
jmp 0x36252
movq 0x8(%rbp), %rax
movq 0x60(%rax), %r11
leaq 0x10(%r14), %rax
xorl %r12d, %r12d
testl %r15d, %r15d
movl $0x0, %ecx
cmovgl %r15d, %ecx
movq %r11, %r13
movq (%rax), %rax
cmpl %r12d, %ecx
je 0x363ad
cmpb $0x1, (%rax)
jne 0x36294
movq 0x8(%rax), %rdx
testb $-0x80, 0x6(%rdx)
jne 0x362bd
movq %rdx, 0x8(%r13)
addq $0x10, %rax
movq 0x10(%r13), %r13
incq %r12
jmp 0x36268
cmpq 0x110(%r14), %rax
jne 0x363ba
movq %r14, %rdi
movq %rbp, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movq %r13, %r8
movq %r11, %rbx
callq 0x7d9ae
jmp 0x36458
movq %r11, %rcx
cmpq %r13, %rcx
je 0x362d7
orb $0x40, 0x2(%rcx)
movq 0x10(%rcx), %rcx
jmp 0x362c0
andb $-0x41, 0x2(%rcx)
movq 0x10(%rcx), %rcx
cmpb $0x1, (%rcx)
je 0x362cf
movq 0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
cmpl %r15d, %r12d
movl %r15d, %esi
cmovgl %r12d, %esi
movq %r13, %rdx
movl %r12d, %edi
cmpl %esi, %edi
je 0x363ad
cmpb $0x1, (%rax)
jne 0x3646d
movq 0x8(%rax), %r9
testb $-0x80, 0x6(%r9)
jne 0x3632d
movq (%rdx), %r8
btl $0x16, %r8d
jb 0x3650a
orq $0x400000, %r8          # imm = 0x400000
movq %r8, (%rdx)
movq %rdx, %r8
jmp 0x36396
xorl %r10d, %r10d
movq %r11, %r8
cmpq %r10, %rbx
je 0x363f0
cmpq %r9, (%rcx,%r10,8)
je 0x3634b
incq %r10
movq 0x10(%r8), %r8
jmp 0x36333
cmpl %r10d, %ebx
je 0x363f0
movq (%r8), %r10
btl $0x16, %r10d
jb 0x3651e
movq %rbp, (%rsp)
movl %esi, %ebp
movq %r15, %rsi
movq %r11, %r15
movq 0x10(%rax), %r11
cmpb $0x1, (%r11)
jne 0x36554
orq $0x400000, %r10         # imm = 0x400000
movq %r10, (%r8)
movq 0x10(%rax), %rax
movq %r15, %r11
movq %rsi, %r15
movl %ebp, %esi
movq (%rsp), %rbp
movq 0x8(%rax), %r9
movq %r9, 0x8(%r8)
incl %edi
movq 0x10(%rax), %rax
movq 0x10(%rdx), %rdx
jmp 0x362f4
cmpq 0x110(%r14), %rax
je 0x3645b
movq 0x1900(%r14), %rbx
movq 0xebcd0(%rip), %rax     # 0x122098
movq 0x10(%r14), %rcx
movq 0x6e8(%r14), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rbp, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x6e8(%r14), %rdx
jmp 0x3644d
movq 0x1940(%r14), %rbx
movq 0x820(%r14), %rcx
movslq 0x7dc(%r14), %rdx
movq (%rcx,%rdx,8), %rcx
incl %edx
andl $0x7, %edx
movl %edx, 0x7dc(%r14)
leaq 0xad16e(%rip), %rdx     # 0xe358a
movq %rdx, 0x10(%rcx)
movq $0x19, 0x8(%rcx)
movq 0x8(%rax), %rax
movq 0x6e0(%r14), %rdx
movq %rcx, 0x8(%rdx)
movq 0x6e0(%r14), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e0(%r14), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2cdc0
movq %rbx, %r11
movq %r11, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq 0x110(%r14), %rax
jne 0x363ba
movq 0x8(%rbp), %rax
movq 0x50(%rax), %rcx
testb $0x4, 0x2(%rbp)
jne 0x36586
cmpl %r15d, %r12d
cmovgl %r12d, %r15d
movq %rcx, (%rsp)
cmpq %r12, %r15
je 0x3645b
testb $0x40, 0x2(%r13)
jne 0x36501
movq (%rcx,%r12,8), %rbp
movzbl (%rbp), %eax
cmpl $0x1, %eax
je 0x364dc
cmpl $0xa, %eax
jne 0x364fa
movq %r14, %rdi
movq %rbp, %rsi
movq %r11, %rbx
callq 0x7d158
movq (%rsp), %rcx
movq %rbx, %r11
testq %rax, %rax
jne 0x364fd
movq %r14, %rdi
movq %rbp, %rsi
callq 0x7d1b2
jmp 0x364f1
movq 0x110(%r14), %rdx
movq %r14, %rdi
movq %rbp, %rsi
movq %r11, %rbx
callq 0x2ad8f
movq (%rsp), %rcx
movq %rbx, %r11
jmp 0x364fd
movq %rbp, %rax
movq %rax, 0x8(%r13)
incq %r12
movq 0x10(%r13), %r13
jmp 0x36497
movq 0x1940(%r14), %rbx
movq 0xebb78(%rip), %rax     # 0x122090
movq 0x8(%rdx), %rcx
jmp 0x36530
movq 0x1940(%r14), %rbx
movq 0xebb64(%rip), %rax     # 0x122090
movq 0x8(%r8), %rcx
movq 0x10(%r14), %rdx
movq 0x6e8(%r14), %rsi
movq %rax, 0x8(%rsi)
movq 0x10(%rsi), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdx, 0x8(%rax)
jmp 0x363e7
movq 0xea8(%r14), %rbx
movq 0xe694e(%rip), %rax     # 0x11ceb0
movq 0x6e8(%r14), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rax
movq (%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %r9, 0x8(%rax)
jmp 0x363e7
cmpl %r15d, %r12d
cmovgl %r12d, %r15d
cmpq %r12, %r15
je 0x3645b
testb $0x40, 0x2(%r13)
jne 0x365a5
movq (%rcx,%r12,8), %rax
movq %rax, 0x8(%r13)
incq %r12
movq 0x10(%r13), %r13
jmp 0x3658d