// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_func_s_parse
er_t xoico_func_s_parse( xoico_func_s* o, const xoico_host* host, x_source* source )
{
    // xoico_func.x:104:1
    BLM_INIT_LEVEL(0);
    xoico_compiler_s* compiler = xoico_host_a_compiler(host);
    
    x_source_point_s_setup_from_source(&(o->source_point),source );
    
    if( x_source_parse_bl(source," #?'('" ) ) // old style enclosed signature
    {
        BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Signature-enclosure '( ...sig... )' is deprecated." ))
    }
    
    // We first try parsing a direct signature. If that fails, we assume the signature is referenced by an identifier.
    // This allows parsing without old style bracket enclosing. If that is a save practice under all circumstances is to be seen.
    s3_t index = x_source_get_index(source);
    xoico_signature_s* signature = ((xoico_signature_s*)BLM_LEVEL_T_PUSH(0,xoico_signature_s,xoico_signature_s_create()));
    
    if( xoico_signature_s_parse(signature,host, source ) != 0 )
    {
        bcore_error_remove_last();
        x_source_set_index(source,index );
        signature = NULL;
    }
    
    if( signature )
    {
        BLM_TRY(xoico_compiler_s_life_a_push(compiler,((bcore_inst*)(((xoico_signature_s*)bcore_fork(signature)) ))))
        o->pre_hash = bcore_tp_fold_tp( o->pre_hash, xoico_signature_s_get_hash(signature) );
        o->name = signature->name;
        BLM_TRY(xoico_compiler_s_register_item(compiler,((const xoico*)(signature ))))
        o->signature_global_name = signature->global_name;
        xoico_signature_s_attach( &(o->signature ),  xoico_signature_s_clone(signature));
        BLM_TRY(xoico_signature_s_relent(o->signature,host, xoico_host_a_obj_type(host) ))
        if( xoico_host_defines_transient_map(host) ) BLM_TRY(xoico_signature_s_convert_transient_types(o->signature,host, xoico_host_a_transient_map(host) ))
    }
    else // use of external signature definition
    {
        tp_t tp_signature_base_name = 0;
        tp_t tp_signature_global_name = 0;
    
        if( x_source_parse_bl(source," #?'^'" ) )
        {
            if( host->_ == ((tp_t)(TYPEOF_xoico_stamp_s)) )
            {
                tp_signature_base_name = ((const xoico_stamp_s*)(host))->trait_name;
            }
            else
            {
                BLM_RETURNV(er_t, x_source_parse_error_fa(source,"'^' can only be used inside a stamp." ))
            }
            BLM_TRY(x_source_parse_fa(source," ." ))
        }
        else
        {
            tp_t name = 0;
            BLM_TRY(xoico_host_a_parse_name_tp(host,source, (&(name)) ))
            if( x_source_parse_bl(source," #?'.'" ) )
            {
                tp_signature_base_name = name;
            }
            else
            {
                sz_t idx = -1;
                if( host->_ == ((tp_t)(TYPEOF_xoico_stamp_s)) && ( idx = xoico_funcs_s_get_index_from_name(&(((const xoico_stamp_s*)(host))->funcs),name ) ) >= 0 )
                {
                    tp_signature_global_name = ((const xoico_stamp_s*)(host))->funcs.data[ idx ]->signature_global_name;
                }
                else
                {
                    tp_signature_base_name = xoico_a_get_global_name_tp(((const xoico*)(host)));
                }
                o->name = name;
            }
        }
    
        if( !o->name )
        {BLM_INIT_LEVEL(2);
            st_s st_name;BLM_T_INIT_SPUSH(st_s, &st_name);;
            BLM_TRY(x_source_parse_fa(source," #name", (&(st_name)) )) // empty name is allowed
            o->name = xoico_compiler_s_entypeof(compiler,st_name.sc );
        BLM_DOWN();}
    
        if( !tp_signature_global_name )
        {BLM_INIT_LEVEL(2);
            tp_signature_global_name = xoico_compiler_s_entypeof(compiler,((st_s*)BLM_LEVEL_T_PUSH(2,st_s,st_s_create_fa("#<sc_t>_#<sc_t>", xoico_compiler_s_nameof(compiler,tp_signature_base_name ), xoico_compiler_s_nameof(compiler,o->name ) )))->sc );
        BLM_DOWN();}
    
        o->signature_global_name = tp_signature_global_name;
    }
    
    if( !x_source_parse_bl(source," #=?';'" ) ) BLM_TRY(xoico_body_s_parse(BCORE_PASS_CREATE(xoico_body_s,o->body),host, source ))
    
    BLM_TRY(x_source_parse_fa(source," #-?';' " )) // closing semicolon is optional
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0x1a69b2(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0x28(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xbfe80
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rdi
callq 0x5170
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
movq -0x20(%rbp), %rsi
callq 0x5560
movq -0x20(%rbp), %rdi
leaq 0x127eb6(%rip), %rsi    # 0x13388d
callq 0x6700
testb $0x1, %al
jne 0xb9e2
jmp 0xba0e
movq -0x20(%rbp), %rdi
leaq 0x128015(%rip), %rsi    # 0x133a02
movb $0x0, %al
callq 0x4c80
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0x70(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq -0x20(%rbp), %rdi
callq 0xae60
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x1e8(%rbp)
callq 0x8c10
movq -0x1e8(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x231a5c50432e84f2, %rdx # imm = 0xDCE5A3AFBCD17B0E
callq 0xc01a0
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x9290
cmpq $0x0, %rax
je 0xba7d
callq 0x9dda0
movq -0x20(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0xaf60
movq $0x0, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0xbc99
movq -0x68(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x80(%rbp), %rdi
callq 0x9d3d0
movq -0x1f0(%rbp), %rdi
movq %rax, %rsi
callq 0xc150
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0xbae3
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x1f8(%rbp)
movq -0x80(%rbp), %rdi
callq 0x9080
movq -0x1f8(%rbp), %rdi
movq %rax, %rsi
callq 0x5640
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x68(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0xc180
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0xbb6a
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0xa0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x210(%rbp)
movq -0x80(%rbp), %rdi
callq 0x8c60
movq -0x210(%rbp), %rdi
movq %rax, %rsi
callq 0xc210
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x208(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6b70
movq -0x208(%rbp), %rdi
movq -0x200(%rbp), %rsi
movq %rax, %rdx
callq 0x8df0
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
je 0xbc12
movq -0xa8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0xb0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq -0x18(%rbp), %rdi
callq 0xc260
testb $0x1, %al
jne 0xbc21
jmp 0xbc94
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x220(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc290
movq -0x220(%rbp), %rdi
movq -0x218(%rbp), %rsi
movq %rax, %rdx
callq 0x8ca0
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0xbc92
movq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0xc0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
jmp 0xbc94
jmp 0xc066
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x127d7b(%rip), %rsi    # 0x133a35
callq 0x6700
testb $0x1, %al
jne 0xbcc8
jmp 0xbd6d
movq -0x18(%rbp), %rax
movabsq $0x12d01d78049fae7, %rcx # imm = 0x12D01D78049FAE7
cmpq %rcx, (%rax)
jne 0xbcec
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xc8(%rbp)
jmp 0xbd1e
movq -0x20(%rbp), %rdi
leaq 0x127d45(%rip), %rsi    # 0x133a3c
movb $0x0, %al
callq 0x4c80
movq %rax, -0xd8(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0xd8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq -0x20(%rbp), %rdi
leaq 0x12bc99(%rip), %rsi    # 0x1379c2
movb $0x0, %al
callq 0x4a20
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0xe0(%rbp)
je 0xbd68
movq -0xe0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0xe8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
jmp 0xbe6a
movq $0x0, -0xf0(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x55b0
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0xf8(%rbp)
je 0xbdc4
movq -0xf8(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0x100(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq -0x20(%rbp), %rdi
leaq 0x127c92(%rip), %rsi    # 0x133a61
callq 0x6700
testb $0x1, %al
jne 0xbdda
jmp 0xbdea
movq -0xf0(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0xbe68
movq $-0x1, -0x108(%rbp)
movq -0x18(%rbp), %rax
movabsq $0x12d01d78049fae7, %rcx # imm = 0x12D01D78049FAE7
cmpq %rcx, (%rax)
jne 0xbe49
movq -0x18(%rbp), %rdi
addq $0x58, %rdi
movq -0xf0(%rbp), %rsi
callq 0xc2c0
movq %rax, -0x108(%rbp)
cmpq $0x0, %rax
jl 0xbe49
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x108(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movq %rax, -0xd0(%rbp)
jmp 0xbe59
movq -0x18(%rbp), %rdi
callq 0xc340
movq %rax, -0xc8(%rbp)
movq -0xf0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xbe6a
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xbf66
movq -0x60(%rbp), %rax
movq %rax, -0x110(%rbp)
leaq -0x140(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
movq -0x110(%rbp), %rsi
callq 0xbfe80
movq -0x148(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movq $0x2, 0x10(%rax)
leaq -0x168(%rbp), %rdi
callq 0xfe150
movq -0x110(%rbp), %rdi
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
leaq -0x168(%rbp), %rdx
callq 0xc0220
movq -0x20(%rbp), %rdi
leaq 0x14264d(%rip), %rsi    # 0x14e543
leaq -0x168(%rbp), %rdx
movb $0x0, %al
callq 0x4a20
movq %rax, -0x170(%rbp)
cmpq $0x0, -0x170(%rbp)
je 0xbf3f
movq -0x170(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x148(%rbp), %rdi
callq 0xc0720
movq -0x178(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq -0x68(%rbp), %rdi
movq -0x160(%rbp), %rsi
callq 0x5140
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
leaq -0x148(%rbp), %rdi
callq 0xc06e0
cmpq $0x0, -0xd0(%rbp)
jne 0xc057
movq -0x60(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x1b0(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x1b8(%rbp), %rdi
movq -0x180(%rbp), %rsi
callq 0xbfe80
movq -0x1b8(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rax
movq $0x2, 0x10(%rax)
movq -0x68(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x68(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x51d0
movq %rax, -0x238(%rbp)
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x51d0
movq -0x238(%rbp), %rsi
movq %rax, %rdx
leaq 0x1280c5(%rip), %rdi    # 0x1340d4
movb $0x0, %al
callq 0xff430
movq -0x230(%rbp), %rdi
movq %rax, %rcx
movl $0x2, %esi
movabsq $-0x503db0e6e1c2e704, %rdx # imm = 0xAFC24F191E3D18FC
callq 0xc01a0
movq -0x228(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0x5140
movq %rax, -0xd0(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0xc06e0
movq -0xd0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rdi
leaq 0x1279f7(%rip), %rsi    # 0x133a68
callq 0x6700
testb $0x1, %al
jne 0xc0d5
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
leaq -0x1649(%rip), %rsi     # 0xaa40
callq 0x6750
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xaf90
movq %rax, -0x1c0(%rbp)
cmpq $0x0, -0x1c0(%rbp)
je 0xc0d3
movq -0x1c0(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0x1c8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
jmp 0xc0d5
movq -0x20(%rbp), %rdi
leaq 0x127990(%rip), %rsi    # 0x133a70
movb $0x0, %al
callq 0x4a20
movq %rax, -0x1d0(%rbp)
cmpq $0x0, -0x1d0(%rbp)
je 0xc11c
movq -0x1d0(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0x1d8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc13b
movq $0x0, -0x1e0(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc0720
movq -0x1e0(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nopl (%rax,%rax)