// File: /workspace/github_c_makefile_star2_O3/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
movq %rcx, %r10
movq %rdi, %r14
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rbx
testq %rcx, %rcx
je 0x3deac
movzbl %r9b, %ecx
leaq (%rcx,%rcx,2), %rcx
addq $0x30, %rcx
jmp 0x3dec6
movl $0x31, %ecx
testb %r9b, %r9b
jne 0x3dec6
xorl %ecx, %ecx
testq %r8, %r8
setne %cl
leaq 0x30(,%rcx,2), %rcx
movq 0x50(%rsp), %r13
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
movq %rdx, 0x10(%rbx)
movq %rbx, 0x28(%rax)
movq 0x120(%r14), %rax
movq 0x8(%rbx), %rcx
movq %rax, 0x30(%rcx)
movq 0x8(%rbx), %rcx
movq %rsi, (%rcx)
xorl %ecx, %ecx
testq %rsi, %rsi
je 0x3df09
cmpb $0x0, (%rsi)
je 0x3df09
xorl %ecx, %ecx
cmpb $0x0, 0x1(%rsi,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x3defe
movq 0x8(%rbx), %rdx
movl %ecx, 0x8(%rdx)
testq %r13, %r13
je 0x3df2f
cmpb $0x0, (%r13)
je 0x3df40
xorl %eax, %eax
leaq 0x1(%rax), %rbp
cmpb $0x0, 0x1(%r13,%rax)
movq %rbp, %rax
jne 0x3df1e
jmp 0x3df42
movq 0x8(%rbx), %rcx
movq $0x0, 0x10(%rcx)
jmp 0x3dfe0
xorl %ebp, %ebp
leaq 0x8(%rbp), %rax
movq %rax, %r15
andq $-0x8, %r15
movq 0x8c8(%r14), %r12
leaq (%r15,%r12), %rcx
cmpq $0x10000, %rcx          # imm = 0x10000
movq %r8, 0x10(%rsp)
movl %r9d, 0x4(%rsp)
movq %r10, 0x8(%rsp)
jbe 0x3df85
cmpq $0x200, %rax            # imm = 0x200
jb 0x3df8e
movq %r15, %rdi
callq 0x8480
movq %rax, %r12
jmp 0x3dfaf
movq 0x8d0(%r14), %rax
jmp 0x3dfa5
movl $0x10000, %edi          # imm = 0x10000
callq 0x8480
movq %rax, 0x8d0(%r14)
xorl %r12d, %r12d
movq %r15, %rcx
addq %rax, %r12
movq %rcx, 0x8c8(%r14)
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x83e0
movb $0x0, (%r12,%rbp)
movq 0x8(%rbx), %rax
movq %r12, 0x10(%rax)
movq 0x120(%r14), %rax
movq 0x10(%rsp), %r8
movl 0x4(%rsp), %r9d
movq 0x8(%rsp), %r10
movq 0x8(%rbx), %rcx
movq %rax, 0x38(%rcx)
movq %r10, 0x18(%rbx)
movq %r8, 0x20(%rbx)
addq %r10, %r8
testb %r9b, %r9b
movl $0x20000000, %eax       # imm = 0x20000000
cmoveq %r8, %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 0x5c0bb(%rip), %rcx     # 0x9a0e0
movq %rcx, 0x48(%rax)
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movq 0x8(%rbx), %rax
movq %rcx, 0x60(%rax)
movq 0x8(%rbx), %rax
movq %rcx, 0x58(%rax)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq