// File: /workspace/github_c_makefile_star2_O3/johsteffens[P]beth/lib/bcore/bcore.xo.c
// Function: bcore_indexer_s_setup
BCORE_DEFINE_OBJECT_INST_P_NASC_END( bcore_indexer_s )

bcore_indexer_s* bcore_indexer_s_setup( bcore_indexer_s* o, const bcore_arr_s3_s* size_arr )
{
    // bcore_indexer.h:60:5
    
    o->size = 0;
    x_array_set_size(((x_array*)(&(o->cs_arr))),size_arr->size );
    {const bcore_indexer_cs_arr_s* __a=&(o->cs_arr );if(__a)for(sz_t __i=0;__i<__a->size;__i++){bcore_indexer_cs_s* e=&(__a->data[__i]);
    {
        e->c = o->size;
        e->s = size_arr->data[ __i ];
        o->size += e->s;
    };}}
    
    sz_t io_size = 1;
    while( io_size < size_arr->size ) io_size <<= 1;
    o->mask_bits = 0;
    while( ( ( o->size - 1 ) >> o->mask_bits ) >= io_size ) o->mask_bits++;
    
    bcore_indexer_io_s io = { 0 };
    x_array_set_size(((x_array*)(x_array_clear(((x_array*)(&(o->io_arr)))))),io_size );
    {const bcore_indexer_io_arr_s* __a=&(o->io_arr );if(__a)for(sz_t __i=0;__i<__a->size;__i++){bcore_indexer_io_s* e=&(__a->data[__i]);
    {
        sz_t c = ((s3_t)(__i)) << o->mask_bits;
        if( c >= o->size ) break;
        io.o = c - o->cs_arr.data[ io.i ].c;
        while( io.o >= o->cs_arr.data[ io.i ].s )
        {
            io.o -= o->cs_arr.data[ io.i ].s;
            io.i++;
        }
        (*(e)) = io;
    }
    
    }}return  o;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq $0x0, 0x50(%rdi)
leaq 0x28(%rdi), %r12
movq 0x10(%rsi), %r13
movq 0x28(%rdi), %rbp
leaq 0x12d31d(%rip), %rdx    # 0x19be20
movl (%rdx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %rbp, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %rbp, %rdx
je 0x6eb58
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbp, %rdx
je 0x6eb58
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbp, %rdx
je 0x6eb58
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbp, %rdx
jne 0x6eb61
movq (%rax,%rcx), %r14
testq %r14, %r14
jne 0x6eb88
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %rbp, %rsi
callq 0xe9bc5
movq %rax, %r14
leaq 0x12d2a3(%rip), %rdi    # 0x19be20
movq %rbp, %rsi
movq %rax, %rdx
callq 0x115fac
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xec548
cmpq $0x0, 0x38(%rbx)
je 0x6ebd1
movq 0x50(%rbx), %rax
movl $0x8, %ecx
xorl %edx, %edx
movq 0x30(%rbx), %rsi
movq %rax, -0x8(%rsi,%rcx)
movq 0x8(%r15), %rdi
movq (%rdi,%rdx,8), %rdi
movq %rdi, (%rsi,%rcx)
addq %rdi, %rax
movq %rax, 0x50(%rbx)
incq %rdx
addq $0x10, %rcx
cmpq 0x38(%rbx), %rdx
jb 0x6eba8
movq 0x10(%r15), %rax
movl $0x1, %ecx
movq %rcx, %r15
addq %rcx, %rcx
cmpq %rax, %r15
jb 0x6ebda
movq 0x50(%rbx), %rax
decq %rax
movb $-0x1, %cl
leaq 0x12d22b(%rip), %r14    # 0x19be20
incb %cl
movq %rax, %rdx
sarq %cl, %rdx
cmpq %r15, %rdx
jge 0x6ebf5
movb %cl, 0x48(%rbx)
leaq 0x8(%rbx), %r12
movq 0x8(%rbx), %r13
movl (%r14), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%r14,%rax,8), %rcx
movq 0x18(%r14,%rax,8), %rdx
andq %r13, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r13, %rdx
je 0x6ec63
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0x6ec63
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0x6ec63
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0x6ec6c
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0x6ec93
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %r13, %rsi
callq 0xe9bc5
movq %rax, %rbp
leaq 0x12d198(%rip), %rdi    # 0x19be20
movq %r13, %rsi
movq %rax, %rdx
callq 0x115fac
movq %rbp, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xebeb6
movq (%r12), %r13
movl (%r14), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%r14,%rax,8), %rcx
movq 0x18(%r14,%rax,8), %rdx
andq %r13, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r13, %rdx
je 0x6ecfa
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0x6ecfa
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0x6ecfa
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0x6ed03
movq (%rax,%rcx), %r14
testq %r14, %r14
jne 0x6ed2a
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %r13, %rsi
callq 0xe9bc5
movq %rax, %r14
leaq 0x12d101(%rip), %rdi    # 0x19be20
movq %r13, %rsi
movq %rax, %rdx
callq 0x115fac
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xec548
cmpq $0x0, 0x18(%rbx)
je 0x6eda3
movsbq 0x48(%rbx), %rax
movl %eax, %ecx
xorl %eax, %eax
xorl %edx, %edx
movq %rax, %rsi
shlq %cl, %rsi
cmpq 0x50(%rbx), %rsi
jge 0x6eda3
movq 0x30(%rbx), %r8
movq %rdx, %r9
shlq $0x4, %r9
subq (%r8,%r9), %rsi
movq 0x8(%r8,%r9), %rdi
cmpq %rdi, %rsi
jl 0x6ed88
addq %r9, %r8
addq $0x18, %r8
subq %rdi, %rsi
incq %rdx
movq (%r8), %rdi
addq $0x10, %r8
cmpq %rdi, %rsi
jge 0x6ed76
movq %rax, %rdi
shlq $0x4, %rdi
addq 0x10(%rbx), %rdi
movq %rdx, (%rdi)
movq %rsi, 0x8(%rdi)
incq %rax
cmpq 0x18(%rbx), %rax
jb 0x6ed4a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq