// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore_flect.c
// Function: bcore_flect_signal_handler
vd_t bcore_flect_signal_handler( const bcore_signal_s* o )
{
    switch( bcore_signal_s_handle_type( o, typeof( "bcore_flect" ) ) )
    {
        case TYPEOF_init0:
        {
            flect_open();
        }
        break;

        case TYPEOF_init1:
        {
            // some basic traits
            bcore_trait_set( entypeof( "root"             ), 0 ); // root trait (all traits should end in root)
            bcore_trait_set( entypeof( "bcore_inst"       ), typeof( "root" ) ); // all (instantiable) reflections should inherit bcore_inst
            bcore_trait_set( entypeof( "leaf"             ), typeof( "bcore_inst" ) ); // leaf trait
            bcore_trait_set( entypeof( "function_pointer" ), typeof( "leaf" ) );       // type of trait function_pointer can be casted to fp_t
            bcore_trait_set( entypeof( "num"              ), typeof( "leaf" ) );       // a number is a leaf type
            bcore_trait_set( entypeof( "type"             ), typeof( "num"  ) );       // type is encoded as number

            flect_define_basics();
            BCORE_REGISTER_OBJECT( bcore_link_static_s );
            BCORE_REGISTER_OBJECT( bcore_link_typed_s );
            BCORE_REGISTER_OBJECT( bcore_link_aware_s );
            BCORE_REGISTER_OBJECT( bcore_array_dyn_solid_static_s );
            BCORE_REGISTER_OBJECT( bcore_array_dyn_solid_typed_s );
            BCORE_REGISTER_OBJECT( bcore_array_dyn_link_static_s );
            BCORE_REGISTER_OBJECT( bcore_array_dyn_link_typed_s );
            BCORE_REGISTER_OBJECT( bcore_array_dyn_link_aware_s );
        }
        break;

        case TYPEOF_down0:
        {
            s2_t verbosity = o->object ? *( s2_t* )o->object : 0;
            if( verbosity > 0 )
            {
                uz_t count = bcore_flect_size();
                uz_t space = bcore_tbman_total_granted_space();
                flect_close();
                space -= bcore_tbman_total_granted_space();

                bcore_msg( "  reflection mananger . % 7zu (by % 4zu reflections  )\n", space, count );
            }
            else
            {
                flect_close();
            }
        }
        break;

        case TYPEOF_selftest:
        {
            flect_test_create_struct();
            flect_test_create_struct_nasc();
            return flect_selftest();
        }
        break;

        default: break;
    }
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x5cb24(%rip), %rdi     # 0xc1f1e
callq 0x64246
movq %rbx, %rdi
movq %rax, %rsi
callq 0x75141
movabsq $-0x69a05554ee793861, %rcx # imm = 0x965FAAAB1186C79F
cmpq %rcx, %rax
je 0x65b00
movabsq $0x6a72ce8f8250efc6, %rcx # imm = 0x6A72CE8F8250EFC6
cmpq %rcx, %rax
je 0x6546a
movabsq $0x7ee758bbfced33e3, %rcx # imm = 0x7EE758BBFCED33E3
cmpq %rcx, %rax
je 0x65a63
movabsq $0x6a72cf8f8250f179, %rcx # imm = 0x6A72CF8F8250F179
cmpq %rcx, %rax
jne 0x65b46
leaq 0xb295f(%rip), %rdi     # 0x117db8
leaq -0xc3b(%rip), %rsi      # 0x64825
callq 0x97d2e
jmp 0x65b46
leaq 0x5cab9(%rip), %rbx     # 0xc1f2a
movq %rbx, %rdi
callq 0x7227a
movq %rax, %rdi
xorl %esi, %esi
callq 0x99410
leaq 0x5ca1b(%rip), %r14     # 0xc1ea5
movq %r14, %rdi
callq 0x7227a
movq %rax, %r15
movq %rbx, %rdi
callq 0x64246
movq %r15, %rdi
movq %rax, %rsi
callq 0x99410
leaq 0x6741e(%rip), %rbx     # 0xcc8cd
movq %rbx, %rdi
callq 0x7227a
movq %rax, %r15
movq %r14, %rdi
callq 0x64246
movq %r15, %rdi
movq %rax, %rsi
callq 0x99410
leaq 0x5ca5b(%rip), %rdi     # 0xc1f2f
callq 0x7227a
movq %rax, %r14
movq %rbx, %rdi
callq 0x64246
movq %r14, %rdi
movq %rax, %rsi
callq 0x99410
leaq 0x536c1(%rip), %r14     # 0xb8bb7
movq %r14, %rdi
callq 0x7227a
movq %rax, %r15
movq %rbx, %rdi
callq 0x64246
movq %r15, %rdi
movq %rax, %rsi
callq 0x99410
leaq 0x52421(%rip), %rdi     # 0xb793c
callq 0x7227a
movq %rax, %r15
movq %r14, %rdi
callq 0x64246
movq %r15, %rdi
movq %rax, %rsi
callq 0x99410
leaq 0x44ff3(%rip), %rdi     # 0xaa530
callq 0x7227a
movq %rax, %r14
movq %rbx, %rdi
callq 0x64246
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d709(%rip), %rdi     # 0xc2c74
callq 0x7227a
movabsq $0x2102bb192543fb93, %r14 # imm = 0x2102BB192543FB93
pushq $0x1
popq %r12
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r12, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d6db(%rip), %rdi     # 0xc2c79
callq 0x7227a
pushq $0x2
popq %r13
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r13, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d6b7(%rip), %rdi     # 0xc2c7e
callq 0x7227a
pushq $0x4
popq %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x65233(%rip), %rdi     # 0xca822
callq 0x7227a
pushq $0x8
popq %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d66b(%rip), %rdi     # 0xc2c83
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d64b(%rip), %rdi     # 0xc2c88
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d62d(%rip), %rdi     # 0xc2c8f
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r12, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d60d(%rip), %rdi     # 0xc2c94
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r13, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d5ed(%rip), %rdi     # 0xc2c99
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x4f293(%rip), %rdi     # 0xb4964
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d5a8(%rip), %rdi     # 0xc2c9e
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d588(%rip), %rdi     # 0xc2ca3
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d56a(%rip), %rdi     # 0xc2caa
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d54a(%rip), %rdi     # 0xc2caf
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d52a(%rip), %rdi     # 0xc2cb4
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r12, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d50a(%rip), %rdi     # 0xc2cb9
callq 0x7227a
movabsq $0x24ad84ada20208d5, %r12 # imm = 0x24AD84ADA20208D5
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x56444(%rip), %rdi     # 0xbbc22
callq 0x7227a
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d4bb(%rip), %rdi     # 0xc2cbe
callq 0x7227a
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d49b(%rip), %rdi     # 0xc2cc3
callq 0x7227a
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d47b(%rip), %rdi     # 0xc2cc8
callq 0x7227a
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d45b(%rip), %rdi     # 0xc2ccd
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x60fc7(%rip), %rdi     # 0xc685e
callq 0x7227a
movabsq $-0x586bc610840563d3, %r14 # imm = 0xA79439EF7BFA9C2D
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d410(%rip), %rdi     # 0xc2cd6
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d31d(%rip), %rdi     # 0xc2c08
callq 0x7227a
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5d3cb(%rip), %rdi     # 0xc2cdb
callq 0x7227a
movabsq $-0x5cab02e00f3b983b, %rsi # imm = 0xA354FD1FF0C467C5
movq %rax, %rdi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x63bce
movq %rax, %rdi
callq 0x64d04
leaq 0x5162c(%rip), %rdi     # 0xb6f68
callq 0x64246
leaq 0x34d(%rip), %rsi       # 0x65c95
movq %rax, %rdi
callq 0x6513b
leaq 0x5be00(%rip), %rdi     # 0xc1757
callq 0x64246
leaq 0x435(%rip), %rsi       # 0x65d98
movq %rax, %rdi
callq 0x6513b
leaq 0x5bfc2(%rip), %rdi     # 0xc1934
callq 0x64246
leaq 0x4e3(%rip), %rsi       # 0x65e61
movq %rax, %rdi
callq 0x6513b
leaq 0x5c5b3(%rip), %rdi     # 0xc1f40
callq 0x64246
leaq 0x1b9(%rip), %rsi       # 0x65b52
movq %rax, %rdi
callq 0x6513b
leaq 0x5c5ac(%rip), %rdi     # 0xc1f54
callq 0x64246
leaq 0x1b0(%rip), %rsi       # 0x65b64
movq %rax, %rdi
callq 0x6513b
leaq 0x5c5a4(%rip), %rdi     # 0xc1f67
callq 0x64246
leaq 0x1a7(%rip), %rsi       # 0x65b76
movq %rax, %rdi
callq 0x6513b
leaq 0x5c59c(%rip), %rdi     # 0xc1f7a
callq 0x64246
leaq 0x19e(%rip), %rsi       # 0x65b88
movq %rax, %rdi
callq 0x6513b
leaq 0x5c5a0(%rip), %rdi     # 0xc1f99
callq 0x64246
leaq 0x195(%rip), %rsi       # 0x65b9a
movq %rax, %rdi
callq 0x6513b
leaq 0x5c5a3(%rip), %rdi     # 0xc1fb7
callq 0x64246
leaq 0x18c(%rip), %rsi       # 0x65bac
movq %rax, %rdi
callq 0x6513b
leaq 0x5c5a6(%rip), %rdi     # 0xc1fd5
callq 0x64246
leaq 0x183(%rip), %rsi       # 0x65bbe
movq %rax, %rdi
callq 0x6513b
leaq 0x5c5a8(%rip), %rdi     # 0xc1ff2
callq 0x64246
leaq 0x17a(%rip), %rsi       # 0x65bd0
movq %rax, %rdi
callq 0x6513b
jmp 0x65b46
callq 0x65365
callq 0x6539b
leaq 0x5d5cb(%rip), %rdi     # 0xc303f
callq 0x64de5
leaq 0x5d5f7(%rip), %rdi     # 0xc3077
callq 0x64de5
leaq 0x5d62a(%rip), %rdi     # 0xc30b6
callq 0x64de5
leaq 0x5d671(%rip), %rdi     # 0xc3109
callq 0x64de5
leaq 0x5d679(%rip), %rbx     # 0xc311d
movq %rbx, %rdi
callq 0x65033
movq %rax, %r14
leaq 0x5d691(%rip), %rdi     # 0xc3147
movq %rax, %rsi
xorl %eax, %eax
callq 0x65093
movq %rax, %rdi
callq 0x64ca3
movq %rbx, %rdi
callq 0x65033
cmpq %rax, %r14
je 0x65b46
leaq 0x44b6b(%rip), %rdi     # 0xaa647
leaq 0x5d696(%rip), %rsi     # 0xc3179
leaq 0x5d6a5(%rip), %rdx     # 0xc318f
leaq 0x5b8cd(%rip), %rcx     # 0xc13be
movl $0xa57, %r8d            # imm = 0xA57
xorl %eax, %eax
callq 0x5ffac
jmp 0x65b46
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x65b41
cmpl $0x0, (%rax)
jle 0x65b41
callq 0x6494d
movq %rax, %rbx
callq 0x9536f
movq %rax, %r14
callq 0x6488a
callq 0x9536f
subq %rax, %r14
leaq 0x5c4dd(%rip), %rdi     # 0xc200f
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5fb6b
jmp 0x65b46
callq 0x6488a
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq