// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore_tp_fastmap.c
// Function: selftest
static vd_t selftest( void )
{
    st_s* log = st_s_createf( "== bcore_tp_fastmap_selftest " );
    st_s_push_char_n( log, '=', 80 - log->size );
    st_s_push_char( log, '\n' );

    const uz_t cycles = 10000;
    const uz_t kvbuf_size = 2000;

    typedef struct
    {
        tp_t key;
        vc_t val;
    } kv_s;

    u3_t rinit = 12234;
    u3_t rval = rinit;

    kv_s* kvbuf = bcore_alloc( NULL, kvbuf_size * sizeof( kv_s ) );
    for( uz_t i = 0; i < kvbuf_size; i++ )
    {
        rval = bcore_lcg00_u3( rval );
        tp_t key = rval;
        vc_t val = ( vc_t )( intptr_t )key;
        kvbuf[ i ].key = key;
        kvbuf[ i ].val = val;
    }

    bcore_tp_fastmap_s* map = bcore_tp_fastmap_s_create();

    for( uz_t i = 0; i < cycles; i++ )
    {
        for( uz_t j = 0; j < kvbuf_size; j++ )
        {
            kv_s kv = kvbuf[ j ];
            vc_t v = bcore_tp_fastmap_s_get( map, kv.key );
            if( v )
            {
                ASSERT( v == kv.val );
            }
            else
            {
                ASSERT( bcore_tp_fastmap_s_set( map, kv.key, kv.val ) );
                vc_t v = bcore_tp_fastmap_s_get( map, kv.key );
                ASSERT( v == kv.val );
            }
        }
    }

    rval = rinit;

    // test retrieve only
    for( uz_t i = 0; i < cycles; i++ )
    {
        for( uz_t j = 0; j < kvbuf_size; j++ )
        {
            kv_s kv = kvbuf[ j ];
            vc_t v = bcore_tp_fastmap_s_get( map, kv.key );
            ASSERT( v == kv.val );
        }
    }

    // overhead time
    clock_t time, overhead;
    {
        overhead = clock();
        uz_t sum = 0;
        for( uz_t i = 0; i < cycles; i++ )
        {
            for( uz_t j = 0; j < kvbuf_size; j++ )
            {
                kv_s kv = kvbuf[ j ];
                sum += ( uz_t )kv.val;
            }
        }
        st_s_push_fa( log, "", sum ); // let compiler think sum is used
        overhead = clock() - overhead;
    }

    // time test retrieve only
    {
        time = clock();
        uz_t sum = 0;
        for( uz_t i = 0; i < cycles; i++ )
        {
            for( uz_t j = 0; j < kvbuf_size; j++ )
            {
                kv_s kv = kvbuf[ j ];
                vc_t v = bcore_tp_fastmap_s_get( map, kv.key );
                sum += ( uz_t )v;
            }
        }
        time = clock() - time;
        st_s_push_fa( log, "", sum ); // let compiler think sum is used
    }

    st_s_push_fa( log, "get ... #<uz_t>ps\n", ( uz_t ) ( ( 1E12 * ( double )( time - overhead )/CLOCKS_PER_SEC ) / ( cycles * kvbuf_size ) ) );
    st_s_push_fa( log, "size .. #<uz_t>\n", bcore_tp_fastmap_s_size( map ) );
    st_s_push_fa( log, "keys .. #<uz_t>\n", bcore_tp_fastmap_s_keys( map ) );

    uz_t bcore_tp_fastmap_s_keys( bcore_tp_fastmap_s* o );


    bcore_tp_fastmap_s_discard( map );
    bcore_free( kvbuf );

    st_s_push_char_n( log, '=', 80 );
    st_s_push_char( log, '\n' );
    return log;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
leaq 0x45e77(%rip), %rdi     # 0x158589
movb $0x0, %al
callq 0xff350
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl $0x50, %edx
subq 0x10(%rax), %rdx
movl $0x3d, %esi
callq 0xffca0
movq -0x8(%rbp), %rdi
movl $0xa, %esi
callq 0xffba0
movq $0x2710, -0x10(%rbp)    # imm = 0x2710
movq $0x7d0, -0x18(%rbp)     # imm = 0x7D0
movq $0x2fca, -0x20(%rbp)    # imm = 0x2FCA
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %edi
movl $0x7d00, %esi           # imm = 0x7D00
callq 0x9d210
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x7d0, -0x38(%rbp)     # imm = 0x7D0
jae 0x1127e2
movq -0x28(%rbp), %rdi
callq 0x112e00
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x112780
callq 0x112360
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
cmpq $0x2710, -0x58(%rbp)    # imm = 0x2710
jae 0x11292f
movq $0x0, -0x60(%rbp)
cmpq $0x7d0, -0x60(%rbp)     # imm = 0x7D0
jae 0x11291c
movq -0x30(%rbp), %rax
movq -0x60(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x70(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x112e20
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x112885
movq -0x78(%rbp), %rax
cmpq -0x68(%rbp), %rax
je 0x112880
leaq 0x21141(%rip), %rdi     # 0x13399f
leaq 0x45d42(%rip), %rsi     # 0x1585a7
leaq 0x43871(%rip), %rdx     # 0x1560dd
leaq 0x45cc5(%rip), %rcx     # 0x158538
movl $0xde, %r8d
movb $0x0, %al
callq 0x9cea0
jmp 0x112909
movq -0x50(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0x112460
testb $0x1, %al
jne 0x1128c3
leaq 0x210fe(%rip), %rdi     # 0x13399f
leaq 0x45d0b(%rip), %rsi     # 0x1585b3
leaq 0x4382e(%rip), %rdx     # 0x1560dd
leaq 0x45c82(%rip), %rcx     # 0x158538
movl $0xe2, %r8d
movb $0x0, %al
callq 0x9cea0
movq -0x50(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x112e20
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x68(%rbp), %rax
je 0x112907
leaq 0x210ba(%rip), %rdi     # 0x13399f
leaq 0x45cbb(%rip), %rsi     # 0x1585a7
leaq 0x437ea(%rip), %rdx     # 0x1560dd
leaq 0x45c3e(%rip), %rcx     # 0x158538
movl $0xe4, %r8d
movb $0x0, %al
callq 0x9cea0
jmp 0x112909
jmp 0x11290b
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x112809
jmp 0x11291e
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x1127f3
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x88(%rbp)
cmpq $0x2710, -0x88(%rbp) # imm = 0x2710
jae 0x112a18
movq $0x0, -0x90(%rbp)
cmpq $0x7d0, -0x90(%rbp) # imm = 0x7D0
jae 0x1129ff
movq -0x30(%rbp), %rax
movq -0x90(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0xa0(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x50(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x112e20
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x98(%rbp), %rax
je 0x1129e6
leaq 0x20fdb(%rip), %rdi     # 0x13399f
leaq 0x45bdc(%rip), %rsi     # 0x1585a7
leaq 0x4370b(%rip), %rdx     # 0x1560dd
leaq 0x45b5f(%rip), %rcx     # 0x158538
movl $0xf2, %r8d
movb $0x0, %al
callq 0x9cea0
jmp 0x1129e8
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x11295e
jmp 0x112a01
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x112942
callq 0x4300
movq %rax, -0xb8(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xc8(%rbp)
cmpq $0x2710, -0xc8(%rbp) # imm = 0x2710
jae 0x112acc
movq $0x0, -0xd0(%rbp)
cmpq $0x7d0, -0xd0(%rbp) # imm = 0x7D0
jae 0x112ab3
movq -0x30(%rbp), %rax
movq -0xd0(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0xe0(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
addq -0xc0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xd0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd0(%rbp)
jmp 0x112a56
jmp 0x112ab5
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x112a3a
movq -0x8(%rbp), %rdi
movq -0xc0(%rbp), %rdx
leaq 0x3ff44(%rip), %rsi     # 0x152a22
movb $0x0, %al
callq 0x100210
callq 0x4300
subq -0xb8(%rbp), %rax
movq %rax, -0xb8(%rbp)
callq 0x4300
movq %rax, -0xb0(%rbp)
movq $0x0, -0xe8(%rbp)
movq $0x0, -0xf0(%rbp)
cmpq $0x2710, -0xf0(%rbp) # imm = 0x2710
jae 0x112bc3
movq $0x0, -0xf8(%rbp)
cmpq $0x7d0, -0xf8(%rbp) # imm = 0x7D0
jae 0x112baa
movq -0x30(%rbp), %rax
movq -0xf8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x108(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x50(%rbp), %rdi
movq -0x108(%rbp), %rsi
callq 0x112e20
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
addq -0xe8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xf8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf8(%rbp)
jmp 0x112b36
jmp 0x112bac
movq -0xf0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf0(%rbp)
jmp 0x112b1a
callq 0x4300
movq -0xb0(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
movq -0xe8(%rbp), %rdx
leaq 0x3fe37(%rip), %rsi     # 0x152a22
xorl %eax, %eax
callq 0x100210
movq -0x8(%rbp), %rdi
movq -0xb0(%rbp), %rax
movq -0xb8(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x2c264(%rip), %xmm1    # 0x13ee78
mulsd %xmm1, %xmm0
movsd 0x207a8(%rip), %xmm1    # 0x1333c8
divsd %xmm1, %xmm0
movsd 0x458ec(%rip), %xmm1    # 0x158518
divsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rdx
movq %rdx, %rcx
sarq $0x3f, %rcx
movsd 0x2c1d1(%rip), %xmm1    # 0x13ee18
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rcx, %rax
orq %rax, %rdx
leaq 0x45984(%rip), %rsi     # 0x1585e1
movb $0x0, %al
callq 0x100210
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x50(%rbp), %rdi
callq 0x1125a0
movq -0x120(%rbp), %rdi
movq %rax, %rdx
leaq 0x4596b(%rip), %rsi     # 0x1585f4
movb $0x0, %al
callq 0x100210
movq -0x8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x50(%rbp), %rdi
callq 0x112600
movq -0x118(%rbp), %rdi
movq %rax, %rdx
leaq 0x45950(%rip), %rsi     # 0x158605
movb $0x0, %al
callq 0x100210
movq -0x50(%rbp), %rdi
callq 0x112390
movq -0x30(%rbp), %rdi
callq 0x9d1c0
movq -0x8(%rbp), %rdi
movl $0x3d, %esi
movl $0x50, %edx
callq 0xffca0
movq -0x8(%rbp), %rdi
movl $0xa, %esi
callq 0xffba0
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax)