// File: UCBASiCS[P]SPRIGHT/src/experimentoutput.cpp
// Function: ExperimentOutput::process()
void ExperimentOutput::process()
{
    chrono->start("Output");

    std::unordered_map<int,ffast_complex> decodedFrequencies;

    // If the signal was off-grid adjust the output to the original signal
    if ( config->getSignalLengthOriginal() != config->getSignalLength() )
    {
        for (auto it = backEnd->getDecodedFrequencies().cbegin(); it != backEnd->getDecodedFrequencies().cend(); ++it)
        {
            if (input->getNonZeroFrequencies().count(it->first+1) > 0)
            {
                decodedFrequencies[it->first+1] = it->second;
            }
            else if (input->getNonZeroFrequencies().count(it->first-1) > 0)
            {
                decodedFrequencies[it->first-1] = it->second;
        }
        else if (input->getNonZeroFrequencies().count(it->first+2) > 0)
        {
            decodedFrequencies[it->first+2] = it->second;
        }
        else if (input->getNonZeroFrequencies().count(it->first-2) > 0)
        {
            decodedFrequencies[it->first-2] = it->second;
        }
        else
        {
            decodedFrequencies[it->first] = it->second;
        }
    }
    backEnd->swapDecodedFrequencies(decodedFrequencies);
    decodedFrequencies.clear();
}

    /*
        we first check if there are false detections. If there are 
        not any false detections we check if the peeling got stuck 
        due to the graph. If so we declare a binning failure and 
        do not count missed locations. If it was not a binning failure,
        then we count the missed locations.
    */
        checkFalseDetections();
        checkMissedLocationsOrBinningFailure();
        checkFullRecovery();
        computeMSEErrorAmplitude();
        computeMSEerror();

        chrono->stop("Output");

        if ( config->isVerbose() && config->getIterations() >= 2 )
        {
            displayIterationResults();
        }

    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x118(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x4550
movq -0x110(%rbp), %rdx
leaq 0xb138(%rip), %rsi      # 0x20c9b
leaq -0x28(%rbp), %rdi
callq 0x5a20
jmp 0x15b6e
movq -0x118(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xc270
jmp 0x15b80
leaq -0x28(%rbp), %rdi
callq 0x4180
leaq -0x29(%rbp), %rdi
callq 0x4310
leaq -0x78(%rbp), %rdi
callq 0x5920
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xf890
movl %eax, -0x124(%rbp)
jmp 0x15bb3
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xe9a0
movl %eax, -0x128(%rbp)
jmp 0x15bcb
movl -0x124(%rbp), %eax
movl -0x128(%rbp), %ecx
cmpl %ecx, %eax
je 0x1606f
movq -0x120(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x5750
movq %rax, -0x130(%rbp)
jmp 0x15bf8
movq -0x130(%rbp), %rdi
callq 0x5bb0
movq %rax, -0x80(%rbp)
movq -0x120(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x5750
movq %rax, -0x138(%rbp)
jmp 0x15c21
movq -0x138(%rbp), %rdi
callq 0x5c10
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5be0
testb $0x1, %al
jne 0x15c4d
jmp 0x16002
movq -0x120(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x15310
movq %rax, -0x140(%rbp)
jmp 0x15c66
leaq -0x80(%rbp), %rdi
callq 0x5c70
movq -0x140(%rbp), %rdi
movl (%rax), %eax
incl %eax
movl %eax, -0x8c(%rbp)
leaq -0x8c(%rbp), %rsi
callq 0x5b30
movq %rax, -0x148(%rbp)
jmp 0x15c95
movq -0x148(%rbp), %rax
cmpq $0x0, %rax
jbe 0x15d53
leaq -0x80(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x5c70
movq -0x160(%rbp), %rdi
addq $0x8, %rax
movq %rax, -0x158(%rbp)
callq 0x5c70
movl (%rax), %eax
incl %eax
movl %eax, -0x90(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x5b60
movq %rax, -0x150(%rbp)
jmp 0x15cf0
movq -0x150(%rbp), %rax
movq -0x158(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x15ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x15d34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4180
leaq -0x29(%rbp), %rdi
callq 0x4310
jmp 0x161c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x161c0
movq -0x120(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x15310
movq %rax, -0x168(%rbp)
jmp 0x15d6c
leaq -0x80(%rbp), %rdi
callq 0x5c70
movq -0x168(%rbp), %rdi
movl (%rax), %eax
decl %eax
movl %eax, -0x94(%rbp)
leaq -0x94(%rbp), %rsi
callq 0x5b30
movq %rax, -0x170(%rbp)
jmp 0x15d9b
movq -0x170(%rbp), %rax
cmpq $0x0, %rax
jbe 0x15e13
leaq -0x80(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x5c70
movq -0x188(%rbp), %rdi
addq $0x8, %rax
movq %rax, -0x180(%rbp)
callq 0x5c70
movl (%rax), %eax
decl %eax
movl %eax, -0x98(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5b60
movq %rax, -0x178(%rbp)
jmp 0x15df2
movq -0x178(%rbp), %rax
movq -0x180(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x15ff0
movq -0x120(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x15310
movq %rax, -0x190(%rbp)
jmp 0x15e2c
leaq -0x80(%rbp), %rdi
callq 0x5c70
movq -0x190(%rbp), %rdi
movl (%rax), %eax
addl $0x2, %eax
movl %eax, -0x9c(%rbp)
leaq -0x9c(%rbp), %rsi
callq 0x5b30
movq %rax, -0x198(%rbp)
jmp 0x15e5c
movq -0x198(%rbp), %rax
cmpq $0x0, %rax
jbe 0x15ed5
leaq -0x80(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
callq 0x5c70
movq -0x1b0(%rbp), %rdi
addq $0x8, %rax
movq %rax, -0x1a8(%rbp)
callq 0x5c70
movl (%rax), %eax
addl $0x2, %eax
movl %eax, -0xa0(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5b60
movq %rax, -0x1a0(%rbp)
jmp 0x15eb4
movq -0x1a0(%rbp), %rax
movq -0x1a8(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x15fee
movq -0x120(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x15310
movq %rax, -0x1b8(%rbp)
jmp 0x15eee
leaq -0x80(%rbp), %rdi
callq 0x5c70
movq -0x1b8(%rbp), %rdi
movl (%rax), %eax
addl $-0x2, %eax
movl %eax, -0xa4(%rbp)
leaq -0xa4(%rbp), %rsi
callq 0x5b30
movq %rax, -0x1c0(%rbp)
jmp 0x15f1e
movq -0x1c0(%rbp), %rax
cmpq $0x0, %rax
jbe 0x15f94
leaq -0x80(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x5c70
movq -0x1d8(%rbp), %rdi
addq $0x8, %rax
movq %rax, -0x1d0(%rbp)
callq 0x5c70
movl (%rax), %eax
addl $-0x2, %eax
movl %eax, -0xa8(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x5b60
movq %rax, -0x1c8(%rbp)
jmp 0x15f76
movq -0x1c8(%rbp), %rax
movq -0x1d0(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x15fec
leaq -0x80(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x5c70
movq -0x1f0(%rbp), %rdi
addq $0x8, %rax
movq %rax, -0x1e8(%rbp)
callq 0x5c70
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x120f0
movq %rax, -0x1e0(%rbp)
jmp 0x15fd0
movq -0x1e0(%rbp), %rax
movq -0x1e8(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x15fee
jmp 0x15ff0
jmp 0x15ff2
jmp 0x15ff4
leaq -0x80(%rbp), %rdi
callq 0x5ca0
jmp 0x15c08
movq -0x120(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x1f8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x17240
jmp 0x16026
movq -0x1f8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x5770
jmp 0x1603b
leaq -0xe0(%rbp), %rdi
callq 0x5a00
leaq -0x78(%rbp), %rdi
callq 0x5d20
jmp 0x1606f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x5a00
jmp 0x161c0
movq -0x120(%rbp), %rdi
callq 0x161e0
jmp 0x1607d
movq -0x120(%rbp), %rdi
callq 0x162b0
jmp 0x1608b
movq -0x120(%rbp), %rdi
callq 0x165f0
jmp 0x16099
movq -0x120(%rbp), %rdi
callq 0x16650
jmp 0x160a7
movq -0x120(%rbp), %rdi
callq 0x167b0
jmp 0x160b5
movq -0x120(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x208(%rbp)
leaq -0x101(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x4550
movq -0x200(%rbp), %rdx
leaq 0xabb3(%rip), %rsi      # 0x20c9b
leaq -0x100(%rbp), %rdi
callq 0x5a20
jmp 0x160f6
movq -0x208(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xc340
jmp 0x1610b
leaq -0x100(%rbp), %rdi
callq 0x4180
leaq -0x101(%rbp), %rdi
callq 0x4310
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xec10
movb %al, -0x209(%rbp)
jmp 0x1613b
movb -0x209(%rbp), %al
testb $0x1, %al
jne 0x16147
jmp 0x161ae
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xe980
movl %eax, -0x210(%rbp)
jmp 0x1615f
movl -0x210(%rbp), %eax
cmpl $0x2, %eax
jl 0x161ae
movq -0x120(%rbp), %rdi
callq 0x16980
jmp 0x16178
jmp 0x161ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x161a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x4180
leaq -0x101(%rbp), %rdi
callq 0x4310
jmp 0x161c0
leaq -0x78(%rbp), %rdi
callq 0x5a00
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x5a00
movq -0x38(%rbp), %rdi
callq 0x4540
nopw %cs:(%rax,%rax)