// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore_spect_array.c
// Function: bcore_array_default_make_strong
void bcore_array_default_make_strong( const bcore_array_s* p, bcore_array* o )
{
    if( p->size_fix > 0 ) return;
    vd_t obj = ( u0_t* )o + p->caps_offset;
    if( ( ( bcore_array_dyn_head_s* )obj )->size <= ( ( bcore_array_dyn_head_s* )obj )->space ) return;
    switch( p->type_caps )
    {
        case BCORE_CAPS_ARRAY_DYN_SOLID_STATIC:
        {
            bcore_array_dyn_solid_static_s* arr = obj;
            const bcore_inst_s* instance_p = p->item_p;
            uz_t unit_size = instance_p->size;
            vc_t src_data = arr->data;
            arr->data = bcore_u_alloc( unit_size, NULL, arr->size, &arr->space );
            if( instance_p->move_flat )
            {
                bcore_u_memcpy( unit_size, arr->data, src_data, arr->size );
            }
            else
            {
                vd_t dst_data = arr->data;
                for( uz_t i = 0; i < arr->size; i++ )
                {
                    instance_p->copy( instance_p, dst_data, src_data );
                    dst_data = ( u0_t* )dst_data + unit_size;
                    src_data = ( u0_t* )src_data + unit_size;
                }
            }
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_SOLID_TYPED:
        {
            bcore_array_dyn_solid_typed_s* arr = obj;
            if( !arr->type ) ERR( "attempt to take ownership of type-zero array" );
            const bcore_inst_s* instance_p = bcore_inst_s_get_typed( arr->type );
            uz_t unit_size = instance_p->size;
            vc_t src_data = arr->data;
            arr->data = bcore_u_alloc( unit_size, NULL, arr->size, &arr->space );
            if( instance_p->move_flat )
            {
                bcore_u_memcpy( unit_size, arr->data, src_data, arr->size );
            }
            else
            {
                vd_t dst_data = arr->data;
                for( uz_t i = 0; i < arr->size; i++ )
                {
                    instance_p->copy( instance_p, dst_data, src_data );
                    dst_data = ( u0_t* )dst_data + unit_size;
                    src_data = ( u0_t* )src_data + unit_size;
                }
            }
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_STATIC:
        {
            bcore_array_dyn_link_static_s* arr = obj;
            const bcore_inst_s* instance_p = p->item_p;
            vd_t* src_data = arr->data;
            arr->data = bcore_u_alloc( sizeof( vd_t ), NULL, arr->size, &arr->space );
            vd_t* dst_data = arr->data;
            for( uz_t i = 0; i < arr->size; i++ ) *dst_data++ = instance_p->clone( instance_p, *src_data++ );
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_TYPED:
        {
            bcore_array_dyn_link_typed_s* arr = obj;
            if( !arr->type ) ERR( "attempt to take ownership of type-zero array" );
            const bcore_inst_s* instance_p = bcore_inst_s_get_typed( arr->type );
            vd_t* src_data = arr->data;
            arr->data = bcore_u_alloc( sizeof( vd_t ), NULL, arr->size, &arr->space );
            vd_t* dst_data = arr->data;
            for( uz_t i = 0; i < arr->size; i++ ) *dst_data++ = instance_p->clone( instance_p, *src_data++ );
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_AWARE:
        {
            bcore_array_dyn_link_aware_s* arr = obj;
            vd_t* src_data = arr->data;
            arr->data = bcore_u_alloc( sizeof( vd_t ), NULL, arr->size, &arr->space );
            vd_t* dst_data = arr->data;
            for( uz_t i = 0; i < arr->size; i++ ) *dst_data++ = bcore_inst_a_clone( *src_data++ );
        }
        break;

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x18(%rdi)
jne 0x7b38b
movq 0x20(%rdi), %rax
movq 0x8(%rsi,%rax), %rdx
cmpq 0x10(%rsi,%rax), %rdx
jbe 0x7b38b
movq 0x10(%rdi), %r8
leaq -0x6(%r8), %rcx
cmpq $0x4, %rcx
ja 0x7b338
leaq (%rsi,%rax), %r13
leaq (%rsi,%rax), %rbx
addq $0x10, %rbx
leaq 0x4b741(%rip), %rax     # 0xc6898
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x28(%rdi), %r12
movq 0x18(%r12), %r15
movq (%r13), %r14
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x6025e
movq %rax, %rbx
movq %rax, (%r13)
cmpb $0x0, 0x2c(%r12)
jne 0x7b318
xorl %ebp, %ebp
cmpq 0x8(%r13), %rbp
jae 0x7b38b
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x90(%r12)
addq %r15, %rbx
addq %r15, %r14
incq %rbp
jmp 0x7b18f
movq (%r13), %r15
xorl %r12d, %r12d
pushq $0x8
popq %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x6025e
movq %rax, %rbx
movq %rax, (%r13)
cmpq 0x8(%r13), %r12
jae 0x7b38b
movq (%r15,%r12,8), %r14
testq %r14, %r14
je 0x7b1f9
movq (%r14), %rdi
callq 0x7b39a
movq %rax, %rdi
movq %r14, %rsi
callq *0xc0(%rax)
jmp 0x7b1fb
xorl %eax, %eax
movq %rax, (%rbx,%r12,8)
incq %r12
jmp 0x7b1d0
movq 0x28(%rdi), %r14
movq (%r13), %r15
xorl %r12d, %r12d
pushq $0x8
popq %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x6025e
movq %rax, %rbx
movq %rax, (%r13)
cmpq 0x8(%r13), %r12
jae 0x7b38b
movq (%r15,%r12,8), %rsi
movq %r14, %rdi
callq *0xc0(%r14)
movq %rax, (%rbx,%r12,8)
incq %r12
jmp 0x7b223
movq 0x18(%r13), %rdi
testq %rdi, %rdi
jne 0x7b272
leaq 0x4b7fc(%rip), %rdi     # 0xc6a50
leaq 0x4b815(%rip), %rsi     # 0xc6a70
leaq 0x4b822(%rip), %rcx     # 0xc6a84
movl $0xa9, %edx
xorl %eax, %eax
callq 0x60031
movq 0x18(%r13), %rdi
callq 0x7b39a
movq %rax, %r14
movq (%r13), %r15
movq 0x8(%r13), %rdx
xorl %r12d, %r12d
pushq $0x8
popq %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x6025e
movq %rax, %rbx
movq %rax, (%r13)
cmpq 0x8(%r13), %r12
jae 0x7b38b
movq (%r15,%r12,8), %rsi
movq %r14, %rdi
callq *0xc0(%r14)
movq %rax, (%rbx,%r12,8)
incq %r12
jmp 0x7b299
movq 0x18(%r13), %rdi
testq %rdi, %rdi
jne 0x7b2e8
leaq 0x4b786(%rip), %rdi     # 0xc6a50
leaq 0x4b79f(%rip), %rsi     # 0xc6a70
leaq 0x4b7ac(%rip), %rcx     # 0xc6a84
movl $0x85, %edx
xorl %eax, %eax
callq 0x60031
movq 0x18(%r13), %rdi
callq 0x7b39a
movq %rax, %r12
movq 0x18(%rax), %r15
movq (%r13), %r14
movq 0x8(%r13), %rdx
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x6025e
movq %rax, %rbx
movq %rax, (%r13)
cmpb $0x0, 0x2c(%r12)
je 0x7b367
movq 0x8(%r13), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6033c
leaq 0x4b711(%rip), %rdi     # 0xc6a50
leaq 0x4b72a(%rip), %rsi     # 0xc6a70
leaq 0x4b764(%rip), %rcx     # 0xc6ab1
movl $0xbc, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x60031
xorl %ebp, %ebp
cmpq 0x8(%r13), %rbp
jae 0x7b38b
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x90(%r12)
addq %r15, %rbx
addq %r15, %r14
incq %rbp
jmp 0x7b369
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq