// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: make_function
static s7_pointer make_function(s7_scheme *sc, const char *name, s7_function f, s7_int req, s7_int opt, bool rst, const char *doc, s7_pointer x, c_proc_t *ptr)
                {
                    uint32_t ftype = T_C_FUNCTION;
                    if (req == 0)
                    {
                        if (rst)
                            ftype = T_C_ANY_ARGS_FUNCTION;
                        else
                        {
                            if (opt != 0)
                                ftype = T_C_OPT_ARGS_FUNCTION;
                        }
                    }
                    else
                    {
                        if (rst)
                            ftype = T_C_RST_ARGS_FUNCTION;
                    }

                    set_type(x, ftype);

                    c_function_data(x) = ptr;
                    c_function_call(x) = f;               /* f is T_App but needs cast */
                    c_function_set_base(x, x);
                    c_function_set_setter(x, sc->F);
                    c_function_name(x) = name;            /* (procedure-name proc) => (format #f "~A" proc) */
                    c_function_name_length(x) = safe_strlen(name);
                    if (doc)
                        c_function_documentation(x) = make_permanent_c_string(sc, doc);
                    else c_function_documentation(x) = NULL;
                    c_function_signature(x) = sc->F;

                    c_function_required_args(x) = req;
                    c_function_optional_args(x) = opt;    /* T_C_FUNCTION_STAR type may be set later, so T_Fst not usable here */
                    if (rst)
                        c_function_all_args(x) = MAX_ARITY;
                    else c_function_all_args(x) = req + opt;

                    c_function_class(x) = ++sc->f_class;
                    c_function_chooser(x) = fallback_chooser;
                    c_function_opt_data(x) = NULL;
                    c_function_marker(x) = NULL;
                    c_function_symbol(x) = NULL;

                    return(x);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebp
movq %rcx, %r12
movq %rdi, %r14
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rbx
movq 0x50(%rsp), %r15
testq %rcx, %rcx
movq %r8, 0x10(%rsp)
je 0x30e17
movzbl %bpl, %ecx
leaq (%rcx,%rcx,2), %rcx
addq $0x30, %rcx
jmp 0x30e31
testb %bpl, %bpl
je 0x30e21
pushq $0x31
popq %rcx
jmp 0x30e31
xorl %ecx, %ecx
testq %r8, %r8
setne %cl
leaq 0x30(,%rcx,2), %rcx
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
movq %rdx, 0x10(%rbx)
movq %rbx, 0x28(%rax)
movq 0x120(%r14), %r13
movq 0x8(%rbx), %rax
movq %r13, 0x30(%rax)
movq 0x8(%rbx), %rax
movq %rsi, (%rax)
movq %rsi, %rdi
callq 0x8d06
movq 0x8(%rbx), %rcx
movl %eax, 0x8(%rcx)
testq %r15, %r15
je 0x30eb9
movq %r15, %rdi
callq 0x8d06
movq %rax, %r13
leaq 0x1(%rax), %rsi
movq %r14, %rdi
callq 0xd3b1
movq %r12, 0x8(%rsp)
movl %ebp, %r12d
movq %rax, %rbp
movq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x83e0
movb $0x0, (%rbp,%r13)
movq 0x8(%rbx), %rax
movq %rbp, 0x10(%rax)
movl %r12d, %ebp
movq 0x8(%rsp), %r12
movq 0x120(%r14), %r13
jmp 0x30ec2
movq 0x8(%rbx), %rax
andq $0x0, 0x10(%rax)
movq 0x8(%rbx), %rax
movq %r13, 0x38(%rax)
movq %r12, 0x18(%rbx)
movq 0x10(%rsp), %rcx
movq %rcx, 0x20(%rbx)
addq %r12, %rcx
testb %bpl, %bpl
movl $0x20000000, %eax       # imm = 0x20000000
cmoveq %rcx, %rax
movq %rax, 0x28(%rbx)
movl 0x224(%r14), %eax
incl %eax
movl %eax, 0x224(%r14)
movq 0x8(%rbx), %rcx
movl %eax, 0xc(%rcx)
movq 0x8(%rbx), %rax
leaq 0x4a66e(%rip), %rcx     # 0x7b57a
movq %rcx, 0x48(%rax)
movq 0x8(%rbx), %rax
andq $0x0, 0x20(%rax)
movq 0x8(%rbx), %rax
andq $0x0, 0x60(%rax)
movq 0x8(%rbx), %rax
andq $0x0, 0x58(%rax)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq