// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: s7_apply_function
s7_pointer s7_apply_function(s7_scheme *sc, s7_pointer fnc, s7_pointer args)
                {
                    TRACK(sc);
#if S7_DEBUGGING
                    {
                        s7_pointer p;
                        int32_t argnum;
                        T_Pos(fnc);       /* not T_App here: (length (openlet (inlet 'length 8))) should raise an error */
                        for (argnum = 0, p = T_Pos(args); is_pair(p); argnum++, p = T_Pos(cdr(p)))
                            T_Pos(car(p));
                    }
#endif

                    set_current_code(sc, history_cons(sc, fnc, args));
                    if (is_c_function(fnc))
                        return(c_function_call(fnc)(sc, args));

                    push_stack(sc, OP_EVAL_DONE, sc->args, sc->code);
                    sc->code = fnc;
                    sc->args = (needs_copied_args(sc->code)) ? copy_list(sc, args) : args;
                    eval(sc, OP_APPLY);
                    /* we're limited in choices here -- the caller might be (say) car(sc->t1_1) = c_call(...) where the c_call
                     *   happens to fallback on a method -- we can't just push OP_APPLY and drop back into the evaluator normally.
                     */
                    return(sc->value);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movq %rsi, 0x28(%rdi)
cmpb $0x30, (%rsi)
jb 0xaf1a
movq 0x10(%rsi), %rax
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq (%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, (%rcx)
movq 0x8(%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x50(%rbx), %rax
movq $0x1df, 0x18(%rax)      # imm = 0x1DF
addq $0x20, 0x50(%rbx)
movq %rsi, (%rbx)
testb $0x10, 0x3(%rsi)
jne 0xaf5e
movq %r14, %r15
jmp 0xb043
cmpb $0x1, (%r14)
jne 0xb03c
movq %r14, 0x4c8(%rbx)
movq 0x8(%r14), %r12
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r13
cmpq 0x98(%rbx), %rax
ja 0xaf99
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r15
movq $0x200001, (%r15)       # imm = 0x200001
movq %r12, 0x8(%r15)
movq %r13, 0x10(%r15)
movq %r15, 0x4e8(%rbx)
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
jne 0xb025
movq %r15, %r12
movq 0x8(%r14), %r13
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %rbp
cmpq 0x98(%rbx), %rax
ja 0xaff5
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r13, 0x8(%rax)
movq %rbp, 0x10(%rax)
movq %rax, 0x10(%r12)
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
movq %rax, %r12
je 0xafcb
movq 0x110(%rbx), %rax
movq %rax, 0x4e8(%rbx)
movq %rax, 0x4c8(%rbx)
jmp 0xb043
movq 0x110(%rbx), %r15
movq %r15, 0x10(%rbx)
movl $0x198, %esi            # imm = 0x198
movq %rbx, %rdi
callq 0xfd85
movq 0x20(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq