// File: /workspace/github_c_makefile_star2_O3/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 0x12cf7c(%rip), %rax    # 0x19bdd0
movq (%rax), %rsi
leaq 0xa8(%rsp), %rbx
movq %rbx, 0x28(%rsp)
movq %rbx, %rdi
callq 0xd6675
movq $0x0, 0x10(%rbx)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x59077
movabsq $-0x1804b258fae5f3f6, %rsi # imm = 0xE7FB4DA7051A0C0A
movq %rbx, %rdi
movq %r14, %rdx
callq 0xd68d9
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0xb7e91
movabsq $0x2cabd5fd9af9a7b7, %rsi # imm = 0x2CABD5FD9AF9A7B7
movq %rbx, %rdi
movq %r14, %rdx
callq 0xd68d9
movl $0x64, %esi
movq %r14, %rdi
callq 0xb8087
cmpq $0x0, 0x10(%r14)
je 0x6ef40
xorl %eax, %eax
movq 0xc840a(%rip), %xmm0    # 0x1372e0
movapd 0xc8412(%rip), %xmm1    # 0x1372f0
movsd 0xc83a2(%rip), %xmm2    # 0x137288
movsd 0xc83b2(%rip), %xmm3    # 0x1372a0
xorpd %xmm4, %xmm4
movq 0x38(%rsp), %rcx
movq 0x10(%rsp), %rdx
imulq %r15, %rdx
incq %rdx
movq %rdx, 0x10(%rsp)
movq %rdx, %xmm5
punpckldq %xmm0, %xmm5    # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
subpd %xmm1, %xmm5
movapd %xmm5, %xmm6
unpckhpd %xmm5, %xmm6            # xmm6 = xmm6[1],xmm5[1]
addsd %xmm5, %xmm6
mulsd %xmm2, %xmm6
mulsd %xmm3, %xmm6
addsd %xmm4, %xmm6
cvttsd2si %xmm6, %rdx
movq %rdx, (%rcx,%rax,8)
incq %rax
cmpq 0x40(%rsp), %rax
jb 0x6eef2
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x6e67d
leaq 0xa8(%rsp), %rdi
movabsq $0x3fe3e37538d925bc, %rsi # imm = 0x3FE3E37538D925BC
movq %rbx, %rdx
callq 0xd68d9
leaq 0x30(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6ead7
movq 0x10(%r14), %rcx
testq %rcx, %rcx
je 0x6ef97
movq 0x38(%rsp), %rdx
xorl %eax, %eax
xorl %esi, %esi
addq (%rdx,%rsi,8), %rax
incq %rsi
cmpq %rsi, %rcx
jne 0x6ef89
jmp 0x6ef99
xorl %eax, %eax
cmpq 0xa0(%rsp), %rax
je 0x6efcc
leaq 0xbe69d(%rip), %rdi     # 0x12d647
leaq 0xc8c68(%rip), %rsi     # 0x137c19
leaq 0xc8c75(%rip), %rdx     # 0x137c2d
leaq 0xc836f(%rip), %rcx     # 0x13732e
movl $0xcba, %r8d            # imm = 0xCBA
xorl %eax, %eax
callq 0xbe4ef
leaq 0x50(%rsp), %rbx
leaq 0x18(%rsp), %r14
xorl %r13d, %r13d
movq 0xa0(%rsp), %rax
movq %rax, %rcx
negq %rcx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
addq %rax, %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movq 0x10(%rsp), %rax
imulq %r15, %rax
incq %rax
movq %rax, 0x10(%rsp)
subsd %xmm0, %xmm1
movq %rax, %xmm2
punpckldq 0xc82c4(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0xc82cc(%rip), %xmm2    # 0x1372f0
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
mulsd 0xc8250(%rip), %xmm3    # 0x137288
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
cvttsd2si %xmm3, %r12
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x6f06f
movq 0x38(%rsp), %rcx
xorl %ebp, %ebp
xorl %edx, %edx
movq (%rcx,%rbp,8), %rsi
addq %rdx, %rsi
cmpq %r12, %rsi
jg 0x6f076
incq %rbp
movq %rsi, %rdx
cmpq %rbp, %rax
jne 0x6f058
xorl %ebp, %ebp
xorl %r15d, %r15d
jmp 0x6f07c
movq %r12, %r15
subq %rdx, %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x6edb5
testb %al, %al
je 0x6f104
movq %rbp, %rax
cmpq 0x18(%rsp), %rbp
je 0x6f0ab
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x6edb5
movq 0x18(%rsp), %rax
cmpq %rax, %rbp
je 0x6f0d9
leaq 0xbe590(%rip), %rdi     # 0x12d647
leaq 0xc8b86(%rip), %rsi     # 0x137c44
leaq 0xc8b68(%rip), %rdx     # 0x137c2d
leaq 0xc8262(%rip), %rcx     # 0x13732e
movl $0xcd4, %r8d            # imm = 0xCD4
xorl %eax, %eax
callq 0xbe4ef
cmpq 0x20(%rsp), %r15
je 0x6f13c
leaq 0xbe560(%rip), %rdi     # 0x12d647
leaq 0xc8b65(%rip), %rsi     # 0x137c53
leaq 0xc8b38(%rip), %rdx     # 0x137c2d
leaq 0xc8232(%rip), %rcx     # 0x13732e
movl $0xcd5, %r8d            # imm = 0xCD5
jmp 0x6f135
testq %r12, %r12
js 0x6f13c
cmpq %r12, 0xa0(%rsp)
jle 0x6f13c
leaq 0xbe52d(%rip), %rdi     # 0x12d647
leaq 0xc8b41(%rip), %rsi     # 0x137c62
leaq 0xc8b05(%rip), %rdx     # 0x137c2d
leaq 0xc81ff(%rip), %rcx     # 0x13732e
movl $0xcd9, %r8d            # imm = 0xCD9
xorl %eax, %eax
callq 0xbe4ef
incq %r13
cmpq $0x2710, %r13           # imm = 0x2710
movabsq $0x1c140000000001cd, %r15 # imm = 0x1C140000000001CD
jne 0x6efd9
leaq 0x28(%rsp), %rdi
callq 0xd6d0d
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq