// File: /workspace/github_cpp_makefile_star2_O3/UCBASiCS[P]SPRIGHT/src/experimentoutput.cpp
// Function: ExperimentOutput::checkMissedLocationsOrBinningFailure()
void ExperimentOutput::checkMissedLocationsOrBinningFailure()
{
    // indices of missed locations
    std::set<int> missedLocations;
    binningFailure = false;


    // if there are no false detections in the current iteration
    if (falseDetectionsIterationNb == 0)
    {
        // go over the true frequencies
        for (auto it = input->getNonZeroFrequencies().cbegin(); it != input->getNonZeroFrequencies().cend(); ++it)
        {
            // if the frequency is missing in the decoded frequencies
            if (backEnd->getDecodedFrequencies().count(it->first) == 0)
            {
                // add the missing location to the missed locations
                missedLocations.insert(it->first);
            }
        }

        // if there is a missing location check if it is due to binning failure
        if (!missedLocations.empty())
        {
            binningFailure = isBinningFailure(missedLocations);
        }
    }

    if (binningFailure)
    {
        binningFailuresNb++;
        missedLocationsIterationNb = 0;
        
        // if it is a binning failure, increment the counter for trapping set size
        // that is held with the unordered_map trappingSetSizeCounter
        auto it = trappingSetSizeCounter.find( missedLocations.size() );
        if( it != trappingSetSizeCounter.end() )  
        {
            it->second =  it->second + 1;
        }
        else
        {
            trappingSetSizeCounter[ missedLocations.size() ] = 1;
        }
    }
    else
    {
        missedLocationsIterationNb = missedLocations.size();
    }

    missedLocationsNbs.push_back(missedLocationsIterationNb);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movb $0x0, 0x40(%rdi)
cmpl $0x0, 0x38(%rdi)
jne 0xa7b8
movq 0x20(%rbx), %rdi
callq 0x9ff8
movq %rax, %r14
addq $0x10, %r14
leaq 0x8(%rsp), %r15
movq (%r14), %r14
movq 0x20(%rbx), %rdi
callq 0x9ff8
testq %r14, %r14
je 0xa787
movq 0x18(%rbx), %rdi
callq 0x4222
leaq 0x8(%r14), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x44c6
testq %rax, %rax
jne 0xa74c
movq %r15, %rdi
movq %r12, %rsi
callq 0x8d0c
jmp 0xa74c
cmpq $0x0, 0x30(%rsp)
je 0xa7b8
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xb766
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0xb1e2
movb %al, 0x40(%rbx)
leaq 0x38(%rsp), %rdi
callq 0x4370
cmpb $0x1, 0x40(%rbx)
jne 0xa7ef
incl 0xd8(%rbx)
movl $0x0, 0x3c(%rbx)
leaq 0xa0(%rbx), %r14
movl 0x30(%rsp), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
callq 0xbaaa
testq %rax, %rax
je 0xa7f8
incl 0xc(%rax)
jmp 0xa811
movl 0x30(%rsp), %eax
movl %eax, 0x3c(%rbx)
jmp 0xa811
movl 0x30(%rsp), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
callq 0xbb06
movl $0x1, (%rax)
movl 0x3c(%rbx), %eax
movl %eax, 0x4(%rsp)
movq 0x78(%rbx), %rsi
cmpq 0x80(%rbx), %rsi
je 0xa831
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x78(%rbx)
jmp 0xa842
addq $0x70, %rbx
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xb96e
leaq 0x8(%rsp), %rdi
callq 0x4370
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xa873
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4370
jmp 0xa876
jmp 0xa873
jmp 0xa873
jmp 0xa873
jmp 0xa873
jmp 0xa873
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4370
movq %rbx, %rdi
callq 0x3490