// File: /workspace/github_c_makefile_star2_O3/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 0x176c8a(%rip), %rax    # 0x19bdd0
movq (%rax), %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xd6675
movq $0x0, 0x10(%rbx)
movq 0xc8(%r14), %rax
movq 0x140(%rax), %r12
callq 0x196b9
movabsq $-0x58b74b3ddbc4f8b6, %rdx # imm = 0xA748B4C2243B074A
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0xd68a8
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1a013
testq %rax, %rax
je 0x251a6
movq %rax, %r13
jmp 0x2528f
leaq 0x58(%r14), %r13
movq 0x68(%r14), %rax
testq %rax, %rax
je 0x25212
movq 0x8(%rbx), %rsi
movq 0x60(%r14), %rdx
xorl %ebp, %ebp
movq (%rdx,%rbp,8), %rcx
cmpq %rsi, 0x8(%rcx)
je 0x251d1
incq %rbp
cmpq %rbp, %rax
jne 0x251bd
jmp 0x25212
testq %rbp, %rbp
js 0x25212
movq 0x20(%rcx), %rax
cmpq 0x20(%rbx), %rax
jne 0x252ab
cmpq $0x0, 0x38(%rbx)
je 0x252f1
cmpq $0x0, 0x38(%rcx)
je 0x252b1
addq $0x48, %rbx
movq %r12, %rdi
callq 0xe3d7
leaq 0x108da5(%rip), %rsi    # 0x12dfb2
jmp 0x252df
movq %rbx, %rdi
callq 0xbe7e4
movq (%r13), %rsi
movq %r13, %rdi
movq %rax, %rdx
callq 0x55b79
movabsq $0x242b13df94fa288, %rax # imm = 0x242B13DF94FA288
cmpq %rax, 0x20(%rbx)
jne 0x2528c
movq 0xc8(%r14), %rax
movq 0x138(%rax), %rax
movq 0x90(%rax), %rax
movq 0x138(%rax), %rcx
cmpb $0x0, 0x170(%rcx)
je 0x2527e
addq $0x48, %rbx
leaq 0x10a0f7(%rip), %rsi    # 0x12f360
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13254
testq %rax, %rax
jne 0x2519e
jmp 0x2528c
movb $0x1, 0x170(%rcx)
movq %rbx, 0x140(%rax)
xorl %r13d, %r13d
leaq 0x8(%rsp), %rdi
callq 0xd6d2c
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x1, 0x29(%rcx)
jne 0x252cc
movq %rbx, %rdi
callq 0xbe7e4
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x1c007
jmp 0x25229
addq $0x48, %rbx
movq %r12, %rdi
callq 0xe3d7
leaq 0x10967b(%rip), %rsi    # 0x12e95a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x13254
jmp 0x2519e
movq %r12, %rdi
callq 0xe3d7
leaq 0x108c84(%rip), %rsi    # 0x12df84
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde10
jmp 0x2519e