// File: /workspace/github_c_makefile_star2_O3/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
movl $0x48, %esi
xorl %edi, %edi
callq 0xbe7b1
movq %rax, %rbx
movl $0x48, %esi
movq %rax, %rdi
callq 0xbe802
movabsq $-0x5073d588c3beb52e, %rax # imm = 0xAF8C2A773C414AD2
movq %rax, (%rbx)
leaq 0x55b72(%rip), %rdi     # 0x146f18
callq 0xd7476
movq %rax, (%rbx)
movq 0x8(%r14), %r15
movq %r15, 0x8(%rbx)
leaq 0xab0ab(%rip), %rax     # 0x19c468
movl (%rax), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq 0x18(%rax,%rcx,8), %rcx
andq %r15, %rcx
shlq $0x4, %rcx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movl $0x8, %ecx
cmpq %r15, %rdx
je 0xf1413
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0xf1413
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0xf1413
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0xf141c
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xf1443
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r15, %rsi
callq 0xe9bc5
movq %rax, %r12
leaq 0xab030(%rip), %rdi     # 0x19c468
movq %r15, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x10(%r12), %r15
testq %r15, %r15
jne 0xf148a
movq 0x8(%r14), %rdi
callq 0xd6ec4
testq %rax, %rax
leaq 0x572b5(%rip), %r8      # 0x148715
cmovneq %rax, %r8
leaq 0x57c3d(%rip), %rdi     # 0x1490a8
leaq 0x57736(%rip), %rsi     # 0x148ba8
leaq 0x57c8e(%rip), %rcx     # 0x149107
movl $0x5da, %edx            # imm = 0x5DA
xorl %eax, %eax
callq 0xbe592
movq 0x10(%r12), %r15
cmpq $0x0, 0x8(%r15)
je 0xf14bc
xorl %r12d, %r12d
xorl %ebp, %ebp
movq (%r15), %rax
movq 0x18(%rax,%r12), %r13
movl 0x10(%r13), %edi
callq 0xbf798
testb %al, %al
jne 0xf1556
incq %rbp
addq $0x30, %r12
cmpq 0x8(%r15), %rbp
jb 0xf1496
movq 0x8(%r14), %rdi
callq 0xd6ec4
testq %rax, %rax
leaq 0x57246(%rip), %r8      # 0x148715
cmovneq %rax, %r8
leaq 0x57bce(%rip), %rdi     # 0x1490a8
leaq 0x576c7(%rip), %rsi     # 0x148ba8
leaq 0x57c66(%rip), %rcx     # 0x14914e
movl $0x5f0, %edx            # imm = 0x5F0
xorl %eax, %eax
callq 0xbe592
movq 0x10(%rbx), %r8
leaq -0x6(%r8), %rax
cmpq $0x7, %rax
ja 0xf16e5
leaq 0x5765b(%rip), %rcx     # 0x148b68
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x2ff(%rip), %rax       # 0xf181c
movq %rax, 0x30(%rbx)
leaq 0x32e(%rip), %rax       # 0xf1856
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xf1706
leaq 0x57b6a(%rip), %rdi     # 0x1490a8
leaq 0x57663(%rip), %rsi     # 0x148ba8
leaq 0x57c14(%rip), %rcx     # 0x149160
movl $0x5f8, %edx            # imm = 0x5F8
jmp 0xf16dc
movl 0x10(%r13), %edi
movq %rdi, 0x10(%rbx)
movq (%r15), %rax
movq (%rax,%r12), %rcx
movq %rcx, 0x20(%rbx)
movq 0x20(%rax,%r12), %rax
movq %rax, 0x28(%rbx)
movq $0x0, 0x18(%rbx)
callq 0xbf7ac
testb %al, %al
je 0xf14f4
movq 0x18(%r13), %rax
movq %rax, 0x18(%rbx)
testq %rax, %rax
jne 0xf14f4
movq 0x8(%r14), %rdi
callq 0xd6ec4
testq %rax, %rax
leaq 0x5716a(%rip), %r8      # 0x148715
cmovneq %rax, %r8
leaq 0x57af2(%rip), %rdi     # 0x1490a8
leaq 0x575eb(%rip), %rsi     # 0x148ba8
leaq 0x57b54(%rip), %rcx     # 0x149118
movl $0x5ea, %edx            # imm = 0x5EA
xorl %eax, %eax
callq 0xbe6f9
jmp 0xf14f4
leaq 0x9dd(%rip), %rax       # 0xf1fb9
movq %rax, 0x30(%rbx)
leaq 0xa1b(%rip), %rax       # 0xf2002
jmp 0xf1663
leaq 0x5c9(%rip), %rax       # 0xf1bb9
movq %rax, 0x30(%rbx)
leaq 0x5f7(%rip), %rax       # 0xf1bf2
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xf1706
leaq 0x57a97(%rip), %rdi     # 0x1490a8
leaq 0x57590(%rip), %rsi     # 0x148ba8
leaq 0x57b66(%rip), %rcx     # 0x149185
movl $0x607, %edx            # imm = 0x607
jmp 0xf16dc
leaq 0x696(%rip), %rax       # 0xf1cc6
movq %rax, 0x30(%rbx)
leaq 0x6d6(%rip), %rax       # 0xf1d11
jmp 0xf1663
leaq 0xd90(%rip), %rax       # 0xf23d4
movq %rax, 0x30(%rbx)
leaq 0xdc9(%rip), %rax       # 0xf2418
jmp 0xf1663
leaq 0x2af(%rip), %rax       # 0xf1907
movq %rax, 0x30(%rbx)
leaq 0x396(%rip), %rax       # 0xf19f9
movq %rax, 0x38(%rbx)
jmp 0xf1706
leaq 0xb46(%rip), %rax       # 0xf21b9
movq %rax, 0x30(%rbx)
leaq 0xb73(%rip), %rax       # 0xf21f1
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xf1706
leaq 0x57a18(%rip), %rdi     # 0x1490a8
leaq 0x57511(%rip), %rsi     # 0x148ba8
leaq 0x57ac2(%rip), %rcx     # 0x149160
movl $0x61d, %edx            # imm = 0x61D
jmp 0xf16dc
leaq 0xc0f(%rip), %rax       # 0xf22bb
movq %rax, 0x30(%rbx)
leaq 0xc38(%rip), %rax       # 0xf22ef
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xf1706
leaq 0x579df(%rip), %rdi     # 0x1490a8
leaq 0x574d8(%rip), %rsi     # 0x148ba8
leaq 0x57aae(%rip), %rcx     # 0x149185
movl $0x625, %edx            # imm = 0x625
xorl %eax, %eax
callq 0xbe592
jmp 0xf1706
leaq 0x579bc(%rip), %rdi     # 0x1490a8
leaq 0x574b5(%rip), %rsi     # 0x148ba8
leaq 0x57aaf(%rip), %rcx     # 0x1491a9
movl $0x630, %edx            # imm = 0x630
xorl %eax, %eax
callq 0xbe592
movl $0x0, 0x40(%rbx)
movq 0x10(%rbx), %rax
cmpq $0xd, %rax
ja 0xf1764
movl $0x1940, %ecx           # imm = 0x1940
btq %rax, %rcx
jae 0xf1728
movb $0x1, 0x40(%rbx)
jmp 0xf1737
movl $0x2400, %ecx           # imm = 0x2400
btq %rax, %rcx
jae 0xf175a
movb $0x1, 0x41(%rbx)
cmpq $0xd, %rax
ja 0xf1764
movl $0x3700, %ecx           # imm = 0x3700
btq %rax, %rcx
jae 0xf1764
movb $0x1, 0x42(%rbx)
cmpq $0xa, %rax
je 0xf1768
cmpq $0xd, %rax
je 0xf1768
jmp 0xf1764
cmpq $0x9, %rax
jne 0xf1764
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