// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xf8, %rsp
movq %rdi, 0xe8(%rsp)
movq 0xe8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movq 0x28(%rax), %rax
movl %eax, 0xdc(%rsp)
movq 0xb8(%rsp), %rax
movq (%rax), %rax
andq $0x200000, %rax         # imm = 0x200000
cmpq $0x0, %rax
je 0x46106
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x60(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x46136
movq 0xe8(%rsp), %rdi
movq 0xb8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0xe8(%rsp), %rax
movq 0x120(%rax), %rdx
callq 0xde940
movq %rax, 0xc0(%rsp)
movl $0x0, 0xe4(%rsp)
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xd0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0xc8(%rsp)
movl 0xe4(%rsp), %ecx
xorl %eax, %eax
cmpl 0xdc(%rsp), %ecx
movb %al, 0x77(%rsp)
jge 0x46190
movq 0xd0(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
sete %al
movb %al, 0x77(%rsp)
movb 0x77(%rsp), %al
testb $0x1, %al
jne 0x4619d
jmp 0x4695a
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movzwl 0x6(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x461d4
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x4691a
movq 0xc0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
cmpq 0xc8(%rsp), %rax
je 0x46221
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
orq $0x400000, %rcx         # imm = 0x400000
movq %rcx, (%rax)
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa8(%rsp)
jmp 0x461e4
jmp 0x46223
movq 0xa8(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x4625e
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
andq $-0x400001, %rcx        # imm = 0xFFBFFFFF
movq %rcx, (%rax)
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa8(%rsp)
jmp 0x46223
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, 0xb0(%rsp)
movl 0xe4(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movl 0x9c(%rsp), %ecx
xorl %eax, %eax
cmpl 0xdc(%rsp), %ecx
movb %al, 0x76(%rsp)
jge 0x462cf
movq 0xa0(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
sete %al
movb %al, 0x76(%rsp)
movb 0x76(%rsp), %al
testb $0x1, %al
jne 0x462dc
jmp 0x46636
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movzwl 0x6(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x463af
movq 0xa8(%rsp), %rax
movq (%rax), %rax
andq $0x400000, %rax         # imm = 0x400000
cmpq $0x0, %rax
je 0x4637d
movq 0xe8(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xe8(%rsp), %rax
movq 0x1940(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0xe8(%rsp), %rdi
movq 0x1dc89f(%rip), %rsi    # 0x222be0
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rcx
callq 0xf240
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0xf0(%rsp)
jmp 0x46a21
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
orq $0x400000, %rcx         # imm = 0x400000
movq %rcx, (%rax)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x465f6
movl $0x0, 0xe0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x90(%rsp)
movl 0xe0(%rsp), %eax
cmpl 0xdc(%rsp), %eax
jge 0x46427
movq 0xb0(%rsp), %rax
movslq 0xe0(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0xa0(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x463fe
jmp 0x46427
jmp 0x46400
movl 0xe0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe0(%rsp)
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x90(%rsp)
jmp 0x463ca
movl 0xe0(%rsp), %eax
cmpl 0xdc(%rsp), %eax
jne 0x464b6
movq 0xe8(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xe8(%rsp), %rax
movq 0x1940(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xe8(%rsp), %rdi
leaq 0x1a8c36(%rip), %rsi    # 0x1ef0aa
movl $0x19, %edx
callq 0xb880
movq 0x48(%rsp), %rdi
movq %rax, %rsi
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0xb830
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0xf0(%rsp)
jmp 0x46a21
movq 0x90(%rsp), %rax
movq (%rax), %rax
andq $0x400000, %rax         # imm = 0x400000
cmpq $0x0, %rax
je 0x46539
movq 0xe8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xe8(%rsp), %rax
movq 0x1940(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0xe8(%rsp), %rdi
movq 0x1dc6e3(%rip), %rsi    # 0x222be0
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rcx
callq 0xf240
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0xf0(%rsp)
jmp 0x46a21
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x465b5
movq 0xe8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xe8(%rsp), %rax
movq 0xea8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0xe8(%rsp), %rdi
movq 0x1d746b(%rip), %rsi    # 0x21d9e8
movq 0xb8(%rsp), %rdx
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rcx
callq 0xf240
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0xf0(%rsp)
jmp 0x46a21
movq 0x90(%rsp), %rax
movq (%rax), %rcx
orq $0x400000, %rcx         # imm = 0x400000
movq %rcx, (%rax)
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x465f8
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa8(%rsp)
jmp 0x462a4
movq 0xa0(%rsp), %rax
movq 0xe8(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x466b7
movq 0xe8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xe8(%rsp), %rax
movq 0x1900(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0xe8(%rsp), %rdi
movq 0x1dc569(%rip), %rsi    # 0x222be8
movq 0xb8(%rsp), %rdx
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rcx
callq 0xf240
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0xf0(%rsp)
jmp 0x46a21
movl 0x9c(%rsp), %eax
cmpl 0xdc(%rsp), %eax
jge 0x46905
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rax
movq %rax, 0xb0(%rsp)
movq 0xb8(%rsp), %rax
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x46791
movl 0xe4(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movl 0x9c(%rsp), %eax
cmpl 0xdc(%rsp), %eax
jge 0x4678c
movq 0xa8(%rsp), %rax
movq (%rax), %rax
andq $0x400000, %rax         # imm = 0x400000
cmpq $0x0, %rax
jne 0x46763
movq 0xb0(%rsp), %rax
movslq 0x9c(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x46765
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa8(%rsp)
jmp 0x4671c
jmp 0x46903
movl 0xe4(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movl 0x9c(%rsp), %eax
cmpl 0xdc(%rsp), %eax
jge 0x46901
movq 0xa8(%rsp), %rax
movq (%rax), %rax
andq $0x400000, %rax         # imm = 0x400000
cmpq $0x0, %rax
jne 0x468d5
movq 0xb0(%rsp), %rax
movslq 0x9c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0x46878
movq 0xe8(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0xde990
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x46841
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x4685b
movq 0xe8(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0xdead0
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x468d3
movq 0x88(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x468bd
movq 0xe8(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0xe8(%rsp), %rax
movq 0x110(%rax), %rdx
callq 0x2b5c0
movq %rax, %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x468d1
movq 0x88(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x468d3
jmp 0x468d5
jmp 0x468d7
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa8(%rsp)
jmp 0x467af
jmp 0x46903
jmp 0x46905
movq 0xc0(%rsp), %rax
movq %rax, 0xf0(%rsp)
jmp 0x46a21
jmp 0x4691c
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
movq 0xd0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xd0(%rsp)
movq 0xc8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc8(%rsp)
jmp 0x46165
movq 0xd0(%rsp), %rax
movq 0xe8(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x469d6
movq 0xe8(%rsp), %rax
movq %rax, (%rsp)
movq 0xe8(%rsp), %rax
movq 0x1900(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0xe8(%rsp), %rdi
movq 0x1dc246(%rip), %rsi    # 0x222be8
movq 0xb8(%rsp), %rdx
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rcx
callq 0xf240
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq %rax, 0xf0(%rsp)
jmp 0x46a21
movl 0xe4(%rsp), %eax
cmpl 0xdc(%rsp), %eax
jge 0x46a11
movq 0xe8(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movl 0xe4(%rsp), %edx
movl 0xdc(%rsp), %ecx
movq 0xc8(%rsp), %r8
callq 0xdfc00
movq 0xc0(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
addq $0xf8, %rsp
retq
nopw %cs:(%rax,%rax)