// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore.xo.c
// Function: x_btcl_function_s_call
er_t x_btcl_function_s_call( x_btcl_function_s* o, x_source_point_s* source_point, x_btcl_frame_s* lexical_frame, bcore_arr_sr_s* arg_list, sr_s* result )
{
    // bcore_x_btcl.x:811:1
    
    const x_btcl_signature_s* signature = o->signature;
    if( arg_list->size < signature->arg_list.size )
    {
        sr_s_asm(result,x_btcl_function_s_setup_wrapped_function(x_btcl_function_s_create(),o, arg_list) );
        return  0;
    }
    else if( arg_list->size == signature->arg_list.size )
    {
        if( o->block )
        {BLM_INIT_LEVEL(3);
            x_btcl_frame_s* frame = ((x_btcl_frame_s*)BLM_LEVEL_T_PUSH(3,x_btcl_frame_s,x_btcl_frame_s_create()));
            BLM_TRY(x_btcl_function_s_setup_frame(o,lexical_frame, source_point, frame ))
            for(sz_t i = 0; i < signature->arg_list.size; i++ ) sr_s_fork_from(x_btcl_frame_s_var_set(frame,signature->arg_list.data[ i ], sr_null() ),&(arg_list->data[ i ] ));
            sr_s_clear(result);
            BLM_TRY(x_btcl_block_s_eval(o->block,frame, result ))
            x_btcl_clone_if_weak(result );
        BLM_DOWN();}
        else if( o->external_function )
        {
            BLM_TRY(x_btcl_external_function_s_execute(o->external_function,source_point, lexical_frame, arg_list, result ))
        }
        else if( o->wrapped_function )
        {BLM_INIT_LEVEL(4);
            bcore_arr_sr_s* full_arg_list = ((bcore_arr_sr_s*)BLM_LEVEL_T_PUSH(4,bcore_arr_sr_s,bcore_arr_sr_s_create()));
            for(sz_t i = 0; i < o->wrapped_arg_list->size; i++ ) sr_s_fork_from(bcore_arr_sr_s_push_sr(full_arg_list,sr_null() ),&(o->wrapped_arg_list->data[ i ] ));
            for(sz_t i = 0; i < arg_list->size          ; i++ ) sr_s_fork_from(bcore_arr_sr_s_push_sr(full_arg_list,sr_null() ),&(arg_list->data[ i ] ));
            BLM_TRY(x_btcl_function_s_call(o->wrapped_function,source_point, lexical_frame, full_arg_list, result ))
        BLM_DOWN();}
        else
        {
            BLM_TRY(x_source_point_s_parse_error_fa(source_point,"Internal error: Function is incomplete.\n" ))
        }
    
        // chain of functions ...
        if( o->tail )
        {
            BLM_TRY(x_btcl_function_s_call_unary(o->tail,source_point, lexical_frame, result, result ))
        }
        return  0;
    }
    else
    {
        BLM_TRY(x_source_point_s_parse_error_fa(source_point,"Too many arguments. Function accepts #<sz_t> argument#<sc_t>.\n", signature->arg_list.size, signature->arg_list.size != 1 ? "s" : "" ))
    }
    return  0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x68149
movq -0x30(%rbp), %rax
movq %rax, -0x1a0(%rbp)
callq 0x67b60
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x67d30
movq -0x1a0(%rbp), %rdi
movq %rax, %rsi
callq 0x5e240
movq $0x0, -0x8(%rbp)
jmp 0x6872a
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jne 0x686ab
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x68347
leaq 0x14a1bb(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xbfe80
movq -0x78(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq $0x3, 0x10(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x1a8(%rbp)
callq 0x5a570
movq -0x1a8(%rbp), %rdi
movq %rax, %rcx
movl $0x3, %esi
movabsq $-0x8f0f83b86d2b0b3, %rdx # imm = 0xF70F07C4792D4F4D
callq 0xc01a0
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rcx
callq 0x67f40
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x68224
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6872a
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x682da
movq -0x80(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x98(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x1b0(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x8a380
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
leaq -0xb0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x5a8d0
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
imulq $0x18, -0x98(%rbp), %rax
addq %rax, %rsi
callq 0xfc070
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x6822f
movq -0x30(%rbp), %rdi
callq 0x45560
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x80(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x5e490
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x68330
movq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0xc0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6872a
movq -0x30(%rbp), %rdi
callq 0x5dec0
leaq -0x78(%rbp), %rdi
callq 0xc06e0
jmp 0x68639
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x683b2
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x67850
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0x683ad
movq -0xc8(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq 0x149f9b(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0xd0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6872a
jmp 0x68637
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x685e3
leaq 0x149f68(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
leaq -0x108(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0xbfe80
movq -0x110(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq $0x4, 0x10(%rax)
movq -0xd8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movb $0x0, %al
callq 0x97ba0
movq -0x1c0(%rbp), %rdi
movq %rax, %rcx
movl $0x4, %esi
movabsq $-0x78ea303a4f284a4, %rdx # imm = 0xF8715CFC5B0D7B5C
callq 0xc01a0
movq %rax, -0x118(%rbp)
movq $0x0, -0x120(%rbp)
movq -0x120(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jae 0x684e6
movq -0x118(%rbp), %rax
movq %rax, -0x1c8(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x8a380
movq -0x1c8(%rbp), %rdi
leaq -0x138(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x97f40
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rsi
imulq $0x18, -0x120(%rbp), %rax
addq %rax, %rsi
callq 0xfc070
movq -0x120(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
jmp 0x68455
movq $0x0, -0x140(%rbp)
movq -0x140(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x6857a
movq -0x118(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x8a380
movq -0x1d0(%rbp), %rdi
leaq -0x158(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x97f40
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
imulq $0x18, -0x140(%rbp), %rax
addq %rax, %rsi
callq 0xfc070
movq -0x140(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x140(%rbp)
jmp 0x684f1
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x118(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x680d0
movq %rax, -0x160(%rbp)
cmpq $0x0, -0x160(%rbp)
je 0x685d5
movq -0x160(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x110(%rbp), %rdi
callq 0xc0720
movq -0x168(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6872a
leaq -0x110(%rbp), %rdi
callq 0xc06e0
jmp 0x68635
movq -0x18(%rbp), %rdi
leaq 0xd8363(%rip), %rsi     # 0x140951
movb $0x0, %al
callq 0x68020
movq %rax, -0x170(%rbp)
cmpq $0x0, -0x170(%rbp)
je 0x68633
movq -0x170(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq 0x149d15(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x178(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6872a
jmp 0x68635
jmp 0x68637
jmp 0x68639
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x686a1
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x65790
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x180(%rbp)
je 0x6869f
movq -0x180(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq 0x149ca9(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x188(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6872a
jmp 0x686a1
movq $0x0, -0x8(%rbp)
jmp 0x6872a
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rsi
leaq 0xea35c(%rip), %rcx     # 0x152a22
leaq 0xd8f3f(%rip), %rax     # 0x14160c
cmpq $0x1, %rsi
cmovneq %rax, %rcx
leaq 0xd829e(%rip), %rsi     # 0x14097a
movb $0x0, %al
callq 0x68020
movq %rax, -0x190(%rbp)
cmpq $0x0, -0x190(%rbp)
je 0x6871e
movq -0x190(%rbp), %rax
movq %rax, -0x198(%rbp)
leaq 0x149c27(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x198(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6872a
jmp 0x68720
jmp 0x68722
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopw (%rax,%rax)