// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_target_s_expand_c
er_t xoico_target_s_expand_c( const xoico_target_s* o, sz_t indent, x_sink* sink, tp_t* body_signature )
{
    // xoico_target.x:362:1
    BLM_INIT_LEVEL(0);
    st_s sink_buf;BLM_T_INIT_SPUSH(st_s, &sink_buf);;
    tp_t body_hash = bcore_tp_init();
    
    BLM_TRY(xoico_target_s_expand_update_time(o,indent, sink ))
    
    BLM_TRY(xoico_target_s_expand_heading(o,indent,((x_sink*)(&( sink_buf )))))
    
    st_s_push_fa(&(sink_buf),"\n" );
    st_s_push_fa(&(sink_buf),"#rn{ }##include \"#<sc_t>.h\"\n", indent, o->include_path.sc );
    st_s_push_fa(&(sink_buf),"#rn{ }##include \"bcore_spect.h\"\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }##include \"bcore_spect_inst.h\"\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }##include \"bcore_sr.h\"\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }##include \"bcore_const_manager.h\"\n", indent );
    st_s_push_fa(&(sink_buf),"\n" );
    
    body_hash = bcore_tp_fold_sc( body_hash, sink_buf.sc );
    x_sink_push_data(sink,( vc_t )sink_buf.sc, sink_buf.size );
    st_s_clear(&(sink_buf));
    
    x_sink_push_fa(sink,"#rn{ }// To force a rebuild of this target by xoico, reset the hash key value below to 0.\n", indent );
    x_sink_push_fa(sink,"#rn{ }// HKEYOF_#<sc_t> 0x#pl16'0'{#X<tp_t>}ull\n", indent, o->name.sc, xoico_target_s_get_hash(o) );
    
    /// definition section
    {const xoico_target_s* __a=o ;if(__a)for(sz_t __i=0;__i<__a->size;__i++){xoico_source_s* e=__a->data[__i]; BLM_TRY(xoico_source_s_expand_definition(e,((const xoico_host*)(o)), indent,((x_sink*)(&( sink_buf )))))
    
    /// signal section
    }}st_s_push_fa(&(sink_buf),"\n" );
    st_s_push_fa(&(sink_buf),"#rn{ }/*#rn{*}*/\n", indent, sz_max( 0, 116 - indent ) );
    st_s_push_fa(&(sink_buf),"\n" );
    
    /// prototypes of signal handlers this target depends on
    {const bcore_arr_sz_s* __a=&(o->dependencies );if(__a)for(sz_t __i=0;__i<__a->size;__i++){sz_t target_idx=__a->data[__i];
    {
        const xoico_target_s* target = o->compiler->data[ target_idx ];
        if( target->signal_handler_name.size > 0 )
        {
            st_s_push_fa(&(sink_buf),"#rn{ }vd_t #<sc_t>( const bcore_signal_s* o );\n", indent, target->signal_handler_name.sc );
        }
    }
    
    }}st_s_push_fa(&(sink_buf),"\n" );
    st_s_push_fa(&(sink_buf),"#rn{ }vd_t #<sc_t>_#<sc_t>_signal_handler( const bcore_signal_s* o )\n", indent, o->name.sc, o->ext.sc );
    st_s_push_fa(&(sink_buf),"#rn{ }{\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }    switch( bcore_signal_s_handle_type( o, typeof( \"#<sc_t>_#<sc_t>\" ) ) )\n", indent, o->name.sc, o->ext.sc );
    st_s_push_fa(&(sink_buf),"#rn{ }    {\n", indent );
    
    st_s_push_fa(&(sink_buf),"#rn{ }        case TYPEOF_init1:\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }        {\n", indent );
    BLM_TRY(xoico_target_s_expand_init1(o,indent + 12,((x_sink*)(&( sink_buf )))))
    {const xoico_target_s* __a=o ;if(__a)for(sz_t __i=0;__i<__a->size;__i++){xoico_source_s* e=__a->data[__i]; BLM_TRY(xoico_source_s_expand_init1(e,((const xoico_host*)(o)), indent + 12,((x_sink*)(&( sink_buf )))))
    }}st_s_push_fa(&(sink_buf),"#rn{ }        }\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }        break;\n", indent );
    
    st_s_push_fa(&(sink_buf),"#rn{ }        case TYPEOF_down1:\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }        {\n", indent );
    BLM_TRY(xoico_target_s_expand_init1(o,indent + 12,((x_sink*)(&( sink_buf )))))
    {const xoico_target_s* __a=o ;if(__a)for(sz_t __i=0;__i<__a->size;__i++){xoico_source_s* e=__a->data[__i]; BLM_TRY(xoico_source_s_expand_down1(e,((const xoico_host*)(o)), indent + 12,((x_sink*)(&( sink_buf )))))
    }}st_s_push_fa(&(sink_buf),"#rn{ }        }\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }        break;\n", indent );
    
    if( o->dependencies.size > 0 )
    {
        st_s_push_fa(&(sink_buf),"#rn{ }        case TYPEOF_push_dependencies:\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }        {\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }            ASSERT( o->object && ( *( aware_t* )o->object ) == TYPEOF_bcore_arr_fp_s );\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }            bcore_arr_fp_s* arr_fp = o->object;\n", indent );
        {const bcore_arr_sz_s* __a=&(o->dependencies );if(__a)for(sz_t __i=0;__i<__a->size;__i++){sz_t target_idx=__a->data[__i];
        {
            const xoico_target_s* target = o->compiler->data[ target_idx ];
            if( target->signal_handler_name.size > 0 )
            {
                st_s_push_fa(&(sink_buf),"#rn{ }            bcore_arr_fp_s_push( arr_fp, ( fp_t )#<sc_t> );\n", indent, target->signal_handler_name.sc );
            }
        }
        }}st_s_push_fa(&(sink_buf),"#rn{ }        }\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }        break;\n", indent );
    }
    
    st_s_push_fa(&(sink_buf),"#rn{ }        default: break;\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }    }\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }    return NULL;\n", indent );
    st_s_push_fa(&(sink_buf),"#rn{ }}\n", indent );
    
    if( o->define_signal_handler )
    {
        st_s_push_fa(&(sink_buf),"#rn{ }BETH_SIGNAL_DEFINE( #<sc_t> )\n", indent, o->name.sc );
    }
    
    if( o->main_function )
    {
        bl_t c_style = ( o->main_function->signature->args.size == 2 );
    
        st_s_push_fa(&(sink_buf),"\n" );
        st_s_push_fa(&(sink_buf),"#rn{ }int main( int argc, char** argv )\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }{\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }    BETH_USE( #<sc_t> );\n", indent, o->name.sc );
    
        if( c_style )
        {
            st_s_push_fa(&(sink_buf),"#rn{ }    int retv = #<sc_t>( argc, argv );\n", indent, xoico_compiler_s_nameof(o->compiler,o->main_function->global_name ) );
        }
        else
        {
            st_s_push_fa(&(sink_buf),"#rn{ }    bcore_arr_st_s* args = bcore_arr_st_s_create();\n", indent );
            st_s_push_fa(&(sink_buf),"#rn{ }    for( sz_t i = 0; i < argc; i++ ) bcore_arr_st_s_push_sc( args, argv[ i ] );\n", indent );
            st_s_push_fa(&(sink_buf),"#rn{ }    int retv = #<sc_t>( args );\n", indent, xoico_compiler_s_nameof(o->compiler,o->main_function->global_name ) );
            st_s_push_fa(&(sink_buf),"#rn{ }    bcore_arr_st_s_discard( args );\n", indent );
        }
    
        st_s_push_fa(&(sink_buf),"#rn{ }    BETH_CLOSEV( 0 );\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }    return retv;\n", indent );
        st_s_push_fa(&(sink_buf),"#rn{ }}\n", indent );
    }
    
    body_hash = bcore_tp_fold_sc( body_hash, sink_buf.sc );
    x_sink_push_data(sink,( vc_t )sink_buf.sc, sink_buf.size );
    st_s_clear(&(sink_buf));
    
    x_sink_push_fa(sink,"// XOICO_BODY_SIGNATURE 0x#pl16'0'{#X<tp_t>}\n", body_hash );
    if( body_signature ) (*(body_signature)) = body_hash;
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, 0x30(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
leaq 0xfccdf(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x717f5
andq $0x0, 0x10(%rbx)
movq %rsp, %rbp
movq %rbp, %rdi
callq 0x8e048
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x71998
movq %r13, %rdx
callq 0x1aa2f
movq %r12, %rdi
movq %rbp, %rdx
callq 0x1aabf
leaq 0xab48b(%rip), %rbx     # 0xc65cb
xorl %r14d, %r14d
movq %rbp, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x8f4ef
movq 0x60(%r12), %rcx
leaq 0x9157e(%rip), %rsi     # 0xac6da
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91630(%rip), %rsi     # 0xac7a0
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x9163d(%rip), %rsi     # 0xac7c1
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x9164f(%rip), %rsi     # 0xac7e7
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91659(%rip), %rsi     # 0xac805
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
movq %rbp, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x8f4ef
movq 0x8(%rbp), %rbx
movabsq $-0x340d631b7bdddcdb, %rdi # imm = 0xCBF29CE484222325
movq %rbx, %rsi
callq 0x10500
movq %rax, 0x20(%rsp)
movq 0x10(%rbp), %rdx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1b07c
movq %rbp, %rdi
callq 0x8f0c3
leaq 0x9162f(%rip), %rsi     # 0xac82e
movq %r13, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xdd43
movq 0x10(%r12), %rbx
movq %r12, %rdi
callq 0x1a699
leaq 0x91669(%rip), %rsi     # 0xac889
movq %r13, 0x28(%rsp)
movq %r13, %rdi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xdd43
cmpq 0xa0(%r12), %r14
jae 0x1b266
movq 0x98(%r12), %rax
movq (%rax,%r14,8), %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x198ab
incq %r14
testq %rax, %rax
je 0x1b238
jmp 0x1b3d4
leaq 0xab35e(%rip), %r13     # 0xc65cb
xorl %r14d, %r14d
movq %rsp, %rbx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8f4ef
pushq $0x74
popq %rcx
subq %r15, %rcx
testq %rcx, %rcx
cmovleq %r14, %rcx
leaq 0x90f57(%rip), %rsi     # 0xac1eb
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91605(%rip), %r13     # 0xac8ba
xorl %r14d, %r14d
cmpq 0xe8(%r12), %r14
jae 0x1b304
movq 0xe0(%r12), %rax
movq 0x138(%r12), %rcx
movq (%rax,%r14,8), %rax
movq 0x8(%rcx), %rcx
movq (%rcx,%rax,8), %rax
cmpq $0x0, 0xc0(%rax)
je 0x1b2ff
movq 0xb8(%rax), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
incq %r14
jmp 0x1b2b8
leaq 0xab2c0(%rip), %rsi     # 0xc65cb
xorl %r14d, %r14d
movq %rsp, %rbp
movq %rbp, %rdi
xorl %eax, %eax
callq 0x8f4ef
movq 0x10(%r12), %rcx
movq 0x30(%r12), %r8
leaq 0x915be(%rip), %rsi     # 0xac8ea
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x8facf(%rip), %rsi     # 0xaae0f
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
movq 0x10(%r12), %rcx
movq 0x30(%r12), %r8
leaq 0x915d2(%rip), %rsi     # 0xac930
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x8fabd(%rip), %rsi     # 0xaae2f
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x915fc(%rip), %rsi     # 0xac982
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x9160a(%rip), %rsi     # 0xac9a4
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0xc(%r15), %rbx
cmpq 0xa0(%r12), %r14
jae 0x1b3f3
movq 0x98(%r12), %rax
movq (%rax,%r14,8), %rdi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x19c86
incq %r14
testq %rax, %rax
je 0x1b3ab
movq %rax, %r13
leaq 0x38(%rsp), %rdi
callq 0x71b64
movq %r13, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x915bb(%rip), %rsi     # 0xac9b5
xorl %r14d, %r14d
movq %rsp, %rbp
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x915b2(%rip), %rsi     # 0xac9c6
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x915b4(%rip), %rsi     # 0xac9dc
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91568(%rip), %rsi     # 0xac9a4
movq %rbp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
cmpq 0xa0(%r12), %r14
jae 0x1b46f
movq 0x98(%r12), %rax
movq (%rax,%r14,8), %rdi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x19d47
incq %r14
jmp 0x1b449
leaq 0x9153f(%rip), %rsi     # 0xac9b5
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91539(%rip), %rsi     # 0xac9c6
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
cmpq $0x0, 0xe8(%r12)
je 0x1b57d
leaq 0x9154e(%rip), %rsi     # 0xac9fe
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x914dd(%rip), %rsi     # 0xac9a4
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91551(%rip), %rsi     # 0xaca2c
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x9159c(%rip), %rsi     # 0xaca8b
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x915bf(%rip), %r13     # 0xacac2
xorl %r14d, %r14d
cmpq 0xe8(%r12), %r14
jae 0x1b552
movq 0xe0(%r12), %rax
movq 0x138(%r12), %rcx
movq (%rax,%r14,8), %rax
movq 0x8(%rcx), %rcx
movq (%rcx,%rax,8), %rax
cmpq $0x0, 0xc0(%rax)
je 0x1b54d
movq 0xb8(%rax), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
incq %r14
jmp 0x1b506
leaq 0x9145c(%rip), %rsi     # 0xac9b5
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91456(%rip), %rsi     # 0xac9c6
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91581(%rip), %rsi     # 0xacb05
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x8f950(%rip), %rsi     # 0xaaeeb
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91575(%rip), %rsi     # 0xacb24
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x8f94b(%rip), %rsi     # 0xaaf0e
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
cmpb $0x1, 0xd0(%r12)
jne 0x1b5f4
movq 0x10(%r12), %rcx
leaq 0x91555(%rip), %rsi     # 0xacb3c
movq %rsp, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
movq 0x140(%r12), %rax
testq %rax, %rax
je 0x1b748
movq 0x40(%rax), %rax
movq 0x68(%rax), %r14
leaq 0xaafb7(%rip), %rsi     # 0xc65cb
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91539(%rip), %rsi     # 0xacb61
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x8f7d3(%rip), %rsi     # 0xaae0f
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
movq 0x10(%r12), %rcx
leaq 0x91535(%rip), %rsi     # 0xacb8a
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
cmpq $0x2, %r14
jne 0x1b69a
movq 0x138(%r12), %rdi
movq 0x140(%r12), %rax
movq 0x10(%rax), %rsi
callq 0xdad8
leaq 0x91522(%rip), %rsi     # 0xacbaa
movq %rsp, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x8f4ef
jmp 0x1b709
leaq 0x91536(%rip), %rsi     # 0xacbd7
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x9155a(%rip), %rsi     # 0xacc12
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
movq 0x138(%r12), %rdi
movq 0x140(%r12), %rax
movq 0x10(%rax), %rsi
callq 0xdad8
leaq 0x91584(%rip), %rsi     # 0xacc69
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x91594(%rip), %rsi     # 0xacc90
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x915ab(%rip), %rsi     # 0xaccbb
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x915b1(%rip), %rsi     # 0xaccd8
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x8f7d3(%rip), %rsi     # 0xaaf0e
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8f4ef
movq %rsp, %r15
movq 0x8(%r15), %r12
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x10500
movq %rax, %rbx
movq 0x10(%r15), %rdx
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x1b07c
movq %r15, %rdi
callq 0x8f0c3
leaq 0x90ff0(%rip), %rsi     # 0xac772
xorl %r13d, %r13d
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xdd43
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x1b3d7
movq %rbx, (%rax)
xorl %r13d, %r13d
jmp 0x1b3d7