// File: /workspace/github_c_makefile_star2_O1/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, (%rsp)
movq %rdi, %r15
movabsq $-0x503db0e6e1c2e704, %r12 # imm = 0xAFC24F191E3D18FC
leaq 0x17c763(%rip), %rax    # 0x1a8dd0
movq (%rax), %rsi
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0xe0431
movq $0x0, 0x10(%r13)
movq 0x48(%r15), %rdi
callq 0x2c7bb
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rax, %rcx
callq 0xe0676
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq $-0x1, %rdx
movl $0x3d, %ecx
callq 0x1158c3
cmpq 0x10(%r13), %rax
jae 0x2c6ca
movq 0x8(%r13), %rcx
leaq (%rcx,%rax), %r13
incq %r13
jmp 0x2c6d1
leaq 0x12701e(%rip), %r13    # 0x1536ef
leaq 0x127016(%rip), %rsi    # 0x1536ee
movq %rbx, %rdi
xorl %eax, %eax
callq 0xee2a
movq 0x10(%r15), %rcx
leaq 0x10da23(%rip), %rsi    # 0x13a110
movq %rbx, %rdi
movq (%rsp), %r14
movq %r14, %rdx
xorl %eax, %eax
callq 0xee2a
movq %r13, %rdi
movq %r14, %rsi
callq 0x2c927
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rax, %rcx
callq 0xe0676
movq 0x8(%rax), %rdx
leaq 0x10da22(%rip), %rsi    # 0x13a148
movq %rbx, %rdi
xorl %eax, %eax
callq 0xee2a
movq 0x10(%r15), %rcx
leaq 0x10da17(%rip), %rsi    # 0x13a152
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xee2a
cmpq $0x0, 0x68(%r15)
setne %r13b
je 0x2c796
xorl %r14d, %r14d
movq 0x60(%r15), %rax
movq (%rax,%r14,8), %rdi
movq %r15, %rsi
movq (%rsp), %rdx
movq %rbx, %rcx
callq 0x1bf6d
movq %rax, %rbp
testq %rax, %rax
je 0x2c782
leaq 0x8(%rsp), %rdi
callq 0xe0b30
movq %rbp, %r12
testq %rbp, %rbp
jne 0x2c796
incq %r14
cmpq 0x68(%r15), %r14
setb %r13b
jb 0x2c756
jmp 0x2c796
testb $0x1, %r13b
jne 0x2c7a9
leaq 0x8(%rsp), %rdi
callq 0xe0b30
xorl %r12d, %r12d
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq