// File: UCBASiCS[P]SPRIGHT/src/frontend.cpp
// Function: FrontEnd::FrontEnd(Chrono*, Config const*, Input const*)
FrontEnd::FrontEnd(Chrono* newChrono, const Config* newConfig, const Input* newInput):
	Step(newChrono, newConfig),countSamplesDone(false),input(newInput)
{
    signalLength = config->getSignalLength();
    observationMatrix = (ffast_complex**) malloc(config->getBinsSum() * sizeof(ffast_complex*));

    for (int binAbsoluteIndex=0; binAbsoluteIndex<config->getBinsSum(); binAbsoluteIndex++)
    {
        observationMatrix[binAbsoluteIndex] = (ffast_complex*) malloc(config->getDelaysNb() * sizeof(ffast_complex));
    }
    for (int binAbsoluteIndex=0; binAbsoluteIndex<config->getBinsSum(); binAbsoluteIndex++)
        for (int delayNb = 0; delayNb < config->getBinsSum(); delayNb++)
            observationMatrix[binAbsoluteIndex][delayNb] = 0;

    computeDelays();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x48(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x58e0
movq -0x48(%rbp), %rdi
leaq 0x15645(%rip), %rax     # 0x2fcf0
movq %rax, (%rdi)
addq $0x18, %rdi
movq %rdi, -0x60(%rbp)
callq 0x5920
movq -0x48(%rbp), %rdi
movb $0x0, 0x5c(%rdi)
addq $0x60, %rdi
movq %rdi, -0x58(%rbp)
callq 0xf8f0
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, 0x78(%rdi)
subq $-0x80, %rdi
movq %rdi, -0x50(%rbp)
callq 0x5960
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xe9a0
movl %eax, -0x3c(%rbp)
jmp 0x1a6fb
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, 0x58(%rax)
movq 0x10(%rax), %rdi
callq 0xeaf0
movl %eax, -0x64(%rbp)
jmp 0x1a713
movl -0x64(%rbp), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x43e0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x50(%rax)
movl $0x0, -0x30(%rbp)
movq -0x48(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, -0x6c(%rbp)
movq 0x10(%rax), %rdi
callq 0xeaf0
movl %eax, -0x68(%rbp)
jmp 0x1a74c
movl -0x6c(%rbp), %eax
movl -0x68(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1a7ca
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xeb30
movl %eax, -0x70(%rbp)
jmp 0x1a768
movl -0x70(%rbp), %eax
movslq %eax, %rdi
shlq $0x4, %rdi
callq 0x43e0
movq %rax, %rdx
movq -0x48(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1a734
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x5980
movq -0x58(%rbp), %rdi
callq 0x5ad0
movq -0x60(%rbp), %rdi
callq 0x5a00
movq -0x48(%rbp), %rdi
callq 0x5e90
jmp 0x1a872
movl $0x0, -0x34(%rbp)
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, -0x78(%rbp)
movq 0x10(%rax), %rdi
callq 0xeaf0
movl %eax, -0x74(%rbp)
jmp 0x1a7e9
movl -0x78(%rbp), %eax
movl -0x74(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1a85e
movl $0x0, -0x38(%rbp)
movq -0x48(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, -0x80(%rbp)
movq 0x10(%rax), %rdi
callq 0xeaf0
movl %eax, -0x7c(%rbp)
jmp 0x1a812
movl -0x80(%rbp), %eax
movl -0x7c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1a84e
movq -0x48(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x38(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorps %xmm0, %xmm0
callq 0x5e60
jmp 0x1a841
jmp 0x1a843
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1a7fa
jmp 0x1a850
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1a7d1
movq -0x48(%rbp), %rdi
callq 0x1a880
jmp 0x1a869
addq $0x80, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x4540
nopl (%rax,%rax)