// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore_tbman.c
// Function: tbman_s_diagnostic_test
static void tbman_s_diagnostic_test( void )
{
    diagnostic_s diag;
    diag.man     = bcore_tbman_s_create_default();
    diag.size    = 1000;
    diag.ptr_arr = bcore_malloc( sizeof( vd_t ) * diag.size );
    diag.spc_arr = bcore_malloc( sizeof( sz_t ) * diag.size );

    u2_t rval = 1234;

    for( sz_t i = 0; i < diag.size; i++ )
    {
        rval = bcore_xsg_u2( rval );
        sz_t size = rval % 20000;
        diag.ptr_arr[ i ] = bcore_tbman_s_b_alloc( diag.man, NULL, size, &diag.spc_arr[ i ] );
    }

    ASSERT( bcore_tbman_s_total_instances( diag.man ) == diag.size );

    // the callback function frees memory
    bcore_tbman_s_for_each_instance( diag.man, tbman_s_diagnostic_test_callback, &diag );

    ASSERT( bcore_tbman_s_total_granted_space( diag.man ) == 0 );
    ASSERT( bcore_tbman_s_total_instances(     diag.man ) == 0 );

    diag.ptr_arr = bcore_free( diag.ptr_arr );
    diag.spc_arr = bcore_free( diag.spc_arr );

    bcore_tbman_s_discard( diag.man );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
callq 0x108340
movq %rax, -0x20(%rbp)
movq $0x3e8, -0x8(%rbp)      # imm = 0x3E8
movq -0x8(%rbp), %rdi
shlq $0x3, %rdi
callq 0x9d270
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
shlq $0x3, %rdi
callq 0x9d270
movq %rax, -0x10(%rbp)
movl $0x4d2, -0x24(%rbp)     # imm = 0x4D2
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x8(%rbp), %rax
jge 0x10be8e
movl -0x24(%rbp), %edi
callq 0x10f390
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl $0x4e20, %ecx           # imm = 0x4E20
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
callq 0x1089f0
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x10be2a
movq -0x20(%rbp), %rdi
callq 0x109720
cmpq -0x8(%rbp), %rax
je 0x10bec6
leaq 0x27afb(%rip), %rdi     # 0x13399f
leaq 0x4c098(%rip), %rsi     # 0x157f43
leaq 0x4c0c8(%rip), %rdx     # 0x157f7a
leaq 0x4b4e4(%rip), %rcx     # 0x15739d
movl $0xc81, %r8d            # imm = 0xC81
movb $0x0, %al
callq 0x9cea0
movq -0x20(%rbp), %rdi
leaq 0x365f(%rip), %rsi      # 0x10f530
leaq -0x20(%rbp), %rdx
callq 0x109820
movq -0x20(%rbp), %rdi
callq 0x1096a0
cmpq $0x0, %rax
je 0x10bf12
leaq 0x27aaf(%rip), %rdi     # 0x13399f
leaq 0x4c09b(%rip), %rsi     # 0x157f92
leaq 0x4c07c(%rip), %rdx     # 0x157f7a
leaq 0x4b498(%rip), %rcx     # 0x15739d
movl $0xc86, %r8d            # imm = 0xC86
movb $0x0, %al
callq 0x9cea0
movq -0x20(%rbp), %rdi
callq 0x109720
cmpq $0x0, %rax
je 0x10bf4a
leaq 0x27a77(%rip), %rdi     # 0x13399f
leaq 0x4c096(%rip), %rsi     # 0x157fc5
leaq 0x4c044(%rip), %rdx     # 0x157f7a
leaq 0x4b460(%rip), %rcx     # 0x15739d
movl $0xc87, %r8d            # imm = 0xC87
movb $0x0, %al
callq 0x9cea0
movq -0x18(%rbp), %rdi
callq 0x9d1c0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9d1c0
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rdi
callq 0x108370
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)