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

        case TYPEOF_init1:
        {
            tbman_s_quicktest(); // system critical test
        }
        break;

        case TYPEOF_down0:
        {
            s2_t verbosity = o->object ? *( s2_t* )o->object : 0;
            if( verbosity >= 0 )
            {
                uz_t space = bcore_tbman_total_granted_space();
                if( space > 0 )
                {
                    uz_t instances = bcore_tbman_total_instances();
                    uz_t references = bcore_tbman_total_references();
                    st_s_print_d( bcore_tbman_s_status( tbman_s_g, 1 ) );
                    WRN
                    (
                        "Leaking memory .... %zu bytes\n"
                        "     instances .... %zu\n"
                        "     references ... %zu\n",
                        space,
                        instances,
                        references
                    );
                }
            }
            tbman_close();
        }
        break;

        case TYPEOF_selftest:
        {
            st_s* log = st_s_create();
            tbman_s_diagnostic_test();
            tbman_s_instance_test();
            st_s_push_st_d( log, tbman_s_thread_test() );
            st_s_push_st_d( log, tbman_s_rctest() );
            st_s_push_st_d( log, tbman_s_memtest() );
            return log;
        }
        break;

        default: break;
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq 0x4bc92(%rip), %rdi     # 0x15783d
callq 0x10bd50
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0xc7f40
movq %rax, %rcx
movq %rcx, -0x40(%rbp)
movabsq $-0x69a05554ee793861, %rcx # imm = 0x965FAAAB1186C79F
subq %rcx, %rax
je 0x10bc2e
jmp 0x10bbd4
movq -0x40(%rbp), %rax
movabsq $0x6a72ce8f8250efc6, %rcx # imm = 0x6A72CE8F8250EFC6
subq %rcx, %rax
je 0x10bc24
jmp 0x10bbe9
movq -0x40(%rbp), %rax
movabsq $0x6a72cf8f8250f179, %rcx # imm = 0x6A72CF8F8250F179
subq %rcx, %rax
je 0x10bc1a
jmp 0x10bbfe
movq -0x40(%rbp), %rax
movabsq $0x7ee758bbfced33e3, %rcx # imm = 0x7EE758BBFCED33E3
subq %rcx, %rax
je 0x10bcd0
jmp 0x10bd3a
callq 0x10f4c0
jmp 0x10bd3c
callq 0x10bd70
jmp 0x10bd3c
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x10bc48
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
jmp 0x10bc4f
xorl %eax, %eax
movl %eax, -0x4c(%rbp)
jmp 0x10bc4f
movl -0x4c(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x10bcc9
callq 0x109a60
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jbe 0x10bcc7
callq 0x109a80
movq %rax, -0x28(%rbp)
callq 0x109aa0
movq %rax, -0x30(%rbp)
movq 0xa7bec(%rip), %rdi     # 0x1b3870
movl $0x1, %esi
callq 0x109b10
movq %rax, %rdi
callq 0x101c20
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x30(%rbp), %rax
leaq 0x4bba0(%rip), %rdi     # 0x157849
leaq 0x4b6ed(%rip), %rsi     # 0x15739d
movl $0xcb9, %edx            # imm = 0xCB9
leaq 0x4bba8(%rip), %rcx     # 0x157864
movq %rax, (%rsp)
movb $0x0, %al
callq 0x9cbb0
jmp 0x10bcc9
callq 0x10f500
jmp 0x10bd3c
movb $0x0, %al
callq 0xff2e0
movq %rax, -0x38(%rbp)
callq 0x10bde0
callq 0x10bf80
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
callq 0x10c070
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0xfff40
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
callq 0x10c200
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0xfff40
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0x10c840
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0xfff40
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x10bd44
jmp 0x10bd3c
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nop