// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore_arr.c
// Function: bcore_arr_st_selftest
st_s* bcore_arr_st_selftest( void )
{
    st_s* log = st_s_createf( "== bcore_arr_st_selftest " );
    st_s_push_char_n( log, '=', 80 - log->size );
    st_s_push_char( log, '\n' );

    bcore_arr_st_s* st_arr1 = bcore_arr_st_s_create();
    bcore_arr_st_s* st_arr2 = bcore_arr_st_s_create();
    uz_t size = 100000;
    {
        u2_t rval = 1;
        clock_t time = clock();
        for( uz_t i = 0; i < size; i++ )
        {
            rval = bcore_xsg_u2( rval );
            bcore_arr_st_s_push_st_d( st_arr1, st_s_createf( "%u", rval ) );
        }
        time = clock() - time;
        st_s_push_fa( log, "#p28.{bcore_arr_st_s_push_st_d } #<uz_t>ns\n", ( uz_t ) ( ( 1E9 * ( f3_t )time/CLOCKS_PER_SEC ) / size ) );
    }

    {
        u2_t rval = 1;
        clock_t time = clock();
        for( uz_t i = 0; i < size; i++ )
        {
            rval = bcore_xsg_u2( rval );
            bcore_array_a_push( (bcore_array*)st_arr2, sr_asm( st_s_createf( "%u", rval ) ) );
        }
        time = clock() - time;
        st_s_push_fa( log, "#p28.{bcore_array_a_push } #<uz_t>ns\n", ( uz_t ) ( ( 1E9 * ( f3_t )time/CLOCKS_PER_SEC ) / size ) );
    }

    {
        clock_t time = clock();
        bcore_arr_st_s_sort( st_arr1, 1 );
        time = clock() - time;
        st_s_push_fa( log, "#p28.{bcore_arr_st_s_sort } #<uz_t>ns\n", ( uz_t ) ( ( 1E9 * ( f3_t )time/CLOCKS_PER_SEC ) / size ) );
    }

    {
        clock_t time = clock();
        bcore_array_a_sort( (bcore_array*)st_arr2, 0, -1, 1 );
        time = clock() - time;
        st_s_push_fa( log, "#p28.{bcore_array_a_sort } #<uz_t>ns\n", ( uz_t ) ( ( 1E9 * ( f3_t )time/CLOCKS_PER_SEC ) / size ) );
    }

    bcore_arr_uz_s* permutation = bcore_arr_uz_s_create_random_permutation( bcore_xsg2_u2, 1, size );

    {
        clock_t time = clock();
        bcore_arr_st_s_reorder( st_arr1, permutation );
        time = clock() - time;
        st_s_push_fa( log, "#p28.{bcore_arr_st_s_reorder } #<uz_t>ns\n", ( uz_t ) ( ( 1E9 * ( f3_t )time/CLOCKS_PER_SEC ) / size ) );
    }

    {
        clock_t time = clock();
        bcore_array_a_reorder( (bcore_array*)st_arr2, permutation );
        time = clock() - time;
        st_s_push_fa( log, "#p28.{bcore_array_a_reorder } #<uz_t>ns\n", ( uz_t ) ( ( 1E9 * ( f3_t )time/CLOCKS_PER_SEC ) / size ) );
    }

    ASSERT( bcore_compare_aware( st_arr1, st_arr2 ) == 0 );

//    bcore_txt_ml_to_stdout( sr_awc( st_arr1 ) );

    bcore_arr_uz_s_discard( permutation );
    bcore_arr_st_s_discard( st_arr1 );
    bcore_arr_st_s_discard( st_arr2 );

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

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0x62775(%rip), %rdi     # 0xc05c4
xorl %eax, %eax
callq 0x8ebc4
movq %rax, %rbx
pushq $0x50
popq %rdx
subq 0x10(%rax), %rdx
pushq $0x3d
popq %rsi
movq %rax, %rdi
callq 0x8f175
pushq $0xa
popq %rsi
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
callq 0x8f0ee
callq 0x5c336
movq %rax, %r14
callq 0x5c336
movq %rax, %r15
pushq $0x1
popq %rbp
movl $0x186a0, %ebx          # imm = 0x186A0
callq 0xd340
movq %rax, %r12
leaq 0x63538(%rip), %r13     # 0xc13da
subq $0x1, %rbx
jb 0x5ded6
movl %ebp, %eax
shrl $0x7, %eax
xorl %ebp, %eax
movl %eax, %ecx
shll $0x19, %ecx
xorl %eax, %ecx
movl %ecx, %ebp
shrl $0xc, %ebp
xorl %ecx, %ebp
movq %r13, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x8ebc4
movq %r14, %rdi
movq %rax, %rsi
callq 0x5c529
jmp 0x5dea2
callq 0xd340
subq %r12, %rax
cvtsi2sd %rax, %xmm0
mulsd 0x62565(%rip), %xmm0    # 0xc0450
divsd 0x4c17d(%rip), %xmm0    # 0xaa070
divsd 0x6255d(%rip), %xmm0    # 0xc0458
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x567d1(%rip), %xmm0    # 0xb46e0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0x626bd(%rip), %rsi     # 0xc05de
movq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0x8f4ef
pushq $0x1
popq %rbp
movl $0x186a0, %ebx          # imm = 0x186A0
callq 0xd340
movq %rax, 0x28(%rsp)
leaq 0x63494(%rip), %r13     # 0xc13da
subq $0x1, %rbx
jb 0x5dfbf
movl %ebp, %eax
shrl $0x7, %eax
xorl %ebp, %eax
movl %eax, %ecx
shll $0x19, %ecx
xorl %eax, %ecx
movl %ecx, %ebp
shrl $0xc, %ebp
xorl %ecx, %ebp
movq %r13, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x8ebc4
movq %rax, %r12
testq %rax, %rax
je 0x5df80
movq (%r12), %rdi
callq 0x8cd25
jmp 0x5df82
xorl %eax, %eax
movq %r12, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq $0x2, 0x40(%rsp)
movq (%r15), %rdi
callq 0x5dd84
movq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movupd 0x30(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %rax, %rdi
movq %r15, %rsi
callq 0x7c34a
jmp 0x5df46
callq 0xd340
subq 0x28(%rsp), %rax
cvtsi2sd %rax, %xmm0
mulsd 0x6247a(%rip), %xmm0    # 0xc0450
divsd 0x4c092(%rip), %xmm0    # 0xaa070
divsd 0x62472(%rip), %xmm0    # 0xc0458
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x566e6(%rip), %xmm0    # 0xb46e0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0x625fe(%rip), %rsi     # 0xc060a
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8f4ef
callq 0xd340
movq %rax, %r12
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x5c676
callq 0xd340
subq %r12, %rax
cvtsi2sd %rax, %xmm0
mulsd 0x6240b(%rip), %xmm0    # 0xc0450
divsd 0x4c023(%rip), %xmm0    # 0xaa070
divsd 0x62403(%rip), %xmm0    # 0xc0458
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x56677(%rip), %xmm0    # 0xb46e0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0x625b5(%rip), %rsi     # 0xc0630
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8f4ef
callq 0xd340
movq %rax, %r12
pushq $-0x1
popq %rsi
movq %r15, %rdi
movl %ebp, %edx
callq 0x5d560
callq 0xd340
subq %r12, %rax
cvtsi2sd %rax, %xmm0
mulsd 0x623a1(%rip), %xmm0    # 0xc0450
divsd 0x4bfb9(%rip), %xmm0    # 0xaa070
divsd 0x62399(%rip), %xmm0    # 0xc0458
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x5660d(%rip), %xmm0    # 0xb46e0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0x62466(%rip), %rsi     # 0xc054b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8f4ef
leaq -0x2d2(%rip), %rdi      # 0x5de24
movl $0x186a0, %edx          # imm = 0x186A0
movl %ebp, %esi
callq 0x58e1c
movq %rax, %r12
callq 0xd340
movq %rax, %r13
movq %r14, %rdi
movq %r12, %rsi
callq 0x5c790
callq 0xd340
subq %r13, %rax
cvtsi2sd %rax, %xmm0
mulsd 0x62323(%rip), %xmm0    # 0xc0450
divsd 0x4bf3b(%rip), %xmm0    # 0xaa070
divsd 0x6231b(%rip), %xmm0    # 0xc0458
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x5658f(%rip), %xmm0    # 0xb46e0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0x624f4(%rip), %rsi     # 0xc0657
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8f4ef
callq 0xd340
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x5d59b
callq 0xd340
subq %r13, %rax
cvtsi2sd %rax, %xmm0
mulsd 0x622bb(%rip), %xmm0    # 0xc0450
divsd 0x4bed3(%rip), %xmm0    # 0xaa070
divsd 0x622b3(%rip), %xmm0    # 0xc0458
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x56527(%rip), %xmm0    # 0xb46e0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
leaq 0x623d0(%rip), %rsi     # 0xc059b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8f4ef
movq %r14, %rdi
movq %r15, %rsi
callq 0x81306
testl %eax, %eax
je 0x5e20d
leaq 0x4c45c(%rip), %rdi     # 0xaa647
leaq 0x6248f(%rip), %rsi     # 0xc0681
leaq 0x624b5(%rip), %rdx     # 0xc06ae
leaq 0x62318(%rip), %rcx     # 0xc0518
movl $0xe01, %r8d            # imm = 0xE01
xorl %eax, %eax
callq 0x5ffac
movq %r12, %rdi
callq 0x58913
movq %r14, %rdi
callq 0x5c351
movq %r15, %rdi
callq 0x5c351
pushq $0x3d
popq %rsi
pushq $0x50
popq %rdx
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x8f175
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x8f0ee
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq