// File: /workspace/github_c_makefile_star2_O3/johsteffens[P]beth/lib/bcore/bcore_spect_array.c
// Function: bcore_array_default_set_gtype
void bcore_array_default_set_gtype( const bcore_array_s* p, bcore_array* o, tp_t type )
{
    vd_t obj = obj_vd( p, o );
    switch( p->type_caps )
    {
        case BCORE_CAPS_ARRAY_DYN_SOLID_STATIC:
        {
            if( p->item_p->header.o_type == type ) break;
            ERR( "cannot change type on static-array" );
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_SOLID_TYPED:
        {
            bcore_array_dyn_solid_typed_s* arr = obj;
            if( arr->type == type ) break;
            if( arr->size > 0 ) ERR( "array size (%zu) must be zero for a type change", arr->size );
            arr->type = type;
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_STATIC:
        {
            if( p->item_p->header.o_type == type ) break;
            ERR( "cannot change type on static-link-array" );
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_TYPED:
        {
            bcore_array_dyn_link_typed_s* arr = obj;
            if( arr->type == type ) break;
            if( arr->size > 0 ) ERR( "array size (%zu) must be zero for a type change", arr->size );
            arr->type = type;
        }
        break;

        case BCORE_CAPS_ARRAY_DYN_LINK_AWARE:
        {
            bcore_array_dyn_link_aware_s* arr = obj;
            if( arr->size > 0 ) ERR( "cannot change type on aware-link-array of non-zero size" );
        }
        break;

        case BCORE_CAPS_ARRAY_FIX_SOLID_STATIC:
        case BCORE_CAPS_ARRAY_FIX_LINK_STATIC:
        case BCORE_CAPS_ARRAY_FIX_LINK_AWARE:
        {
            ERR( "cannot change type on fixed-size-array" );
        }
        break;

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x10(%rdi), %r8
leaq -0x6(%r8), %rax
cmpq $0x7, %rax
ja 0xedb94
movq %rdx, %rbx
movq %rsi, %r14
movq 0x20(%rdi), %r15
leaq 0x5b010(%rip), %rcx     # 0x148a8c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5b3d7(%rip), %rdi     # 0x148e63
leaq 0x5b115(%rip), %rsi     # 0x148ba8
leaq 0x5b49a(%rip), %rcx     # 0x148f34
movl $0x4f8, %edx            # imm = 0x4F8
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xbe592
cmpq $0x0, 0x8(%r14,%r15)
je 0xedb8e
leaq 0x5b3a5(%rip), %rdi     # 0x148e63
leaq 0x5b0e3(%rip), %rsi     # 0x148ba8
leaq 0x5b430(%rip), %rcx     # 0x148efc
movl $0x4f0, %edx            # imm = 0x4F0
jmp 0xeda9f
movq 0x28(%rdi), %rax
cmpq %rbx, 0x8(%rax)
je 0xedb8e
leaq 0x5b37b(%rip), %rdi     # 0x148e63
leaq 0x5b0b9(%rip), %rsi     # 0x148ba8
leaq 0x5b3de(%rip), %rcx     # 0x148ed4
movl $0x4e0, %edx            # imm = 0x4E0
jmp 0xeda9f
cmpq %rbx, 0x18(%r14,%r15)
je 0xedb8e
movq 0x8(%r14,%r15), %r8
testq %r8, %r8
je 0xedb89
leaq 0x5b34a(%rip), %rdi     # 0x148e63
leaq 0x5b088(%rip), %rsi     # 0x148ba8
leaq 0x5b37d(%rip), %rcx     # 0x148ea4
movl $0x4e8, %edx            # imm = 0x4E8
jmp 0xedb82
movq 0x28(%rdi), %rax
cmpq %rbx, 0x8(%rax)
je 0xedb8e
leaq 0x5b324(%rip), %rdi     # 0x148e63
leaq 0x5b062(%rip), %rsi     # 0x148ba8
leaq 0x5b334(%rip), %rcx     # 0x148e81
movl $0x4d0, %edx            # imm = 0x4D0
jmp 0xeda9f
cmpq %rbx, 0x18(%r14,%r15)
je 0xedb8e
movq 0x8(%r14,%r15), %r8
testq %r8, %r8
je 0xedb89
leaq 0x5b2f4(%rip), %rdi     # 0x148e63
leaq 0x5b032(%rip), %rsi     # 0x148ba8
leaq 0x5b327(%rip), %rcx     # 0x148ea4
movl $0x4d8, %edx            # imm = 0x4D8
xorl %eax, %eax
callq 0xbe592
movq %rbx, 0x18(%r14,%r15)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5b2c8(%rip), %rdi     # 0x148e63
leaq 0x5b006(%rip), %rsi     # 0x148ba8
leaq 0x5b040(%rip), %rcx     # 0x148be9
movl $0x4fe, %edx            # imm = 0x4FE
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xbe592