// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_stamp_s_parse_func
er_t xoico_stamp_s_parse_func( xoico_stamp_s* o, x_source* source )
{
    // xoico_stamp.x:386:1
    BLM_INIT_LEVEL(0);
    xoico_compiler_s* compiler = o->group->compiler;
    xoico_func_s* func = ((xoico_func_s*)BLM_LEVEL_T_PUSH(0,xoico_func_s,xoico_func_s_create()));
    BLM_TRY(xoico_func_s_parse(func,((const xoico_host*)(o)), source ))
    
    sz_t idx = xoico_funcs_s_get_index_from_name(&(o->funcs),func->name );
    
    if( idx >= 0 )
    {
        xoico_func_s* prex_func = o->funcs.data[ idx ];
        if( ( prex_func->signature_global_name == func->signature_global_name ) )
        {
            if( !func->body )
            {
                BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Function '#<sc_t>' has already been declared.", xoico_compiler_s_nameof(compiler,func->name ) ))
            }
            else if( prex_func->body )
            {
                BLM_RETURNV(er_t, x_source_point_s_parse_error_fa(&(func->source_point),"Function '#<sc_t>' has already a body.", xoico_compiler_s_nameof(compiler,func->name ) ))
            }
            else
            {
                BLM_TRY(xoico_funcs_s_replace_d(&(o->funcs),idx, ((xoico_func_s*)bcore_fork(func)) ))
            }
        }
        else if( prex_func->overloadable )
        {
            BLM_TRY(xoico_funcs_s_replace_d(&(o->funcs),idx, ((xoico_func_s*)bcore_fork(func)) ))
        }
        else
        {
            BLM_RETURNV(er_t, x_source_point_s_parse_error_fa(&(func->source_point),"Function '#<sc_t>' has already been declared and is not overloadable.", xoico_compiler_s_nameof(compiler,func->name ) ))
        }
    }
    else
    {
        x_array_push_d(((x_array*)(&(o->funcs))),((x_inst*)(((xoico_func_s*)bcore_fork(func)) )));
    }
    
    if( func->signature_global_name == ((tp_t)(TYPEOF_x_inst_main)) ) BLM_TRY(xoico_target_s_set_main_function(o->group->xoico_source->target,func ))
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x101d09(%rip), %rax    # 0x117dd0
movq (%rax), %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x717f5
andq $0x0, 0x10(%rbx)
movq 0xc8(%r14), %rax
movq 0x140(%rax), %r13
callq 0x10ebb
movabsq $-0x58b74b3ddbc4f8b6, %rdx # imm = 0xA748B4C2243B074A
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x71967
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x110b6
testq %rax, %rax
je 0x1613b
movq %rax, %r12
leaq 0x8(%rsp), %rdi
callq 0x71b64
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, (%rsp)
leaq 0x58(%r14), %r13
movq 0x8(%rbx), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x11598
testq %rax, %rax
js 0x1619a
movq %rax, %r12
movq 0x60(%r14), %rax
movq (%rax,%r12,8), %rax
movq 0x20(%rax), %rcx
cmpq 0x20(%rbx), %rcx
jne 0x161af
cmpq $0x0, 0x38(%rbx)
je 0x16232
cmpq $0x0, 0x38(%rax)
je 0x161b5
addq $0x48, %rbx
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0xdad8
leaq 0x94e1d(%rip), %rsi     # 0xaafb2
jmp 0x16220
movq %rbx, %rdi
callq 0x6026d
movq %r13, %rdi
movq %rax, %rsi
callq 0xf6dd
jmp 0x161cb
cmpb $0x1, 0x29(%rax)
jne 0x16209
movq %rbx, %rdi
callq 0x6026d
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x11c29
movabsq $0x242b13df94fa288, %rax # imm = 0x242B13DF94FA288
cmpq %rax, 0x20(%rbx)
jne 0x16201
movq 0xc8(%r14), %rax
movq 0x138(%rax), %rax
movq 0x90(%rax), %rdi
movq %rbx, %rsi
callq 0x14319
testq %rax, %rax
jne 0x1611c
xorl %r12d, %r12d
jmp 0x1611f
addq $0x48, %rbx
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0xdad8
leaq 0x9573a(%rip), %rsi     # 0xab95a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xf256
jmp 0x1611c
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0xdad8
leaq 0x94d3f(%rip), %rsi     # 0xaaf84
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xd7c4
jmp 0x1611c