// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
callq 0xdd7d0
movq %rax, -0x10(%rbp)
leaq 0x75de3(%rip), %rdi     # 0x1512bf
callq 0xc17b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xd46d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xdb548
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xdc6e0
movq %rax, %r8
leaq 0x77eb8(%rip), %rdi     # 0x1533e6
leaq 0x779c3(%rip), %rsi     # 0x152ef8
movl $0x5da, %edx            # imm = 0x5DA
leaq 0x77f04(%rip), %rcx     # 0x153445
movb $0x0, %al
callq 0x9cf40
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0xdb669
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x30(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %edi
callq 0xa0380
testb $0x1, %al
jne 0xdb59e
jmp 0xdb656
movq -0x38(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x30(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x30(%rbp), %rcx
addq %rcx, %rax
movq 0x20(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %edi
callq 0xa0450
testb $0x1, %al
jne 0xdb602
jmp 0xdb650
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0xdb64e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xdc6e0
movq %rax, %r8
leaq 0x77db2(%rip), %rdi     # 0x1533e6
leaq 0x778bd(%rip), %rsi     # 0x152ef8
movl $0x5ea, %edx            # imm = 0x5EA
leaq 0x77e0f(%rip), %rcx     # 0x153456
movb $0x0, %al
callq 0x9d0f0
jmp 0xdb650
movb $0x1, -0x21(%rbp)
jmp 0xdb669
jmp 0xdb658
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xdb560
testb $0x1, -0x21(%rbp)
jne 0xdb6a0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xdc6e0
movq %rax, %r8
leaq 0x77d60(%rip), %rdi     # 0x1533e6
leaq 0x7786b(%rip), %rsi     # 0x152ef8
movl $0x5f0, %edx            # imm = 0x5F0
leaq 0x77df3(%rip), %rcx     # 0x15348c
movb $0x0, %al
callq 0x9cf40
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
addq $-0x6, %rax
movq %rax, -0x40(%rbp)
subq $0x7, %rax
ja 0xdb890
movq -0x40(%rbp), %rax
leaq 0x777f3(%rip), %rcx     # 0x152eb8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
leaq 0x1057(%rip), %rcx      # 0xdc730
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x10c8(%rip), %rcx      # 0xdc7b0
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xdb718
leaq 0x77ce8(%rip), %rdi     # 0x1533e6
leaq 0x777f3(%rip), %rsi     # 0x152ef8
movl $0x5f8, %edx            # imm = 0x5F8
leaq 0x77d8d(%rip), %rcx     # 0x15349e
movb $0x0, %al
callq 0x9cf40
jmp 0xdb8bc
movq -0x10(%rbp), %rax
leaq 0x1198(%rip), %rcx      # 0xdc8c0
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x1229(%rip), %rcx      # 0xdc960
movq %rcx, 0x38(%rax)
jmp 0xdb8bc
movq -0x10(%rbp), %rax
leaq 0x1385(%rip), %rcx      # 0xdcad0
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x13e6(%rip), %rcx      # 0xdcb40
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xdb78a
leaq 0x77c76(%rip), %rdi     # 0x1533e6
leaq 0x77781(%rip), %rsi     # 0x152ef8
movl $0x607, %edx            # imm = 0x607
leaq 0x77d40(%rip), %rcx     # 0x1534c3
movb $0x0, %al
callq 0x9cf40
jmp 0xdb8bc
movq -0x10(%rbp), %rax
leaq 0x1546(%rip), %rcx      # 0xdcce0
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x15c7(%rip), %rcx      # 0xdcd70
movq %rcx, 0x38(%rax)
jmp 0xdb8bc
movq -0x10(%rbp), %rax
leaq 0x17e3(%rip), %rcx      # 0xdcfa0
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x1864(%rip), %rcx      # 0xdd030
movq %rcx, 0x38(%rax)
jmp 0xdb8bc
movq -0x10(%rbp), %rax
leaq 0x19f0(%rip), %rcx      # 0xdd1d0
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x1a61(%rip), %rcx      # 0xdd250
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xdb81f
leaq 0x77be1(%rip), %rdi     # 0x1533e6
leaq 0x776ec(%rip), %rsi     # 0x152ef8
movl $0x61d, %edx            # imm = 0x61D
leaq 0x77c86(%rip), %rcx     # 0x15349e
movb $0x0, %al
callq 0x9cf40
jmp 0xdb8bc
movq -0x10(%rbp), %rax
leaq 0x1b41(%rip), %rcx      # 0xdd370
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x1ba2(%rip), %rcx      # 0xdd3e0
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xdb86e
leaq 0x77b92(%rip), %rdi     # 0x1533e6
leaq 0x7769d(%rip), %rsi     # 0x152ef8
movl $0x625, %edx            # imm = 0x625
leaq 0x77c5c(%rip), %rcx     # 0x1534c3
movb $0x0, %al
callq 0x9cf40
jmp 0xdb8bc
movq -0x10(%rbp), %rax
leaq 0x1d15(%rip), %rcx      # 0xdd590
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x1d96(%rip), %rcx      # 0xdd620
movq %rcx, 0x38(%rax)
jmp 0xdb8bc
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %r8d
leaq 0x77b44(%rip), %rdi     # 0x1533e6
leaq 0x7764f(%rip), %rsi     # 0x152ef8
movl $0x630, %edx            # imm = 0x630
leaq 0x77c32(%rip), %rcx     # 0x1534e7
movb $0x0, %al
callq 0x9cf40
movq -0x10(%rbp), %rax
movb $0x0, 0x40(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x41(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x42(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x43(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
subq $0x6, %rax
je 0xdb924
jmp 0xdb8f0
movq -0x48(%rbp), %rax
subq $0x8, %rax
je 0xdb924
jmp 0xdb8fc
movq -0x48(%rbp), %rax
subq $0xa, %rax
je 0xdb92e
jmp 0xdb908
movq -0x48(%rbp), %rax
addq $-0xb, %rax
subq $0x2, %rax
jb 0xdb924
jmp 0xdb918
movq -0x48(%rbp), %rax
subq $0xd, %rax
je 0xdb92e
jmp 0xdb938
movq -0x10(%rbp), %rax
movb $0x1, 0x40(%rax)
jmp 0xdb93a
movq -0x10(%rbp), %rax
movb $0x1, 0x41(%rax)
jmp 0xdb93a
jmp 0xdb93a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
addq $-0x8, %rax
subq $0x3, %rax
jb 0xdb962
jmp 0xdb952
movq -0x50(%rbp), %rax
addq $-0xc, %rax
subq $0x1, %rax
ja 0xdb96a
jmp 0xdb962
movq -0x10(%rbp), %rax
movb $0x1, 0x42(%rax)
jmp 0xdb96c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
subq $0xa, %rax
je 0xdb98c
jmp 0xdb980
movq -0x58(%rbp), %rax
subq $0xd, %rax
jne 0xdb98e
jmp 0xdb98c
jmp 0xdb996
movq -0x10(%rbp), %rax
movb $0x1, 0x43(%rax)
movq -0x10(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq