// File: /workspace/github_cpp_makefile_star2_O1/UCBASiCS[P]SPRIGHT/src/backend.cpp
// Function: BackEnd::process()
void BackEnd::process()
{
    chrono->start("BackEnd");
    binProcessor = new BinProcessor(chrono, config, observationMatrix, frontEnd->getDelays());
    int binAbsoluteIndex;
    bool singletonFound = true;
    initialize();
    maxBinUsed =0;
    while(singletonFound)
    {
        singletonFound = false;
        for (int stage = 0; stage < config->getBinsNb(); stage++)
        {
            binAbsoluteIndex = config->getBinOffset(stage);

            for (int binRelativeIndex = 0; binRelativeIndex < config->getBinNumItems(stage); binRelativeIndex++)
            {
                // Copies the values of bin index and related variables in binProcessor object.
                binProcessor->adjustTo(binAbsoluteIndex, binRelativeIndex, stage);
                // only check for singletons in the updated bins
                if (
                    changed[binAbsoluteIndex]
                    && binProcessor->isSingleton()
                    && decodedFrequencies.count(binProcessor->getLocation()) == 0
                   )
                {
                    singletonFound = true;
                    decodedFrequencies[binProcessor->getLocation()] = binProcessor->getAmplitude();
                    peelFrom(binProcessor->getLocation(), binProcessor->getAmplitude(), binAbsoluteIndex);
                    changed[binAbsoluteIndex] = false;
                }

                // mark this bin as processed
                // remark: this state can be changed if a ball is peeled from this bin
                changed[binAbsoluteIndex] = false;

                if ((int) decodedFrequencies.size() == config->getSignalSparsityPeeling())
                {
                    goto stopPeeling;
                }

                binAbsoluteIndex++;
            }
        }
    }


    stopPeeling:
    for (auto it = decodedFrequencies.cbegin(); it != decodedFrequencies.cend(); ++it)
    {
        realFrequenciesIndices.push_back(it->first);
    }

    delete binProcessor;

    chrono->stop("BackEnd");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %r14
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xb4df(%rip), %rsi      # 0xf030
leaq 0xb4df(%rip), %rdx      # 0xf037
leaq 0x8(%rsp), %rdi
callq 0x44c2
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x5a48
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3b86
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3270
movl $0xa0, %edi
callq 0x3260
movq %rax, %r14
movq 0x8(%rbx), %r15
movq 0x10(%rbx), %r12
movq 0x28(%rbx), %r13
movq 0x18(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0xccbe
leaq 0x8(%rsp), %r8
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x4a74
movq %r14, 0x20(%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3bde
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x3ec4
movl $0x0, 0x88(%rbx)
leaq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
movb $0x1, %al
testb $0x1, %al
je 0x3daf
movq 0x10(%rbx), %rdi
callq 0x6e1c
xorl %ebp, %ebp
testl %eax, %eax
setg %al
jle 0x3d95
movl $0x0, 0x28(%rsp)
movb %al, 0x3(%rsp)
movq 0x10(%rbx), %rdi
movl %ebp, %esi
callq 0x6e0c
movl %eax, %r15d
movq 0x10(%rbx), %rdi
movl %ebp, 0x4(%rsp)
movl %ebp, %esi
callq 0x6d82
testl %eax, %eax
setg %r14b
jle 0x3d73
movslq %r15d, %r12
xorl %r13d, %r13d
movl 0x4(%rsp), %ebp
movq %r15, 0x40(%rsp)
movq 0x20(%rbx), %rdi
addl %r13d, %r15d
movl %r15d, %esi
movl %r13d, %edx
movl %ebp, %ecx
callq 0x5376
movq 0x80(%rbx), %rax
cmpb $0x1, (%rax,%r12)
jne 0x3d2e
movq 0x20(%rbx), %rdi
callq 0x5394
testb %al, %al
je 0x3d2e
movq 0x20(%rbx), %rdi
callq 0x5460
movl %eax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x4552
testq %rax, %rax
jne 0x3d2e
movq 0x20(%rbx), %rdi
callq 0x5464
movsd %xmm0, 0x28(%rsp)
movsd %xmm1, 0x38(%rsp)
movq 0x20(%rbx), %rdi
callq 0x5460
movl %eax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x45cc
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x20(%rbx), %rdi
callq 0x5460
movl %eax, %ebp
movq 0x20(%rbx), %rdi
callq 0x5464
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3f1a
movq 0x80(%rbx), %rax
movb $0x0, (%rax,%r12)
movb $0x1, %al
movl %eax, 0x28(%rsp)
movq 0x80(%rbx), %rax
movb $0x0, (%rax,%r12)
movl 0x48(%rbx), %r15d
movq 0x10(%rbx), %rdi
callq 0x6d6e
cmpl %r15d, %eax
je 0x3d73
incq %r12
incl %r13d
movq 0x10(%rbx), %rdi
movl 0x4(%rsp), %ebp
movl %ebp, %esi
callq 0x6d82
cmpl %eax, %r13d
setl %r14b
movq 0x40(%rsp), %r15
jl 0x3c5d
testb $0x1, %r14b
jne 0x3d9f
movl 0x4(%rsp), %ebp
incl %ebp
movq 0x10(%rbx), %rdi
callq 0x6e1c
cmpl %eax, %ebp
setl %al
jl 0x3c21
jmp 0x3da3
movl $0x0, 0x28(%rsp)
jmp 0x3da3
movb 0x3(%rsp), %al
testb $0x1, %al
movl 0x28(%rsp), %eax
je 0x3bfb
movq 0x40(%rbx), %r12
testq %r12, %r12
leaq 0x18(%rsp), %r13
je 0x3e02
leaq 0x68(%rbx), %r14
leaq 0x8(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2sdl 0x8(%r12), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x70(%rbx), %rsi
cmpq 0x78(%rbx), %rsi
je 0x3dee
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x70(%rbx)
jmp 0x3df9
movq %r14, %rdi
movq %r15, %rdx
callq 0x486a
movq (%r12), %r12
testq %r12, %r12
jne 0x3dc6
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x3e11
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x8(%rbx), %rbx
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
leaq 0xb20c(%rip), %rsi      # 0xf030
leaq 0xb20c(%rip), %rdx      # 0xf037
callq 0x44c2
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5ae4
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e54
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3270
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x3eaa
jmp 0x3ebc
jmp 0x3eb9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3e93
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
jmp 0x3e93
movq %rax, %rbx
movl $0xa0, %esi
movq %r14, %rdi
jmp 0x3eb2
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3ebc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x3ebc
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3490