// File: /workspace/github_c_makefile_star2_O0/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:312: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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq 0x19d096(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0x20(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xbfe80
movq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x140(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xe0(%rbp)
callq 0xb5a0
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x58b74b3ddbc4f8b6, %rdx # imm = 0xA748B4C2243B074A
callq 0xc01a0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xb960
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
je 0x1534b
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1566d
movq -0x10(%rbp), %rdi
addq $0x58, %rdi
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xc2c0
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jl 0x155ba
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x68(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jne 0x154de
movq -0x68(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x153fe
movq -0x18(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x51d0
movq -0xe8(%rbp), %rdi
movq %rax, %rdx
leaq 0x11ef02(%rip), %rsi    # 0x1342d9
movb $0x0, %al
callq 0x4c80
movq %rax, -0x90(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1566d
movq -0x88(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x15464
movq -0x68(%rbp), %rax
addq $0x48, %rax
movq %rax, -0xf0(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x51d0
movq -0xf0(%rbp), %rdi
movq %rax, %rdx
leaq 0x11eeca(%rip), %rsi    # 0x134307
movb $0x0, %al
callq 0x7d20
movq %rax, -0x98(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0x98(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1566d
movq -0x10(%rbp), %rax
addq $0x58, %rax
movq %rax, -0x100(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9d3d0
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq %rax, %rdx
callq 0xd010
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x154d5
movq -0xa0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0xa8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1566d
jmp 0x154d7
jmp 0x154d9
jmp 0x155b8
movq -0x88(%rbp), %rax
testb $0x1, 0x29(%rax)
je 0x1555e
movq -0x10(%rbp), %rax
addq $0x58, %rax
movq %rax, -0x110(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9d3d0
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %rsi
movq %rax, %rdx
callq 0xd010
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0x1555c
movq -0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0xb8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1566d
jmp 0x155b6
movq -0x68(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x118(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x51d0
movq -0x118(%rbp), %rdi
movq %rax, %rdx
leaq 0x11f69b(%rip), %rsi    # 0x134c2a
movb $0x0, %al
callq 0x7d20
movq %rax, -0xc0(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0xc0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1566d
jmp 0x155b8
jmp 0x155e1
movq -0x10(%rbp), %rax
addq $0x58, %rax
movq %rax, -0x120(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9d3d0
movq -0x120(%rbp), %rdi
movq %rax, %rsi
callq 0x85f0
movq -0x68(%rbp), %rax
movabsq $0x242b13df94fa288, %rcx # imm = 0x242B13DF94FA288
cmpq %rcx, 0x20(%rax)
jne 0x1564e
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x138(%rax), %rax
movq 0x90(%rax), %rdi
movq -0x68(%rbp), %rsi
callq 0x11950
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0x1564c
movq -0xc8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0xd0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1566d
jmp 0x1564e
movq $0x0, -0xd8(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0720
movq -0xd8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw (%rax,%rax)