// File: /workspace/github_c_makefile_star2_O1/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
subq $0x38, %rsp
movq %rdi, %r14
movq (%rdi), %rbx
movq 0x28(%rbx), %r8
testb $0x20, 0x2(%rbx)
jne 0x46c9b
movl 0x20(%rbx), %esi
movq 0x120(%r14), %rdx
movq %r14, %rdi
movq %r8, %r15
callq 0x3c5b5
movq %r15, %r8
movq %rax, %rsi
movq %rax, 0x520(%r14)
jmp 0x46ca3
movq 0x8(%rbx), %rax
movq 0x60(%rax), %rsi
movq 0x10(%r14), %r12
xorl %eax, %eax
testl %r8d, %r8d
setg %cl
jle 0x46cf4
cmpb $0x1, (%r12)
jne 0x46cf4
leal -0x1(%r8), %ecx
xorl %eax, %eax
movq %rsi, %r13
movq %rax, %rbp
movq 0x8(%r12), %rax
testb $-0x80, 0x6(%rax)
jne 0x46cfc
movq %rax, 0x8(%r13)
movq 0x10(%r13), %r13
movq 0x10(%r12), %r12
cmpl %ebp, %ecx
je 0x4700a
leaq 0x1(%rbp), %rax
cmpb $0x1, (%r12)
je 0x46cc1
jmp 0x4700d
movq %rsi, %r13
jmp 0x47015
movq %rsi, %rax
cmpq %r13, %rsi
je 0x46d1e
movq %rsi, %rax
orb $0x40, 0x2(%rax)
movq 0x10(%rax), %rax
cmpq %r13, %rax
jne 0x46d07
jmp 0x46d1e
andb $-0x41, 0x2(%rax)
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0x46d16
cmpl %r8d, %ebp
setl %al
jge 0x46f0b
cmpb $0x1, (%r12)
jne 0x46f0b
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movl %r8d, %r9d
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movq %r13, %r10
movl %ebp, %r11d
movq %rdi, 0x20(%rsp)
movq %r9, 0x18(%rsp)
movq %r8, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x8(%r12), %rax
testb $-0x80, 0x6(%rax)
jne 0x46d95
movq (%r10), %rax
btl $0x16, %eax
jb 0x471ab
orq $0x400000, %rax         # imm = 0x400000
movq %rax, (%r10)
movq 0x8(%r12), %rax
movq %rax, 0x8(%r10)
jmp 0x46ee9
xorl %edx, %edx
movq %rsi, %rcx
cmpq %rax, (%rdi,%rdx,8)
je 0x46daf
incq %rdx
movq 0x10(%rcx), %rcx
cmpq %rdx, %r9
jne 0x46d9a
movl %r8d, %edx
cmpl %r8d, %edx
jne 0x46e17
movq 0x1940(%r14), %r15
movq 0x820(%r14), %rax
movslq 0x7dc(%r14), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%r14)
leaq 0xd96fa(%rip), %rcx     # 0x1204da
movq %rcx, 0x10(%rax)
movq $0x19, 0x8(%rax)
movq 0x8(%r12), %rcx
movq 0x6e0(%r14), %rdx
movq %rax, 0x8(%rdx)
movq 0x6e0(%r14), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x6e0(%r14), %rdx
jmp 0x46eac
movq (%rcx), %rdx
btl $0x16, %edx
jb 0x46e49
movq 0x10(%r12), %rsi
cmpb $0x1, (%rsi)
jne 0x46e7c
orq $0x400000, %rdx         # imm = 0x400000
movq %rdx, (%rcx)
movq 0x10(%r12), %r12
movq 0x8(%r12), %rax
movq %rax, 0x8(%rcx)
movb $0x1, %al
jmp 0x46edc
movq 0x1940(%r14), %r15
movq 0x114239(%rip), %rax    # 0x15b090
movq 0x8(%rcx), %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 0x46ea5
movq 0xea8(%r14), %r15
movq 0x10f026(%rip), %rcx    # 0x155eb0
movq 0x6e8(%r14), %rdx
movq %rcx, 0x8(%rdx)
movq 0x10(%rdx), %rcx
movq %rbx, 0x8(%rcx)
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e8(%r14), %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %r10, 0x10(%rsp)
movl %r11d, 0xc(%rsp)
callq 0x3b366
movl 0xc(%rsp), %r11d
movq 0x10(%rsp), %r10
movq 0x18(%rsp), %r9
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %r8
xorl %eax, %eax
testb %al, %al
movq 0x30(%rsp), %rsi
je 0x4716b
incl %r11d
movq 0x10(%r12), %r12
cmpl %r8d, %r11d
je 0x46f05
movq 0x10(%r10), %r10
cmpb $0x1, (%r12)
je 0x46d66
cmpl %r8d, %r11d
setl %al
cmpq 0x110(%r14), %r12
jne 0x4701e
testb %al, %al
je 0x47168
movq 0x8(%rbx), %rax
movq 0x50(%rax), %r15
testb $0x4, 0x2(%rbx)
jne 0x47182
cmpl %r8d, %ebp
jge 0x47168
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq %r8, %rbx
testb $0x40, 0x2(%r13)
jne 0x46fba
movq %rsi, %r12
movq (%r15,%rbp,8), %rsi
movzbl (%rsi), %eax
cmpl $0x1, %eax
je 0x46f9c
cmpl $0xa, %eax
jne 0x46fb0
movq 0x8(%r14), %rcx
movq 0x18(%rcx), %rdx
movq 0x20(%rsi), %rax
cmpq %rax, %rdx
je 0x46f85
jle 0x46f80
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %rdx
cmpq %rdx, %rax
jl 0x46f73
cmpq %rax, %rdx
jne 0x46fcf
movq 0x18(%rsi), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x46fb3
movq %r14, %rdi
callq 0xa2ee9
jmp 0x46fab
movq 0x110(%r14), %rdx
movq %r14, %rdi
callq 0x39527
movq %rbx, %r8
jmp 0x46fb3
movq %rsi, %rax
movq %rax, 0x8(%r13)
movq %r12, %rsi
incq %rbp
movq 0x10(%r13), %r13
cmpq %r8, %rbp
jne 0x46f45
jmp 0x47168
cmpb $0x1c, (%rcx)
jne 0x46ffd
movq 0x8(%rcx), %rdi
testq %rdi, %rdi
sete %dl
je 0x46ff0
cmpq %rsi, 0x8(%rdi)
je 0x46fec
movq 0x18(%rdi), %rdi
jmp 0x46fd8
movq 0x10(%rdi), %rax
testb %dl, %dl
je 0x46f8d
movq 0x10(%rcx), %rcx
cmpb $0x1c, (%rcx)
je 0x46fd4
movq 0x10(%rsi), %rax
cmpb $0x20, (%rax)
je 0x46f89
xorl %eax, %eax
jmp 0x46f8d
movl %r8d, %eax
incl %ebp
cmpl %r8d, %ebp
setl %cl
cmpq 0x110(%r14), %r12
je 0x47068
leaq 0x1900(%r14), %rax
leaq 0x11406c(%rip), %rcx    # 0x15b098
movq (%rax), %r15
movq (%rcx), %rax
movq 0x10(%r14), %rcx
movq 0x6e8(%r14), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rbx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x6e8(%r14), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3b366
jmp 0x4716b
testb %cl, %cl
je 0x47168
movq 0x8(%rbx), %rcx
movq 0x50(%rcx), %r15
testb $0x4, 0x2(%rbx)
jne 0x47147
cmpl %r8d, %eax
jge 0x47168
movq %rsi, %rbp
movl %eax, %ebx
movq (%r15,%rbx,8), %rsi
movzbl (%rsi), %eax
cmpl $0x1, %eax
je 0x470e0
cmpl $0xa, %eax
jne 0x470f7
movq 0x8(%r14), %rcx
movq 0x18(%rcx), %rdx
movq 0x20(%rsi), %rax
cmpq %rax, %rdx
je 0x470c6
jle 0x470c1
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %rdx
cmpq %rdx, %rax
jl 0x470b4
cmpq %rax, %rdx
jne 0x4710c
movq 0x18(%rsi), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x470fa
movq %r14, %rdi
movq %r8, %r12
callq 0xa2ee9
jmp 0x470f2
movq 0x110(%r14), %rdx
movq %r14, %rdi
movq %r8, %r12
callq 0x39527
movq %r12, %r8
jmp 0x470fa
movq %rsi, %rax
movq %rax, 0x8(%r13)
incq %rbx
movq 0x10(%r13), %r13
cmpl %r8d, %ebx
jl 0x47090
jmp 0x4717d
cmpb $0x1c, (%rcx)
jne 0x4713a
movq 0x8(%rcx), %rdi
testq %rdi, %rdi
sete %dl
je 0x4712d
cmpq %rsi, 0x8(%rdi)
je 0x47129
movq 0x18(%rdi), %rdi
jmp 0x47115
movq 0x10(%rdi), %rax
testb %dl, %dl
je 0x470ce
movq 0x10(%rcx), %rcx
cmpb $0x1c, (%rcx)
je 0x47111
movq 0x10(%rsi), %rax
cmpb $0x20, (%rax)
je 0x470ca
xorl %eax, %eax
jmp 0x470ce
cmpl %r8d, %eax
jge 0x47168
movl %eax, %ecx
leaq (%r15,%rcx,8), %rcx
movq (%rcx), %rdx
movq %rdx, 0x8(%r13)
movq 0x10(%r13), %r13
addq $0x8, %rcx
incl %eax
cmpl %r8d, %eax
jl 0x47152
movq %rsi, %r15
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %r15
jmp 0x4716b
cmpl %r8d, %ebp
jge 0x47168
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
testb $0x40, 0x2(%r13)
jne 0x4719d
movq (%r15,%rbp,8), %rax
movq %rax, 0x8(%r13)
incq %rbp
movq 0x10(%r13), %r13
cmpq %rbp, %r8
jne 0x4718e
jmp 0x47168
leaq 0x1940(%r14), %rax
movq 0x8(%r10), %rbx
leaq 0x113ed3(%rip), %rcx    # 0x15b090
jmp 0x4702c