// File: /workspace/github_c_makefile_star2_O1/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_compiler_s_parse
er_t xoico_compiler_s_parse( xoico_compiler_s* o, sc_t target_name, sc_t target_ext, const st_s* target_output_folder, sc_t source_path, sc_t group_name, sc_t trait_name, tp_t embed_method, sz_t* p_target_index )
{
    // xoico_compiler.x:464:1
    BLM_INIT_LEVEL(0);
    const st_s* source_folder = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,bcore_file_folder_path(source_path )));
    const st_s* output_folder = target_output_folder ? target_output_folder : source_folder;
    st_s* target_output_path = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,st_s_create_fa("#<sc_t>/#<sc_t>.#<sc_t>", output_folder->sc, target_name, target_ext )));
    
    sz_t target_index = -1;
    for(sz_t i = 0; i < o->size; i++ )
    {
        if( sc_t_equal( target_name, o->data[ i ]->name.sc ) )
        {
            target_index = i;
            break;
        }
    }
    
    if( target_index == -1 )
    {
        xoico_target_s* target = xoico_target_s_create();
        target->compiler = o;
        st_s_copy_sc(&(target->name        ),target_name );
        st_s_copy_sc(&(target->ext         ),target_ext );
        st_s_copy_fa(&(target->include_path),"#<sc_t>.#<sc_t>", target_name, target_ext );
        st_s_copy(&(target->output_path),target_output_path );
        xoico_compiler_s_push_d(o,target );
        target_index = o->size - 1;
    }
    
    xoico_target_s* target = o->data[ target_index ];
    
    /// check paths and extensions
    if( !st_s_equal_sc(&(target->ext),target_ext ) )
    {
        ERR_fa( "Target '#<sc_t>': Assigned extension '#<sc_t>' differs from requested extension '#<sc_t>'.", target->name.sc, target->ext.sc, target_ext );
    }
    if( !st_s_equal_st(&(target->output_path),target_output_path ) )
    {
        ERR_fa( "Target '#<sc_t>': Assigned output path '#<sc_t>' differs from requested output path '#<sc_t>'.", target->name.sc, target->output_path.sc, target_output_path->sc );
    }
    
    BLM_TRY(xoico_target_s_parse_from_path(target,source_path, group_name, trait_name, embed_method ))
    if( p_target_index ) (*(p_target_index)) = target_index;
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %r13
leaq 0x175d76(%rip), %rax    # 0x1a8dd0
movq (%rax), %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0xe0431
movq $0x0, 0x10(%r12)
movq %r14, 0x8(%rsp)
movq %r14, %rdi
callq 0xc8e31
movabsq $-0x503db0e6e1c2e704, %r14 # imm = 0xAFC24F191E3D18FC
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0xe0676
testq %rbx, %rbx
cmovneq %rbx, %rax
movq 0x8(%rax), %rsi
leaq 0x107f94(%rip), %rdi    # 0x13b040
movq %rbp, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x114d03
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0xe0676
movq %rax, %r12
movq $-0x1, %r14
cmpq $0x0, 0x10(%r13)
je 0x33102
xorl %ebx, %ebx
movq 0x8(%r13), %rax
movq (%rax,%rbx,8), %rax
movq 0x10(%rax), %rsi
movq %rbp, %rdi
callq 0xe99c9
testl %eax, %eax
je 0x330ff
incq %rbx
cmpq 0x10(%r13), %rbx
jb 0x330dc
jmp 0x33102
movq %rbx, %r14
cmpq $-0x1, %r14
jne 0x33169
callq 0x2f15b
movq %rax, %rbx
movq %r13, 0x138(%rax)
leaq 0x8(%rax), %rdi
movq %rbp, %rsi
callq 0x11454b
leaq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x11454b
leaq 0x58(%rbx), %rdi
leaq 0x107f0e(%rip), %rsi    # 0x13b048
movq %rbp, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x114736
leaq 0x78(%rbx), %rdi
movq %r12, %rsi
callq 0x114440
movq (%r13), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x5b3a7
movq 0x10(%r13), %r14
decq %r14
movq 0x8(%r13), %rax
movq (%rax,%r14,8), %r13
movq 0x30(%r13), %rdi
movq %r15, %rsi
callq 0xc84cd
testl %eax, %eax
je 0x331ae
movq 0x10(%r13), %r8
movq 0x30(%r13), %r9
movq %r15, (%rsp)
leaq 0x107ec4(%rip), %rdi    # 0x13b058
leaq 0x1050f5(%rip), %rsi    # 0x138290
leaq 0x107ecd(%rip), %rcx    # 0x13b06f
movl $0x17f2, %edx           # imm = 0x17F2
xorl %eax, %eax
callq 0xc825d
movq 0x80(%r13), %rdi
testq %r12, %r12
je 0x331c1
movq 0x8(%r12), %rsi
jmp 0x331c3
xorl %esi, %esi
movq 0x88(%rsp), %r15
movq 0x80(%rsp), %rbp
callq 0xc84cd
testl %eax, %eax
je 0x33211
movq 0x10(%r13), %r8
movq 0x80(%r13), %r9
movq 0x8(%r12), %rax
movq %rax, (%rsp)
leaq 0x107e61(%rip), %rdi    # 0x13b058
leaq 0x105092(%rip), %rsi    # 0x138290
leaq 0x107ec5(%rip), %rcx    # 0x13b0ca
movl $0x17f6, %edx           # imm = 0x17F6
xorl %eax, %eax
callq 0xc825d
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
callq 0x2f4e5
movq %rax, %rbx
testq %rax, %rax
jne 0x33243
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x33241
movq %r14, (%rax)
xorl %ebx, %ebx
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq