// File: /workspace/github_cpp_makefile_star2_O2/UCBASiCS[P]SPRIGHT/src/frontend.cpp
// Function: FrontEnd::computeDelays()
void FrontEnd::computeDelays()
{
    delays.clear();

    if (config->isNoisy()) {
        if (config->needToUseMaximumLikelihoodDetection()) {
            if (config->isVerbose())
                std::cout << "ML delays" << std::endl;
            std::set<int> tempDelaysSet;
            while((int) tempDelaysSet.size() < config->getDelaysNb())
            {
                int tempDelay = ((int) floor(signalLength*((ffast_real) drand48()))) % signalLength;

                tempDelaysSet.insert(tempDelay);
            }
            delays.resize(config->getDelaysNb());
            std::copy(tempDelaysSet.begin(), tempDelaysSet.end(), delays.begin());
        }
        else {
            if (config->isVerbose())
                std::cout<< "FFAST chain delays" << std::endl;
            std::set<int> tempDelaysSet;
            while((int) tempDelaysSet.size() < config->getChainsNb())
            {
                int tempDelay = ((int) floor(signalLength*((ffast_real) drand48()))) % signalLength;

                tempDelaysSet.insert(tempDelay);
            }

            std::vector<int> tempDelaysArr;
            tempDelaysArr.clear();
            tempDelaysArr.resize(config->getDelaysNb());
            std::copy(tempDelaysSet.begin(), tempDelaysSet.end(), tempDelaysArr.begin());

            int r = 0;
            for (int i = 0; i < config->getChainsNb(); ++i) {
                r = tempDelaysArr[i];
                delays.push_back(r);
                for (int j = 0; j < config->getDelaysPerBunchNb()-1; j++)
                    delays.push_back(positiveMod(r^(1<<(config->getSignalBitLength() -1 - j)), signalLength));
            }
        }
    }
    else 
    {
        if (config->isVerbose())
            std::cout << "using standard delays" << std::endl;

        delays.push_back(0);
        for (int i =0; i < config->getSignalBitLength(); i++) {
            delays.push_back(1<<(config->getSignalBitLength() -1 - i));
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
movq 0x60(%rdi), %rax
cmpq %rax, 0x68(%rdi)
je 0xa705
movq %rax, 0x68(%r14)
leaq 0x60(%r14), %rbx
movq 0x10(%r14), %rdi
callq 0x67e4
movq 0x10(%r14), %rdi
testb %al, %al
je 0xa7c9
callq 0x6714
movl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x67fc
testb %bpl, %bpl
je 0xa844
testb %al, %al
je 0xa756
movq 0x988e(%rip), %rdi      # 0x13fd0
leaq 0x27cf(%rip), %rsi      # 0xcf18
callq 0x3250
movq %rax, %rdi
callq 0x3110
leaq 0x40(%rsp), %r15
andl $0x0, (%r15)
andq $0x0, 0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
andq $0x0, 0x20(%r15)
xorl %ebp, %ebp
leaq 0x38(%rsp), %r12
leaq 0x20(%rsp), %r13
movq 0x10(%r14), %rdi
callq 0x67d8
cmpl %ebp, %eax
jle 0xa8d2
cvtsi2sdl 0x58(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
callq 0x3230
mulsd 0x10(%rsp), %xmm0
callq 0x3460
cvttsd2si %xmm0, %eax
cltd
idivl 0x58(%r14)
movl %edx, 0x20(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x7afc
movq 0x60(%rsp), %rbp
jmp 0xa77d
callq 0x67fc
testb %al, %al
je 0xa7ed
movq 0x97f7(%rip), %rdi      # 0x13fd0
leaq 0x2755(%rip), %rsi      # 0xcf35
callq 0x3250
movq %rax, %rdi
callq 0x3110
leaq 0x38(%rsp), %r15
andl $0x0, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x72f2
xorl %ebp, %ebp
pushq $-0x1
popq %r12
pushq $0x1
popq %r13
movq 0x10(%r14), %rdi
callq 0x6700
cmpl %eax, %ebp
jge 0xa9e6
movq 0x10(%r14), %rdi
callq 0x6700
leal (%rax,%r12), %ecx
movl %r13d, %eax
shll %cl, %eax
movl %eax, 0x38(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x72f2
incl %ebp
decl %r12d
jmp 0xa80b
testb %al, %al
je 0xa863
movq 0x9781(%rip), %rdi      # 0x13fd0
leaq 0x26cc(%rip), %rsi      # 0xcf22
callq 0x3250
movq %rax, %rdi
callq 0x3110
leaq 0x40(%rsp), %r15
andl $0x0, (%r15)
andq $0x0, 0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
andq $0x0, 0x20(%r15)
xorl %ebp, %ebp
leaq 0x38(%rsp), %r12
leaq 0x20(%rsp), %r13
movq 0x10(%r14), %rdi
callq 0x67dc
cmpl %ebp, %eax
jle 0xa8fb
cvtsi2sdl 0x58(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
callq 0x3230
mulsd 0x10(%rsp), %xmm0
callq 0x3460
cvttsd2si %xmm0, %eax
cltd
idivl 0x58(%r14)
movl %edx, 0x20(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x7afc
movq 0x60(%rsp), %rbp
jmp 0xa88a
movq 0x10(%r14), %rdi
callq 0x67d8
movslq %eax, %rsi
movq %rbx, %rdi
callq 0xb170
movq 0x50(%rsp), %rdi
movq (%rbx), %rdx
movq %r15, %rsi
callq 0xb2e5
jmp 0xa9dc
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq 0x10(%r14), %rdi
callq 0x67d8
movslq %eax, %rsi
leaq 0x20(%rsp), %rdi
callq 0xb170
movq 0x50(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq %r15, %rsi
callq 0xb2e5
leaq 0xc(%rsp), %rax
andl $0x0, (%rax)
xorl %r15d, %r15d
leaq 0x1c(%rsp), %r12
movq 0x10(%r14), %rdi
callq 0x67dc
cltq
cmpq %rax, %r15
jge 0xa9d2
movq 0x20(%rsp), %rax
movl (%rax,%r15,4), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x70b2
movq %r15, 0x10(%rsp)
xorl %r15d, %r15d
pushq $-0x1
popq %r13
movq 0x10(%r14), %rdi
callq 0x67e0
decl %eax
cmpl %eax, %r15d
jge 0xa9c5
movl 0xc(%rsp), %ebp
movq 0x10(%r14), %rdi
callq 0x6700
addl %r13d, %eax
btcl %eax, %ebp
movl 0x58(%r14), %ecx
movl %ebp, %eax
cltd
idivl %ecx
movl %edx, %eax
sarl $0x1f, %eax
andl %ecx, %eax
addl %edx, %eax
movl %eax, 0x1c(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x72f2
incl %r15d
decl %r13d
jmp 0xa979
movq 0x10(%rsp), %r15
incq %r15
jmp 0xa943
leaq 0x20(%rsp), %rdi
callq 0x41c6
leaq 0x38(%rsp), %rdi
callq 0x3ffc
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xaa08
jmp 0xa9ff
jmp 0xa9ff
jmp 0xa9ff
jmp 0xa9ff
movq %rax, %rbx
jmp 0xaa15
jmp 0xaa08
jmp 0xaa08
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x41c6
leaq 0x38(%rsp), %rdi
callq 0x3ffc
movq %rbx, %rdi
callq 0x3490
nop