// File: /workspace/github_c_makefile_star2_O3/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 0x3e368
cmpb $0x0, (%r14)
je 0x3e368
movl $0x8, %eax
leaq 0x1(%rax), %rsi
cmpb $0x0, -0x7(%r14,%rax)
movq %rsi, %rax
jne 0x3e359
movq %rbx, %rdi
callq 0x9357
movq %rax, %rbp
movq (%rax), %r15
leaq 0xdc1f7(%rip), %rsi     # 0x11a574
leaq 0xde17e(%rip), %rcx     # 0x11c502
movq %r15, %rdi
movq %r14, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xc442
movq 0x110(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x36fd6
movq %rax, %r14
cmpq $0x0, 0x108(%rbx)
js 0x3e3bf
movq 0xe8(%rbx), %rax
jmp 0x3e488
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 0x9fd6
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 0x8510
movq %rax, 0xe8(%rbx)
cmpq %r13, %r15
movq 0x20(%rsp), %r13
jge 0x3e488
movq 0x140(%rbx), %rcx
movq %r15, %rdx
movq 0xd0(%rbx), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax,%rdx,8)
movq 0xe8(%rbx), %rax
movq 0x108(%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, 0x108(%rbx)
movq %rdx, 0x8(%rax,%rsi,8)
incq %rdx
decq %r15
jne 0x3e453
movq 0xd0(%rbx), %rcx
movq 0x108(%rbx), %rdx
leaq -0x1(%rdx), %rsi
movq %rsi, 0x108(%rbx)
movq (%rax,%rdx,8), %rdx
movq 0x10(%rcx), %rax
movq %rdx, 0x20(%rsp)
movq %r14, (%rax,%rdx,8)
movslq 0x8(%rbp), %rax
cmpq $0x11, %rax
jne 0x3e4e2
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x3e4d2
callq 0x8050
movq $0x0, (%rbp)
movl $0x0, 0x8(%rbp)
leaq 0x838(%rbx), %rax
jmp 0x3e4ec
leaq (%rbx,%rax,8), %rax
addq $0x838, %rax            # imm = 0x838
movq (%rax), %rcx
movq %rcx, 0x18(%rbp)
movq %rbp, (%rax)
cmpb $0x1, (%r14)
jne 0x3e514
xorl %ebp, %ebp
movq %r14, %rax
movq 0x10(%rsp), %rcx
incq %rbp
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0x3e506
jmp 0x3e51b
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 0x3ddd8
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 0x8480
movq 0x8(%r15), %rcx
movq %rax, 0x10(%rsp)
movq %rax, 0x58(%rcx)
movq %r13, %rdi
callq 0x8480
movq %rax, %r13
movq 0x8(%r15), %rax
movq %r13, 0x50(%rax)
movq %r15, 0x18(%rsp)
orb $0x4, 0x2(%r15)
testq %rbp, %rbp
jle 0x3e641
xorl %r15d, %r15d
movq 0x8(%r14), %r12
cmpb $0x1, (%r12)
movq 0x8(%r12), %rax
jne 0x3e610
movq 0x8(%rax), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0xc250
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 0xa04c
movq (%r13,%r15,8), %rax
movzbl (%rax), %ecx
cmpl $0x1, %ecx
je 0x3e5f7
cmpl $0xa, %ecx
jne 0x3e631
testb $-0x80, 0x6(%rax)
jne 0x3e631
movq 0x18(%rsp), %rax
andb $-0x5, 0x2(%rax)
leaq 0x9a(%rip), %rax        # 0x3e6a1
movq %rax, 0x1082da(%rip)    # 0x1468e8
jmp 0x3e631
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0xc250
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 0x3e597
movq 0x20(%rsp), %r8
cmpq %r8, 0xf0(%rbx)
jle 0x3e68d
movq 0xd0(%rbx), %rcx
movq 0x140(%rbx), %rax
movq 0x10(%rcx), %rdx
cmpq %rax, (%rdx,%r8,8)
je 0x3e689
movq 0xe8(%rbx), %rdx
movq 0x108(%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, 0x108(%rbx)
movq %r8, 0x8(%rdx,%rsi,8)
movq 0x10(%rcx), %rdx
movq %rax, (%rdx,%r8,8)
movq 0x18(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq