// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
movq %rdi, %r14
movl $0x48, %esi
xorl %edi, %edi
callq 0xc8315
movq %rax, %rbx
movl $0x48, %esi
movq %rax, %rdi
callq 0xc8366
movabsq $-0x5073d588c3beb52e, %rax # imm = 0xAF8C2A773C414AD2
movq %rax, (%rbx)
leaq 0x565ba(%rip), %rdi     # 0x151ef2
callq 0xe1270
movq %rax, (%rbx)
movq %r14, 0x8(%rsp)
movq 0x8(%r14), %r15
movq %r15, 0x8(%rbx)
leaq 0xadb14(%rip), %rax     # 0x1a9468
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 0xfb9ae
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0xfb9ae
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0xfb9ae
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0xfbd3b
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xfb9de
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r15, %rsi
callq 0xf3f85
movq %rax, %r12
leaq 0xada95(%rip), %rdi     # 0x1a9468
movq %r15, %rsi
movq %rax, %rdx
callq 0x12128c
cmpq $0x0, 0x10(%r12)
jne 0xfba23
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xe0cbc
testq %rax, %rax
leaq 0x57cf1(%rip), %r8      # 0x1536ef
cmovneq %rax, %r8
leaq 0x58677(%rip), %rdi     # 0x154080
leaq 0x58170(%rip), %rsi     # 0x153b80
leaq 0x586c8(%rip), %rcx     # 0x1540df
movl $0x5da, %edx            # imm = 0x5DA
xorl %eax, %eax
callq 0xc80f6
movq 0x10(%r12), %r15
cmpq $0x0, 0x8(%r15)
je 0xfbafb
movq $0x0, 0x10(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%r15), %rax
movq 0x18(%rax,%r12), %r14
movl 0x10(%r14), %edi
callq 0xc9310
movl %eax, %ebp
testb %al, %al
je 0xfbade
movl 0x10(%r14), %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 0xc9324
movb $0x1, %cl
movq %rcx, 0x10(%rsp)
testb %al, %al
je 0xfbade
movq 0x18(%r14), %rax
movq %rax, 0x18(%rbx)
testq %rax, %rax
jne 0xfbade
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xe0cbc
testq %rax, %rax
leaq 0x57c39(%rip), %rcx     # 0x1536ef
cmoveq %rcx, %rax
leaq 0x585bf(%rip), %rdi     # 0x154080
leaq 0x580b8(%rip), %rsi     # 0x153b80
movl $0x5ea, %edx            # imm = 0x5EA
leaq 0x5861c(%rip), %rcx     # 0x1540f0
movq %rax, %r8
xorl %eax, %eax
callq 0xc825d
testb %bpl, %bpl
jne 0xfbaf4
incq %r13
addq $0x30, %r12
cmpq 0x8(%r15), %r13
jb 0xfba42
testb $0x1, 0x10(%rsp)
jne 0xfbb38
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xe0cbc
testq %rax, %rax
leaq 0x57bdc(%rip), %r8      # 0x1536ef
cmovneq %rax, %r8
leaq 0x58562(%rip), %rdi     # 0x154080
leaq 0x5805b(%rip), %rsi     # 0x153b80
leaq 0x585fa(%rip), %rcx     # 0x154126
movl $0x5f0, %edx            # imm = 0x5F0
xorl %eax, %eax
callq 0xc80f6
movq 0x10(%rbx), %r8
leaq -0x6(%r8), %rax
cmpq $0x7, %rax
ja 0xfbcaa
leaq 0x57fef(%rip), %rcx     # 0x153b40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x281(%rip), %rax       # 0xfbde2
movq %rax, 0x30(%rbx)
leaq 0x2b0(%rip), %rax       # 0xfbe1c
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xfbccb
leaq 0x584fe(%rip), %rdi     # 0x154080
leaq 0x57ff7(%rip), %rsi     # 0x153b80
leaq 0x585a8(%rip), %rcx     # 0x154138
movl $0x5f8, %edx            # imm = 0x5F8
jmp 0xfbca1
leaq 0xa19(%rip), %rax       # 0xfc5ba
movq %rax, 0x30(%rbx)
leaq 0xa57(%rip), %rax       # 0xfc603
jmp 0xfbc28
leaq 0x5e4(%rip), %rax       # 0xfc199
movq %rax, 0x30(%rbx)
leaq 0x612(%rip), %rax       # 0xfc1d2
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xfbccb
leaq 0x584aa(%rip), %rdi     # 0x154080
leaq 0x57fa3(%rip), %rsi     # 0x153b80
leaq 0x58579(%rip), %rcx     # 0x15415d
movl $0x607, %edx            # imm = 0x607
jmp 0xfbca1
leaq 0x6b7(%rip), %rax       # 0xfc2ac
movq %rax, 0x30(%rbx)
leaq 0x6f7(%rip), %rax       # 0xfc2f7
jmp 0xfbc28
leaq 0xde0(%rip), %rax       # 0xfc9e9
movq %rax, 0x30(%rbx)
leaq 0xe19(%rip), %rax       # 0xfca2d
jmp 0xfbc28
leaq 0x2b6(%rip), %rax       # 0xfbed3
movq %rax, 0x30(%rbx)
leaq 0x3a2(%rip), %rax       # 0xfbfca
movq %rax, 0x38(%rbx)
jmp 0xfbccb
leaq 0xb8a(%rip), %rax       # 0xfc7c2
movq %rax, 0x30(%rbx)
leaq 0xbb7(%rip), %rax       # 0xfc7fa
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xfbccb
leaq 0x5842b(%rip), %rdi     # 0x154080
leaq 0x57f24(%rip), %rsi     # 0x153b80
leaq 0x584d5(%rip), %rcx     # 0x154138
movl $0x61d, %edx            # imm = 0x61D
jmp 0xfbca1
leaq 0xc59(%rip), %rax       # 0xfc8ca
movq %rax, 0x30(%rbx)
leaq 0xc82(%rip), %rax       # 0xfc8fe
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xfbccb
leaq 0x583f2(%rip), %rdi     # 0x154080
leaq 0x57eeb(%rip), %rsi     # 0x153b80
leaq 0x584c1(%rip), %rcx     # 0x15415d
movl $0x625, %edx            # imm = 0x625
xorl %eax, %eax
callq 0xc80f6
jmp 0xfbccb
leaq 0x583cf(%rip), %rdi     # 0x154080
leaq 0x57ec8(%rip), %rsi     # 0x153b80
leaq 0x584c2(%rip), %rcx     # 0x154181
movl $0x630, %edx            # imm = 0x630
xorl %eax, %eax
callq 0xc80f6
movl $0x0, 0x40(%rbx)
movq 0x10(%rbx), %rax
cmpq $0xd, %rax
ja 0xfbd25
movl $0x1940, %ecx           # imm = 0x1940
btq %rax, %rcx
jae 0xfbced
movb $0x1, 0x40(%rbx)
jmp 0xfbcfc
movl $0x2400, %ecx           # imm = 0x2400
btq %rax, %rcx
jae 0xfbd1f
movb $0x1, 0x41(%rbx)
cmpq $0xd, %rax
ja 0xfbd25
movl $0x3700, %ecx           # imm = 0x3700
btq %rax, %rcx
jae 0xfbd25
movb $0x1, 0x42(%rbx)
cmpq $0xa, %rax
je 0xfbd29
cmpq $0xd, %rax
je 0xfbd29
jmp 0xfbd25
cmpq $0x9, %rax
je 0xfbd0d
movb $0x1, 0x43(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0xfb9b2