// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore_spect_array.c
// Function: bcore_array_s_create_from_self
static bcore_array_s* bcore_array_s_create_from_self( const bcore_self_s* self )
{
    assert( self != NULL );
    bcore_array_s* o = array_s_create();
    o->header.p_type = bcore_name_enroll( "bcore_array_s" );
    o->header.o_type = self->type;

    const bcore_inst_s* instance = bcore_inst_s_get_typed( self->type );
    if( !instance->body ) ERR( "'%s' has no body", ifnameof( self->type ) );

    bcore_inst_body_s* body = instance->body;
    bool found = false;
    for( uz_t i = 0; i < body->size; i++ )
    {
        const bcore_self_item_s* self_item = body->data[ i ].self_item;
        if( bcore_flect_caps_is_array( self_item->caps ) )
        {
            o->type_caps = self_item->caps;
            o->caps_offset = body->data[ i ].offset;
            o->item_p = body->data[ i ].inst_p;
            o->size_fix = 0;
            if( bcore_flect_caps_is_array_fix( self_item->caps ) )
            {
                o->size_fix = self_item->array_fix_size;
                if( o->size_fix == 0 ) ERR_fa( "'#<sc_t>' represents a fixed-size array of size zero.", ifnameof( self->type ) );
            }
            found = true;
            break;
        }
    }
    if( !found ) ERR( "'%s' has no array", ifnameof( self->type ) );

    switch( o->type_caps )
    {
        case BCORE_CAPS_ARRAY_DYN_SOLID_STATIC:
        {
            o->get = get_dyn_solid_static;
            o->set = set_dyn_solid_static;
            if( !o->item_p ) ERR( "item_p is NULL on solid-static-array" );
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_SOLID_TYPED:
        {
            o->get = get_dyn_solid_typed;
            o->set = set_dyn_solid_typed;
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_STATIC:
        {
            o->get = get_dyn_link_static;
            o->set = set_dyn_link_static;
            if( !o->item_p ) ERR( "item_p is NULL on link-static-array" );
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_TYPED:
        {
            o->get = get_dyn_link_typed;
            o->set = set_dyn_link_typed;
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_AWARE:
        {
            o->get = get_dyn_link_aware;
            o->set = set_dyn_link_aware;
        }
        break;

        case BCORE_CAPS_ARRAY_FIX_SOLID_STATIC:
        {
            o->get = get_fix_solid_static;
            o->set = set_fix_solid_static;
            if( !o->item_p ) ERR( "item_p is NULL on solid-static-array" );
        }
        break;

        case BCORE_CAPS_ARRAY_FIX_LINK_STATIC:
        {
            o->get = get_fix_link_static;
            o->set = set_fix_link_static;
            if( !o->item_p ) ERR( "item_p is NULL on link-static-array" );
        }
        break;

        case BCORE_CAPS_ARRAY_FIX_LINK_AWARE:
        {
            o->get = get_fix_link_aware;
            o->set = set_fix_link_aware;
        }
        break;

        default: ERR( "invalid type_caps %"PRIu32, ( u2_t )o->type_caps );
    }


    // quick-access parameters
    o->is_static   = false;
    o->is_of_aware = false;
    o->is_of_links = false;
    o->is_mono_typed = false;

    switch( o->type_caps )
    {
        case BCORE_CAPS_ARRAY_DYN_SOLID_STATIC:
        case BCORE_CAPS_ARRAY_DYN_LINK_STATIC:
        case BCORE_CAPS_ARRAY_FIX_SOLID_STATIC:
        case BCORE_CAPS_ARRAY_FIX_LINK_STATIC:
            o->is_static = true;
            break;

        case BCORE_CAPS_ARRAY_DYN_LINK_AWARE:
        case BCORE_CAPS_ARRAY_FIX_LINK_AWARE:
            o->is_of_aware = true;
            break;

        default:
            break;
    }

    switch( o->type_caps )
    {
        case BCORE_CAPS_ARRAY_DYN_LINK_STATIC:
        case BCORE_CAPS_ARRAY_DYN_LINK_TYPED:
        case BCORE_CAPS_ARRAY_DYN_LINK_AWARE:
        case BCORE_CAPS_ARRAY_FIX_LINK_STATIC:
        case BCORE_CAPS_ARRAY_FIX_LINK_AWARE:
            o->is_of_links = true;

        default:
            break;
    }

    switch( o->type_caps )
    {
        case BCORE_CAPS_ARRAY_DYN_LINK_AWARE:
        case BCORE_CAPS_ARRAY_FIX_LINK_AWARE:
            break;

        default:
            o->is_mono_typed = true;
            break;
    }

    return o;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x48
popq %r15
xorl %edi, %edi
movq %r15, %rsi
callq 0x6023e
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
callq 0x6028b
movabsq $-0x5073d588c3beb52e, %rax # imm = 0xAF8C2A773C414AD2
movq %rax, (%rbx)
leaq 0x45fe5(%rip), %rdi     # 0xc4e72
callq 0x7227a
movq %rax, (%rbx)
movq 0x8(%r14), %rdi
movq %rdi, 0x8(%rbx)
callq 0x7b39a
movq 0x10(%rax), %r12
testq %r12, %r12
jne 0x7eedf
movq %rax, %r15
movq 0x8(%r14), %rdi
callq 0x7f2c1
leaq 0x480c4(%rip), %rdi     # 0xc6f82
leaq 0x47bab(%rip), %rsi     # 0xc6a70
leaq 0x48115(%rip), %rcx     # 0xc6fe1
movl $0x5da, %edx            # imm = 0x5DA
movq %rax, %r8
xorl %eax, %eax
callq 0x60031
movq 0x10(%r15), %r12
xorl %r15d, %r15d
xorl %ebp, %ebp
cmpq 0x8(%r12), %rbp
jae 0x7ef0a
movq (%r12), %rax
movq 0x18(%rax,%r15), %r13
movl 0x10(%r13), %edi
callq 0x61078
testb %al, %al
jne 0x7ef39
incq %rbp
addq $0x30, %r15
jmp 0x7eee4
movq 0x8(%r14), %rdi
callq 0x7f2c1
leaq 0x48068(%rip), %rdi     # 0xc6f82
leaq 0x47b4f(%rip), %rsi     # 0xc6a70
leaq 0x48100(%rip), %rcx     # 0xc7028
movl $0x5f0, %edx            # imm = 0x5F0
movq %rax, %r8
xorl %eax, %eax
callq 0x60031
jmp 0x7ef9e
movl 0x10(%r13), %edi
movq %rdi, 0x10(%rbx)
movq (%r12), %rax
movq (%rax,%r15), %rcx
movq %rcx, 0x20(%rbx)
movq 0x20(%rax,%r15), %rax
movq %rax, 0x28(%rbx)
andq $0x0, 0x18(%rbx)
callq 0x6108c
testb %al, %al
je 0x7ef9e
movq 0x18(%r13), %rax
movq %rax, 0x18(%rbx)
testq %rax, %rax
jne 0x7ef9e
movq 0x8(%r14), %rdi
callq 0x7f2c1
leaq 0x48001(%rip), %rdi     # 0xc6f82
leaq 0x47ae8(%rip), %rsi     # 0xc6a70
leaq 0x48063(%rip), %rcx     # 0xc6ff2
movl $0x5ea, %edx            # imm = 0x5EA
movq %rax, %r8
xorl %eax, %eax
callq 0x60186
movq 0x10(%rbx), %r8
leaq -0x6(%r8), %rax
cmpq $0x7, %rax
ja 0x7f110
leaq 0x47a79(%rip), %rcx     # 0xc6a30
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x310(%rip), %rax       # 0x7f2d7
movq %rax, 0x30(%rbx)
leaq 0x339(%rip), %rax       # 0x7f30b
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0x7f131
leaq 0x47f9a(%rip), %rdi     # 0xc6f82
leaq 0x47a81(%rip), %rsi     # 0xc6a70
leaq 0x48044(%rip), %rcx     # 0xc703a
movl $0x5f8, %edx            # imm = 0x5F8
jmp 0x7f107
leaq 0x78c(%rip), %rax       # 0x7f793
movq %rax, 0x30(%rbx)
leaq 0x7ba(%rip), %rax       # 0x7f7cc
jmp 0x7f08e
leaq 0x4d3(%rip), %rax       # 0x7f4ee
movq %rax, 0x30(%rbx)
leaq 0x4fb(%rip), %rax       # 0x7f521
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0x7f131
leaq 0x47f46(%rip), %rdi     # 0xc6f82
leaq 0x47a2d(%rip), %rsi     # 0xc6a70
leaq 0x48015(%rip), %rcx     # 0xc705f
movl $0x607, %edx            # imm = 0x607
jmp 0x7f107
leaq 0x597(%rip), %rax       # 0x7f5f2
movq %rax, 0x30(%rbx)
leaq 0x5ca(%rip), %rax       # 0x7f630
jmp 0x7f08e
leaq 0xa30(%rip), %rax       # 0x7fa9f
movq %rax, 0x30(%rbx)
leaq 0xa59(%rip), %rax       # 0x7fad3
jmp 0x7f08e
leaq 0x329(%rip), %rax       # 0x7f3ac
movq %rax, 0x30(%rbx)
leaq 0x37a(%rip), %rax       # 0x7f408
movq %rax, 0x38(%rbx)
jmp 0x7f131
leaq 0x805(%rip), %rax       # 0x7f8a3
movq %rax, 0x30(%rbx)
leaq 0x82c(%rip), %rax       # 0x7f8d5
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0x7f131
leaq 0x47ec7(%rip), %rdi     # 0xc6f82
leaq 0x479ae(%rip), %rsi     # 0xc6a70
leaq 0x47f71(%rip), %rcx     # 0xc703a
movl $0x61d, %edx            # imm = 0x61D
jmp 0x7f107
leaq 0x8b8(%rip), %rax       # 0x7f98f
movq %rax, 0x30(%rbx)
leaq 0x8db(%rip), %rax       # 0x7f9bd
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0x7f131
leaq 0x47e8e(%rip), %rdi     # 0xc6f82
leaq 0x47975(%rip), %rsi     # 0xc6a70
leaq 0x47f5d(%rip), %rcx     # 0xc705f
movl $0x625, %edx            # imm = 0x625
xorl %eax, %eax
callq 0x60031
jmp 0x7f131
leaq 0x47e6b(%rip), %rdi     # 0xc6f82
leaq 0x47952(%rip), %rsi     # 0xc6a70
leaq 0x47f5e(%rip), %rcx     # 0xc7083
movl $0x630, %edx            # imm = 0x630
xorl %eax, %eax
callq 0x60031
andl $0x0, 0x40(%rbx)
movq 0x10(%rbx), %rax
cmpq $0xd, %rax
ja 0x7f18c
movl $0x1940, %ecx           # imm = 0x1940
btq %rax, %rcx
jae 0x7f150
movb $0x1, 0x40(%rbx)
jmp 0x7f15f
movl $0x2400, %ecx           # imm = 0x2400
btq %rax, %rcx
jae 0x7f182
movb $0x1, 0x41(%rbx)
cmpq $0xd, %rax
ja 0x7f18c
movl $0x3700, %ecx           # imm = 0x3700
btq %rax, %rcx
jae 0x7f18c
movb $0x1, 0x42(%rbx)
cmpq $0xa, %rax
je 0x7f190
cmpq $0xd, %rax
je 0x7f190
jmp 0x7f18c
cmpq $0x9, %rax
jne 0x7f18c
movb $0x1, 0x42(%rbx)
movb $0x1, 0x43(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq