// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore_spect_array.c
// Function: spect_array_selftest
static st_s* spect_array_selftest( void )
{
    bcore_flect_define_self_d( bcore_self_s_build_parse_sc( "string_array = { aware_t _; st_s [] string_arr; }", 0, 0 ) );
    vd_t arr = bcore_inst_t_create( typeof( "string_array" ) );
    const bcore_array_s* arr_p = bcore_array_s_get_aware( arr );

    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_static_dyn_array      = { aware_t _; st_s     []   arr; }" ) ) );
    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_static_link_dyn_array = { aware_t _; st_s =>  []   arr; }" ) ) );
    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_typed_dyn_array       = { aware_t _; typed    []   arr; }" ) ) );
    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_typed_link_dyn_array  = { aware_t _; typed => []   arr; }" ) ) );
    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_aware_link_dyn_array  = { aware_t _; aware => []   arr; }" ) ) );
    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_static_fix_array      = { aware_t _; st_s     [10] arr; }" ) ) );
    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_static_link_fix_array = { aware_t _; st_s =>  [10] arr; }" ) ) );
    bcore_array_p_push( arr_p, arr, sr_asm( st_s_createf( "string_aware_link_fix_array  = { aware_t _; aware => [10] arr; }" ) ) );

    for( uz_t i = 0; i < get_size( arr_p, arr ); i++ )
    {
        const st_s* code = arr_p->get( arr_p, arr, i ).o;
        bcore_self_s* self = bcore_self_s_build_parse_sc( code->sc, 0, 0 );
        ASSERT( !bcore_spect_trait_supported( typeof( "bcore_array" ), self->type ) );
        tp_t type = bcore_flect_type_self_c( self );
        ASSERT( bcore_spect_trait_supported( typeof( "bcore_array" ), type ) );
        test_string_array( nameof( type ) );
        bcore_self_s_discard( self );
    }

    // testing predefined low-level array (all bcore_array spect functionality must work, too)
    test_string_array( "bcore_arr_st_s" );

    bcore_inst_a_discard( arr );

    // some non-arrays
    ASSERT( !bcore_spect_trait_supported( typeof( "bcore_array" ), typeof( "st_s" ) ) );
    ASSERT( !bcore_spect_trait_supported( typeof( "bcore_array" ), typeof( "f3_t" ) ) );
    ASSERT( !bcore_spect_trait_supported( typeof( "bcore_array" ), typeof( "bcore_txt_ml_interpreter_s" ) ) );

    // sorting a permutation
    {
        bcore_arr_uz_s* arr = bcore_arr_uz_s_create_random_permutation( bcore_xsg_u2, 2, 1000 );
        bcore_array_a_sort( (bcore_array*)arr, 0, -1, 1 );
        for( uz_t i = 0; i < arr->size; i++ ) ASSERT( arr->data[ i ] == i );
        bcore_arr_uz_s_discard( arr );
    }
    {
        bcore_arr_uz_s* arr = bcore_arr_uz_s_create_random_permutation( bcore_xsg_u2, 2, 1000 );
        bcore_arr_uz_s_sort( arr, 1 );
        for( uz_t i = 0; i < arr->size; i++ ) ASSERT( arr->data[ i ] == i );
        bcore_arr_uz_s_discard( arr );
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
leaq 0x77c4d(%rip), %rdi     # 0x15361f
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0xa67c0
movq %rax, %rdi
callq 0xa7620
leaq 0x78093(%rip), %rdi     # 0x153a80
callq 0xdb480
movq %rax, %rdi
callq 0xddaa0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xddae0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq 0x77c29(%rip), %rdi     # 0x153651
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0xddb00
movq -0x1a8(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
leaq -0x28(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq -0x10(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
leaq 0x77c0a(%rip), %rdi     # 0x153692
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0xddb00
movq -0x198(%rbp), %rdi
movq -0x190(%rbp), %rsi
leaq -0x40(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq -0x10(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq 0x77beb(%rip), %rdi     # 0x1536d3
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0xddb00
movq -0x188(%rbp), %rdi
movq -0x180(%rbp), %rsi
leaq -0x58(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq -0x10(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq 0x77bcc(%rip), %rdi     # 0x153714
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
callq 0xddb00
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rsi
leaq -0x70(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq -0x10(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq 0x77bad(%rip), %rdi     # 0x153755
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0xddb00
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
leaq -0x88(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq -0x10(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq 0x77b88(%rip), %rdi     # 0x153796
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0xddb00
movq -0x158(%rbp), %rdi
movq -0x150(%rbp), %rsi
leaq -0xa0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq -0x10(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq 0x77b63(%rip), %rdi     # 0x1537d7
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0xddb00
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
leaq -0xb8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x130(%rbp)
leaq 0x77b3e(%rip), %rdi     # 0x153818
movb $0x0, %al
callq 0xff350
movq %rax, %rsi
leaq -0xd0(%rbp), %rdi
callq 0xddb00
movq -0x138(%rbp), %rdi
movq -0x130(%rbp), %rsi
leaq -0xd0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7290
movq $0x0, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xd5cd0
movq %rax, %rcx
movq -0x1b0(%rbp), %rax
cmpq %rcx, %rax
jae 0xdbe88
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0xd8(%rbp), %rcx
leaq -0xf8(%rbp), %rdi
callq *%rax
movq -0xf8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0xa67c0
movq %rax, -0x100(%rbp)
leaq 0x75504(%rip), %rdi     # 0x1512b3
callq 0xdb480
movq %rax, %rdi
movq -0x100(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xd13b0
testb $0x1, %al
jne 0xdbdcd
jmp 0xdbdf6
leaq 0x57bcb(%rip), %rdi     # 0x13399f
leaq 0x77a7e(%rip), %rsi     # 0x153859
leaq 0x77abb(%rip), %rdx     # 0x15389d
leaq 0x7710f(%rip), %rcx     # 0x152ef8
movl $0x998, %r8d            # imm = 0x998
movb $0x0, %al
callq 0x9cea0
movq -0x100(%rbp), %rdi
callq 0xa79e0
movq %rax, -0x108(%rbp)
leaq 0x754a3(%rip), %rdi     # 0x1512b3
callq 0xdb480
movq %rax, %rdi
movq -0x108(%rbp), %rsi
callq 0xd13b0
testb $0x1, %al
jne 0xdbe51
leaq 0x57b70(%rip), %rdi     # 0x13399f
leaq 0x77a7c(%rip), %rsi     # 0x1538b2
leaq 0x77a60(%rip), %rdx     # 0x15389d
leaq 0x770b4(%rip), %rcx     # 0x152ef8
movl $0x99a, %r8d            # imm = 0x99A
movb $0x0, %al
callq 0x9cea0
movq -0x108(%rbp), %rdi
callq 0xdef80
movq %rax, %rdi
callq 0xddb70
movq -0x100(%rbp), %rdi
callq 0xa54c0
movq -0xd8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd8(%rbp)
jmp 0xdbd2e
leaq 0x70ccd(%rip), %rdi     # 0x14cb5c
callq 0xddb70
movq -0x8(%rbp), %rdi
callq 0xd50a0
leaq 0x7540f(%rip), %rdi     # 0x1512b3
callq 0xdb480
movq %rax, -0x1b8(%rbp)
leaq 0x7ad0b(%rip), %rdi     # 0x156bc2
callq 0xdb480
movq -0x1b8(%rbp), %rdi
movq %rax, %rsi
callq 0xd13b0
testb $0x1, %al
jne 0xdbed1
jmp 0xdbefa
leaq 0x57ac7(%rip), %rdi     # 0x13399f
leaq 0x77a10(%rip), %rsi     # 0x1538ef
leaq 0x779b7(%rip), %rdx     # 0x15389d
leaq 0x7700b(%rip), %rcx     # 0x152ef8
movl $0x9a5, %r8d            # imm = 0x9A5
movb $0x0, %al
callq 0x9cea0
leaq 0x753b2(%rip), %rdi     # 0x1512b3
callq 0xdb480
movq %rax, -0x1c0(%rbp)
leaq 0x731b7(%rip), %rdi     # 0x14f0cb
callq 0xdb480
movq -0x1c0(%rbp), %rdi
movq %rax, %rsi
callq 0xd13b0
testb $0x1, %al
jne 0xdbf2e
jmp 0xdbf57
leaq 0x57a6a(%rip), %rdi     # 0x13399f
leaq 0x779fd(%rip), %rsi     # 0x153939
leaq 0x7795a(%rip), %rdx     # 0x15389d
leaq 0x76fae(%rip), %rcx     # 0x152ef8
movl $0x9a6, %r8d            # imm = 0x9A6
movb $0x0, %al
callq 0x9cea0
leaq 0x75355(%rip), %rdi     # 0x1512b3
callq 0xdb480
movq %rax, -0x1c8(%rbp)
leaq 0x75580(%rip), %rdi     # 0x1514f1
callq 0xdb480
movq -0x1c8(%rbp), %rdi
movq %rax, %rsi
callq 0xd13b0
testb $0x1, %al
jne 0xdbf8b
jmp 0xdbfb4
leaq 0x57a0d(%rip), %rdi     # 0x13399f
leaq 0x779ea(%rip), %rsi     # 0x153983
leaq 0x778fd(%rip), %rdx     # 0x15389d
leaq 0x76f51(%rip), %rcx     # 0x152ef8
movl $0x9a7, %r8d            # imm = 0x9A7
movb $0x0, %al
callq 0x9cea0
leaq 0x2fe5(%rip), %rdi      # 0xdefa0
movl $0x2, %esi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x8e3e0
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movq $-0x1, %rdx
movl $0x1, %ecx
callq 0xdefd0
movq $0x0, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq -0x110(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0xdc06a
movq -0x110(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x118(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x118(%rbp), %rax
je 0xdc054
leaq 0x5796d(%rip), %rdi     # 0x13399f
leaq 0x779aa(%rip), %rsi     # 0x1539e3
leaq 0x7785d(%rip), %rdx     # 0x15389d
leaq 0x76eb1(%rip), %rcx     # 0x152ef8
movl $0x9ad, %r8d            # imm = 0x9AD
movb $0x0, %al
callq 0x9cea0
jmp 0xdc056
movq -0x118(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x118(%rbp)
jmp 0xdbff8
movq -0x110(%rbp), %rdi
callq 0x8d8d0
leaq 0x2f23(%rip), %rdi      # 0xdefa0
movl $0x2, %esi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x8e3e0
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rdi
movl $0x1, %esi
callq 0x8e090
movq $0x0, -0x128(%rbp)
movq -0x128(%rbp), %rax
movq -0x120(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0xdc121
movq -0x120(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x128(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x128(%rbp), %rax
je 0xdc10b
leaq 0x578b6(%rip), %rdi     # 0x13399f
leaq 0x778f3(%rip), %rsi     # 0x1539e3
leaq 0x777a6(%rip), %rdx     # 0x15389d
leaq 0x76dfa(%rip), %rcx     # 0x152ef8
movl $0x9b3, %r8d            # imm = 0x9B3
movb $0x0, %al
callq 0x9cea0
jmp 0xdc10d
movq -0x128(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x128(%rbp)
jmp 0xdc0af
movq -0x120(%rbp), %rdi
callq 0x8d8d0
xorl %eax, %eax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopl (%rax,%rax)