// File: UCBASiCS[P]SPRIGHT/src/config.cpp
// Function: Config::setBinOffsetsAndBinsSum()
void Config::setBinOffsetsAndBinsSum()
{
    if (bins.size() == 0) {
        bins.clear();
        int floorThird = (int) (signalLogLength/3);
        bins.push_back(pow(2,floorThird)-1);
        if (signalLogLength % 3 == 0) {
            bins.push_back(pow(2,2*floorThird)-pow(2,floorThird));
            bins.push_back(pow(2,3*floorThird)-pow(2,2*floorThird));
        }
        if (signalLogLength % 3 == 1) {
            bins.push_back(pow(2,2*floorThird)-pow(2,floorThird));
            bins.push_back(pow(2,3*floorThird+1)-pow(2,2*floorThird));
        }
        if (signalLogLength % 3 == 2) {
            bins.push_back(pow(2,2*floorThird+1)-pow(2,floorThird));
            bins.push_back(pow(2,3*floorThird+2)-pow(2,2*floorThird+1));    
        }
    }


    binsSum = 0;
    for (unsigned int stage=0; stage<bins.size(); stage++)
    {
        binOffsets.push_back(binsSum);
        binsSum += pow(2,numOnes(bins[stage]));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
addq $0x28, %rdi
callq 0xa5e0
cmpq $0x0, %rax
jne 0xe68f
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
callq 0xf930
movq -0x38(%rbp), %rax
movl 0xb0(%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, -0xc(%rbp)
addq $0x28, %rax
movq %rax, -0x40(%rbp)
movl -0xc(%rbp), %esi
movl $0x2, %edi
callq 0xa240
movq -0x40(%rbp), %rdi
movsd 0x11c9d(%rip), %xmm1    # 0x200d0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
leaq -0x10(%rbp), %rsi
callq 0xfb50
movq -0x38(%rbp), %rax
movl 0xb0(%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xe4fd
movq -0x38(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x60(%rbp)
movl -0xc(%rbp), %esi
shll %esi
movl $0x2, %edi
callq 0xa240
movsd %xmm0, -0x58(%rbp)
movl -0xc(%rbp), %esi
movl $0x2, %edi
callq 0xa240
movq -0x60(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
leaq -0x14(%rbp), %rsi
callq 0xfb50
movq -0x38(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x50(%rbp)
imull $0x3, -0xc(%rbp), %esi
movl $0x2, %edi
callq 0xa240
movsd %xmm0, -0x48(%rbp)
movl -0xc(%rbp), %esi
shll %esi
movl $0x2, %edi
callq 0xa240
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x18(%rbp)
leaq -0x18(%rbp), %rsi
callq 0xfb50
movq -0x38(%rbp), %rax
movl 0xb0(%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0xe5b6
movq -0x38(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x80(%rbp)
movl -0xc(%rbp), %esi
shll %esi
movl $0x2, %edi
callq 0xa240
movsd %xmm0, -0x78(%rbp)
movl -0xc(%rbp), %esi
movl $0x2, %edi
callq 0xa240
movq -0x80(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
leaq -0x1c(%rbp), %rsi
callq 0xfb50
movq -0x38(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x70(%rbp)
imull $0x3, -0xc(%rbp), %esi
addl $0x1, %esi
movl $0x2, %edi
callq 0xa240
movsd %xmm0, -0x68(%rbp)
movl -0xc(%rbp), %esi
shll %esi
movl $0x2, %edi
callq 0xa240
movq -0x70(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0xfb50
movq -0x38(%rbp), %rax
movl 0xb0(%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x2, %edx
jne 0xe68d
movq -0x38(%rbp), %rax
addq $0x28, %rax
movq %rax, -0xa0(%rbp)
movl -0xc(%rbp), %esi
shll %esi
addl $0x1, %esi
movl $0x2, %edi
callq 0xa240
movsd %xmm0, -0x98(%rbp)
movl -0xc(%rbp), %esi
movl $0x2, %edi
callq 0xa240
movq -0xa0(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x98(%rbp), %xmm0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x24(%rbp)
leaq -0x24(%rbp), %rsi
callq 0xfb50
movq -0x38(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x90(%rbp)
imull $0x3, -0xc(%rbp), %esi
addl $0x2, %esi
movl $0x2, %edi
callq 0xa240
movsd %xmm0, -0x88(%rbp)
movl -0xc(%rbp), %esi
shll %esi
addl $0x1, %esi
movl $0x2, %edi
callq 0xa240
movq -0x90(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xfb50
jmp 0xe68f
movq -0x38(%rbp), %rax
movl $0x0, 0x58(%rax)
movl $0x0, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %eax
movq %rax, -0xa8(%rbp)
addq $0x28, %rdi
callq 0xa5e0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jae 0xe725
movq -0x38(%rbp), %rsi
movq %rsi, %rdi
addq $0x40, %rdi
addq $0x58, %rsi
callq 0xfa80
movq -0x38(%rbp), %rdi
addq $0x28, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x5d60
movl (%rax), %edi
callq 0x5dc0
movl %eax, %esi
movl $0x2, %edi
callq 0xa240
movq -0x38(%rbp), %rax
movaps %xmm0, %xmm1
cvtsi2sdl 0x58(%rax), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0x58(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xe6a1
addq $0xb0, %rsp
popq %rbp
retq
nop