// File: /workspace/github_c_makefile_star2_O3/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_stamp_s_expand_definition
er_t xoico_stamp_s_expand_definition( const xoico_stamp_s* o, const xoico_host* host, sz_t indent, x_sink* sink )
{
    // xoico_stamp.x:968:1
    BLM_INIT_LEVEL(0);
    st_s* embedded_string = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,xoico_stamp_create_embedded_string(o->self_source )));
    
    // Issue below was mitigated by using nasc strings; error check can be removed
    // 4095 is the C99-limit for string literals
    //    if( embedded_string.size > 4095 )
    //    {
    //        return o.source_point.parse_error_fa
    //        (
    //            "Reflection embedding failed. (Stamp is too large)\n"
    //            "The embedded code would require a string literal larger than 4095 characters.\n"
    //            "This exceeds the limit defined in C99.\n"
    //        );
    //    }
    
    sz_t idx = st_s_find_char(embedded_string,0, -1, '=' );
    sc_t self_def = "";
    if( idx < embedded_string->size )
    {
        self_def = embedded_string->sc + idx + 1;
    }
    
    x_sink_push_fa(sink,"\n" );
    
    //   old code before nasc strings
    //    sink.push_fa( "#rn{ }BCORE_DEFINE_OBJECT_INST_P( #<sc_t> )\n", indent, o.st_name.sc );
    //    m st_s* multiline_string = xoico_stamp_create_structured_multiline_string( self_def, indent )^;
    //    sink.push_fa( "#<sc_t>;\n", multiline_string.sc );
    
    x_sink_push_fa(sink,"#rn{ }BCORE_DEFINE_OBJECT_INST_P_NASC_BEGIN( #<sc_t> )\n", indent, o->st_name.sc );
    st_s* multiline_nasc_string = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,xoico_stamp_create_structured_multiline_string_nasc(self_def, indent )));
    x_sink_push_fa(sink,"#<sc_t>,\n", multiline_nasc_string->sc );
    x_sink_push_fa(sink,"#rn{ }BCORE_DEFINE_OBJECT_INST_P_NASC_END( #<sc_t> )\n", indent, o->st_name.sc );
    
    {const xoico_funcs_s* __a=&(o->funcs );if(__a)for(sz_t __i=0;__i<__a->size;__i++){xoico_func_s* func=__a->data[__i]; BLM_TRY(xoico_func_s_expand_definition(func,((const xoico_host*)(o)), indent, sink ))
    
    }}BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movabsq $-0x503db0e6e1c2e704, %r13 # imm = 0xAFC24F191E3D18FC
leaq 0x1713a3(%rip), %rax    # 0x19bdd0
movq (%rax), %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xd6675
movq $0x0, 0x10(%r12)
movq 0x48(%r15), %rdi
callq 0x2ab5c
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %rax, %rcx
callq 0xd68a8
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq $-0x1, %rdx
movl $0x3d, %ecx
callq 0x10a99d
cmpq 0x10(%r12), %rax
jae 0x2aa8d
movq 0x8(%r12), %rcx
leaq (%rcx,%rax), %rbp
incq %rbp
jmp 0x2aa94
leaq 0x11dc81(%rip), %rbp    # 0x148715
leaq 0x11dc79(%rip), %rsi    # 0x148714
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xed3f
movq 0x10(%r15), %rcx
leaq 0x10465d(%rip), %rsi    # 0x12f110
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xed3f
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2acc9
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %rax, %rcx
callq 0xd68a8
movq 0x8(%rax), %rdx
leaq 0x104660(%rip), %rsi    # 0x12f148
movq %rbx, %rdi
xorl %eax, %eax
callq 0xed3f
movq 0x10(%r15), %rcx
leaq 0x104655(%rip), %rsi    # 0x12f152
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xed3f
cmpq $0x0, 0x68(%r15)
je 0x2ab40
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x60(%r15), %rax
movq (%rax,%r13,8), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1b7f3
testq %rax, %rax
jne 0x2ab3d
incq %r13
cmpq 0x68(%r15), %r13
jb 0x2ab17
jmp 0x2ab40
movq %rax, %r12
leaq 0x8(%rsp), %rdi
callq 0xd6d2c
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq