// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: s7_make_function_star
s7_pointer s7_make_function_star(s7_scheme *sc, const char *name, s7_function fnc, const char *arglist, const char *doc)
                {
                    s7_pointer func, local_args, p;
                    char *internal_arglist;
                    s7_int i, len, n_args;
                    s7_int gc_loc;
                    s7_pointer *names, *defaults;
                    block_t *b;

                    len = safe_strlen(arglist) + 8;
                    b = mallocate(sc, len);
                    internal_arglist = (char *)block_data(b);
                    catstrs_direct(internal_arglist, "'(", arglist, ")", NULL);
                    local_args = s7_eval_c_string(sc, internal_arglist);
                    gc_loc = s7_gc_protect_1(sc, local_args);
                    liberate(sc, b);
                    n_args = safe_list_length(local_args);  /* currently rest arg not supported, and we don't notice :allow-other-keys etc */

                    func = s7_make_function(sc, name, fnc, 0, n_args, false, doc);
                    set_type(func, T_C_FUNCTION_STAR | T_UNHEAP); /* unheap from s7_make_function */
                    c_function_call_args(func) = NULL;

                    names = (s7_pointer *)malloc(n_args * sizeof(s7_pointer));
                    c_function_arg_names(func) = names;
                    defaults = (s7_pointer *)malloc(n_args * sizeof(s7_pointer));
                    c_function_arg_defaults(func) = defaults;
                    c_func_set_simple_defaults(func);

                    for (p = local_args, i = 0; i < n_args; p = cdr(p), i++)
                    {
                        s7_pointer arg;
                        arg = car(p);
                        if (is_pair(arg)) /* there is a default */
                        {
                            names[i] = symbol_to_keyword(sc, car(arg));
                            defaults[i] = cadr(arg);
                            s7_remove_from_heap(sc, cadr(arg));
                            if ((is_pair(defaults[i])) ||
                                    (is_normal_symbol(defaults[i])))
                            {
                                c_func_clear_simple_defaults(func);
                                mark_function[T_C_FUNCTION_STAR] = mark_c_proc_star;
                            }
                        }
                        else
                        {
                            names[i] = symbol_to_keyword(sc, arg);
                            defaults[i] = sc->F;
                        }
                    }
                    s7_gc_unprotect_at(sc, gc_loc);
                    return(func);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movl $0x8, %esi
testq %rcx, %rcx
je 0x4097a
cmpb $0x0, (%r14)
je 0x4097a
movl $0x7, %eax
leaq 0x1(%rax), %rsi
cmpb $0x0, -0x7(%r14,%rax)
movq %rsi, %rax
jne 0x4096b
movq %rbx, %rdi
callq 0xa305
movq %rax, %rbp
movq (%rax), %r15
leaq 0xe2ad5(%rip), %rsi     # 0x123464
leaq 0xe4a5c(%rip), %rcx     # 0x1253f2
movq %r15, %rdi
movq %r14, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xd1cb
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3948a
movq %rax, %r14
cmpq $0x0, 0x108(%rbx)
jns 0x40a92
movq 0xd0(%rbx), %rax
movq 0xf0(%rbx), %r15
movq %r13, 0x20(%rsp)
leaq (%r15,%r15), %r13
movq 0x18(%rax), %rsi
movq %r12, 0x18(%rsp)
movq %r15, %r12
shlq $0x4, %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0xae0f
movq $0x0, 0x20(%rax)
movq 0xd0(%rbx), %rcx
movq %rax, 0x18(%rcx)
movq (%rax), %rax
movq 0xd0(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0xd0(%rbx), %rax
movq %r13, 0x8(%rax)
movq %r13, 0xf0(%rbx)
movq 0xe8(%rbx), %rdi
movq %r12, %rsi
movq 0x18(%rsp), %r12
callq 0x9510
movq %rax, 0xe8(%rbx)
cmpq %r13, %r15
movq 0x20(%rsp), %r13
jge 0x40a92
movq %r15, %rax
movq 0xd0(%rbx), %rcx
movq 0x140(%rbx), %rdx
movq 0x10(%rcx), %rcx
movq %rdx, (%rcx,%rax,8)
movq 0xe8(%rbx), %rcx
movq 0x108(%rbx), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x108(%rbx)
movq %rax, 0x8(%rcx,%rdx,8)
incq %rax
decq %r15
jne 0x40a56
movq 0xd0(%rbx), %rax
movq 0xe8(%rbx), %rcx
movq 0x108(%rbx), %rdx
leaq -0x1(%rdx), %rsi
movq %rsi, 0x108(%rbx)
movq (%rcx,%rdx,8), %r15
movq 0x10(%rax), %rax
movq %r14, (%rax,%r15,8)
movslq 0x8(%rbp), %rax
cmpq $0x11, %rax
jne 0x40aee
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x40ade
callq 0x9050
movq $0x0, (%rbp)
movl $0x0, 0x8(%rbp)
leaq 0x838(%rbx), %rax
jmp 0x40af8
leaq (%rbx,%rax,8), %rax
addq $0x838, %rax            # imm = 0x838
movq (%rax), %rcx
movq %rcx, 0x18(%rbp)
movq %rbp, (%rax)
cmpb $0x1, (%r14)
movq %r15, 0x20(%rsp)
jne 0x40b25
xorl %ebp, %ebp
movq %r14, %rax
movq 0x10(%rsp), %rcx
incq %rbp
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0x40b17
jmp 0x40b2c
xorl %ebp, %ebp
movq 0x10(%rsp), %rcx
movq %rcx, (%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x403e5
movq %rax, %r15
movabsq $0x400000000000002f, %rax # imm = 0x400000000000002F
movq %rax, (%r15)
movq 0x8(%r15), %rax
movq $0x0, 0x60(%rax)
leaq (,%rbp,8), %r13
movq %r13, %rdi
callq 0x9480
movq 0x8(%r15), %rcx
movq %rax, 0x10(%rsp)
movq %rax, 0x58(%rcx)
movq %r13, %rdi
callq 0x9480
movq %rax, %r13
movq 0x8(%r15), %rax
movq %r13, 0x50(%rax)
movq %r15, 0x18(%rsp)
orb $0x4, 0x2(%r15)
testq %rbp, %rbp
jle 0x40c52
xorl %r15d, %r15d
movq 0x8(%r14), %r12
cmpb $0x1, (%r12)
movq 0x8(%r12), %rax
jne 0x40c21
movq 0x8(%rax), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0xd108
movq 0x10(%rsp), %rcx
movq %rax, (%rcx,%r15,8)
movq 0x10(%r12), %rax
movq 0x8(%rax), %rax
movq %rax, (%r13,%r15,8)
movq 0x10(%r12), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xae85
movq (%r13,%r15,8), %rax
movzbl (%rax), %ecx
cmpl $0x1, %ecx
je 0x40c08
cmpl $0xa, %ecx
jne 0x40c42
testb $-0x80, 0x6(%rax)
jne 0x40c42
movq 0x18(%rsp), %rax
andb $-0x5, 0x2(%rax)
leaq 0x9a(%rip), %rax        # 0x40cb2
movq %rax, 0x10dcc9(%rip)    # 0x14e8e8
jmp 0x40c42
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0xd108
movq 0x10(%rsp), %rcx
movq %rax, (%rcx,%r15,8)
movq 0x120(%rbx), %rax
movq %rax, (%r13,%r15,8)
movq 0x10(%r14), %r14
incq %r15
cmpq %r15, %rbp
jne 0x40ba8
movq 0x20(%rsp), %r8
cmpq %r8, 0xf0(%rbx)
jle 0x40c9e
movq 0xd0(%rbx), %rax
movq 0x140(%rbx), %rcx
movq 0x10(%rax), %rdx
cmpq %rcx, (%rdx,%r8,8)
je 0x40c96
movq 0xe8(%rbx), %rdx
movq 0x108(%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, 0x108(%rbx)
movq %r8, 0x8(%rdx,%rsi,8)
movq 0x10(%rax), %rax
movq %rcx, (%rax,%r8,8)
movq 0x18(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq