// File: UCBASiCS[P]SPRIGHT/src/binprocessor.cpp
// Function: BinProcessor::MLprocess()
void BinProcessor::MLprocess()
{
    ffast_real MLnoise = std::numeric_limits<ffast_real>::infinity();
    int MLlocation = 0;

    /*
        Iterate over all balls that could map to this bin, and find the best one.
    */

    int homSolution = mapToInt(binRelativeIndex, config->getBinNumIndices(stage), samplingPattern, config->getSignalBitLength());
    int locGenerator = pow(2,(config->getSignalBitLength())) -1 - samplingPattern;

    int nnz = config->getSignalBitLength() - config->getBinNumIndices(stage);
    for (int i =0; i <pow(2,nnz); i++)
    {
        location = homSolution ^ mapToInt(i,nnz,locGenerator,config->getSignalBitLength());

        estimateBinSignal();
        if (noise < MLnoise)
        {
            MLnoise = noise;
            MLlocation = location;
        }
    }
    location = MLlocation;
    noise = MLnoise;
    estimateBinSignal();
    return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0xa1a0
movq -0x30(%rbp), %rax
movsd %xmm0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl 0x5c(%rax), %ecx
movl %ecx, -0x3c(%rbp)
movq 0x10(%rax), %rdi
movl 0x60(%rax), %esi
callq 0xea90
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, -0x38(%rbp)
movl 0x64(%rax), %ecx
movl %ecx, -0x34(%rbp)
movq 0x10(%rax), %rdi
callq 0xe940
movl -0x3c(%rbp), %edi
movl -0x38(%rbp), %esi
movl -0x34(%rbp), %edx
movl %eax, %ecx
callq 0xa1b0
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, -0x18(%rbp)
movq 0x10(%rax), %rdi
callq 0xe940
movl %eax, %esi
movl $0x2, %edi
callq 0xa240
movq -0x30(%rbp), %rax
movsd 0x16723(%rip), %xmm1    # 0x200d0
subsd %xmm1, %xmm0
cvtsi2sdl 0x64(%rax), %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x1c(%rbp)
movq 0x10(%rax), %rdi
callq 0xe940
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, -0x28(%rbp)
movq 0x10(%rax), %rdi
movl 0x60(%rax), %esi
callq 0xea90
movl %eax, %ecx
movl -0x28(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cvtsi2sdl -0x24(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0xa240
movsd -0x48(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x9a96
movq -0x30(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, -0x4c(%rbp)
movl -0x24(%rbp), %ecx
movl %ecx, -0x58(%rbp)
movl -0x20(%rbp), %ecx
movl %ecx, -0x54(%rbp)
movl -0x1c(%rbp), %ecx
movl %ecx, -0x50(%rbp)
movq 0x10(%rax), %rdi
callq 0xe940
movl -0x58(%rbp), %edi
movl -0x54(%rbp), %esi
movl -0x50(%rbp), %edx
movl %eax, %ecx
callq 0xa1b0
movq -0x30(%rbp), %rdi
movl %eax, %ecx
movl -0x4c(%rbp), %eax
xorl %ecx, %eax
movl %eax, 0x38(%rdi)
callq 0x9c80
movq -0x30(%rbp), %rax
movsd 0x70(%rax), %xmm1
movsd -0x10(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x9a86
movq -0x30(%rbp), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
movl 0x38(%rax), %eax
movl %eax, -0x14(%rbp)
jmp 0x9a88
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x99f0
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, 0x38(%rdi)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, 0x70(%rdi)
callq 0x9c80
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)