// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore.xo.c
// Function: bcore_indexer_selftest
void bcore_indexer_selftest( void )
{
    // bcore_indexer.h:113:1
    BLM_INIT_LEVEL(0);
    bcore_prsg_lcg_u3_00_s prsg;BLM_T_INIT_SPUSH(bcore_prsg_lcg_u3_00_s, &prsg);;
    
    sz_t n = 100;   // containers
    sz_t m = 1000;  // container size-range
    sz_t t = 10000; // test samples
    
    bcore_arr_s3_s arr;BLM_T_INIT_SPUSH(bcore_arr_s3_s, &arr);bcore_arr_s3_s_set_size(&(arr),n );
    {const bcore_arr_s3_s* __a=&(arr );if(__a)for(sz_t __i=0;__i<__a->size;__i++){s3_t* e=&(__a->data[__i]); { (*(e)) = bcore_prsg_lcg_u3_00_s_gen_f3(&(prsg),0.0, m ); }
    
    }}bcore_indexer_s indexer;BLM_T_INIT_SPUSH(bcore_indexer_s, &indexer);bcore_indexer_s_setup(&(indexer),&(arr ));
    
    s3_t sum = 0;
    {const bcore_arr_s3_s* __a=&(arr );if(__a)for(sz_t __i=0;__i<__a->size;__i++){s3_t* e=&(__a->data[__i]); { sum += (*(e)); }
    }}ASSERT( sum == indexer.size );
    
    for(sz_t i = 0; i < t; i++ )
    {
        s3_t c = bcore_prsg_lcg_u3_00_s_gen_f3(&(prsg),-indexer.size, 2 * indexer.size );
    
        bcore_indexer_io_s io0 = { 0 };
        s3_t sum = 0;
        {const bcore_arr_s3_s* __a=&(arr );if(__a)for(sz_t __i=0;__i<__a->size;__i++){const s3_t* e=&(__a->data[__i]);
        {
            if( sum + (*(e)) > c )
            {
                io0.i = __i;
                io0.o = c - sum;
                break;
            }
            sum += (*(e));
        }
    
        }}bcore_indexer_io_s io1;
        if( bcore_indexer_s_get_io(&(indexer),c,&( io1 )) )
        {
            if( io0.i != io1.i )
            {
                bcore_indexer_s_get_io(&(indexer),c,&( io1 ));
            }
            ASSERT( io0.i == io1.i );
            ASSERT( io0.o == io1.o );
        }
        else
        {
            ASSERT( c < 0 || c >= indexer.size );
        }
    }
    
    BLM_DOWN();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movabsq $0x1c140000000001cd, %r15 # imm = 0x1C140000000001CD
leaq 0xe298d(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0xa8(%rsp), %rbx
movq %rbx, 0x28(%rsp)
movq %rbx, %rdi
callq 0x717f5
andq $0x0, 0x10(%rbx)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2fe03
movabsq $-0x1804b258fae5f3f6, %rsi # imm = 0xE7FB4DA7051A0C0A
movq %rbx, %rdi
movq %r14, %rdx
callq 0x71998
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x5a9e5
movabsq $0x2cabd5fd9af9a7b7, %rsi # imm = 0x2CABD5FD9AF9A7B7
movq %rbx, %rdi
movq %r14, %rdx
callq 0x71998
pushq $0x64
popq %rsi
movq %r14, %rdi
callq 0x5ab8e
xorl %eax, %eax
movsd 0x7f24f(%rip), %xmm0    # 0xb4708
xorpd %xmm1, %xmm1
cmpq 0x40(%rsp), %rax
jae 0x35519
movq 0x38(%rsp), %rcx
movq 0x10(%rsp), %rdx
imulq %r15, %rdx
incq %rdx
movq %rdx, 0x10(%rsp)
movq %rdx, %xmm2
punpckldq 0x7f1c9(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x7f1d1(%rip), %xmm2    # 0xb46c0
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
mulsd 0x7f1ed(%rip), %xmm3    # 0xb46f0
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
cvttsd2si %xmm3, %rdx
movq %rdx, (%rcx,%rax,8)
incq %rax
jmp 0x354bd
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x3524b
leaq 0xa8(%rsp), %rdi
movabsq $0x3fe3e37538d925bc, %rsi # imm = 0x3FE3E37538D925BC
movq %rbx, %rdx
callq 0x71998
leaq 0x30(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x352c5
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
xorl %edx, %edx
xorl %esi, %esi
cmpq %rdx, %rcx
je 0x3556a
addq (%rax,%rdx,8), %rsi
incq %rdx
jmp 0x3555c
cmpq 0xa0(%rsp), %rsi
je 0x3559d
leaq 0x750cc(%rip), %rdi     # 0xaa647
leaq 0x7fab7(%rip), %rsi     # 0xb5039
leaq 0x7fac4(%rip), %rdx     # 0xb504d
leaq 0x7f1be(%rip), %rcx     # 0xb474e
movl $0xcba, %r8d            # imm = 0xCBA
xorl %eax, %eax
callq 0x5ffac
leaq 0x50(%rsp), %rbx
leaq 0x18(%rsp), %r14
xorl %r13d, %r13d
cmpq $0x2710, %r13           # imm = 0x2710
je 0x35723
movq 0xa0(%rsp), %rax
movq %rax, %rcx
negq %rcx
cvtsi2sd %rcx, %xmm0
addq %rax, %rax
cvtsi2sd %rax, %xmm1
movq 0x10(%rsp), %rax
imulq %r15, %rax
incq %rax
movq %rax, 0x10(%rsp)
subsd %xmm0, %xmm1
movq %rax, %xmm2
punpckldq 0x7f0bc(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x7f0c4(%rip), %xmm2    # 0xb46c0
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
mulsd 0x7f0e0(%rip), %xmm3    # 0xb46f0
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
cvttsd2si %xmm3, %r12
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
xorl %edx, %edx
xorl %ebp, %ebp
cmpq %rbp, %rcx
je 0x35644
movq (%rax,%rbp,8), %rsi
addq %rdx, %rsi
cmpq %r12, %rsi
jg 0x3564b
incq %rbp
movq %rsi, %rdx
jmp 0x3562b
xorl %ebp, %ebp
xorl %r15d, %r15d
jmp 0x35651
movq %r12, %r15
subq %rdx, %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x353bb
testb %al, %al
je 0x356d9
movq %rbp, %rax
cmpq 0x18(%rsp), %rbp
je 0x35680
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x353bb
movq 0x18(%rsp), %rax
cmpq %rax, %rbp
je 0x356ae
leaq 0x74fbb(%rip), %rdi     # 0xaa647
leaq 0x7f9d1(%rip), %rsi     # 0xb5064
leaq 0x7f9b3(%rip), %rdx     # 0xb504d
leaq 0x7f0ad(%rip), %rcx     # 0xb474e
movl $0xcd4, %r8d            # imm = 0xCD4
xorl %eax, %eax
callq 0x5ffac
cmpq 0x20(%rsp), %r15
je 0x35711
leaq 0x74f8b(%rip), %rdi     # 0xaa647
leaq 0x7f9b0(%rip), %rsi     # 0xb5073
leaq 0x7f983(%rip), %rdx     # 0xb504d
leaq 0x7f07d(%rip), %rcx     # 0xb474e
movl $0xcd5, %r8d            # imm = 0xCD5
jmp 0x3570a
testq %r12, %r12
js 0x35711
cmpq %r12, 0xa0(%rsp)
jle 0x35711
leaq 0x74f58(%rip), %rdi     # 0xaa647
leaq 0x7f98c(%rip), %rsi     # 0xb5082
leaq 0x7f950(%rip), %rdx     # 0xb504d
leaq 0x7f04a(%rip), %rcx     # 0xb474e
movl $0xcd9, %r8d            # imm = 0xCD9
xorl %eax, %eax
callq 0x5ffac
incq %r13
movabsq $0x1c140000000001cd, %r15 # imm = 0x1C140000000001CD
jmp 0x355aa
leaq 0x28(%rsp), %rdi
callq 0x71b48
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq