// File: /workspace/github_cpp_makefile_star2_O1/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 0xc057
movq %rax, 0x68(%r14)
leaq 0x60(%r14), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%r14), %rdi
callq 0x6e36
movq 0x10(%r14), %rdi
testb %al, %al
je 0xc14c
callq 0x6d66
movl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x6e4e
testb %bpl, %bpl
je 0xc1c0
testb %al, %al
je 0xc0d4
movq 0x9f2f(%rip), %r15      # 0x15fc8
leaq 0x3ea0(%rip), %rsi      # 0xff40
movl $0x9, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x40(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
leaq 0x38(%rsp), %r15
leaq 0x10(%rsp), %r12
movq 0x60(%rsp), %rbx
movq 0x10(%r14), %rdi
callq 0x6e2a
cmpl %ebx, %eax
jle 0xc27e
xorps %xmm0, %xmm0
cvtsi2sdl 0x58(%r14), %xmm0
movsd %xmm0, 0x28(%rsp)
callq 0x3230
mulsd 0x28(%rsp), %xmm0
callq 0x3460
cvttsd2si %xmm0, %eax
cltd
idivl 0x58(%r14)
movl %edx, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8e48
jmp 0xc0fd
callq 0x6e4e
testb %al, %al
je 0xc197
movq 0x9e6c(%rip), %r15      # 0x15fc8
leaq 0x3dfa(%rip), %rsi      # 0xff5d
movl $0x15, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movl $0x0, 0x38(%rsp)
movq 0x68(%r14), %rsi
cmpq 0x70(%r14), %rsi
je 0xc412
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc421
testb %al, %al
je 0xc206
movq 0x9dfd(%rip), %r15      # 0x15fc8
leaq 0x3d78(%rip), %rsi      # 0xff4a
movl $0x12, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x40(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
leaq 0x38(%rsp), %r15
leaq 0x10(%rsp), %r12
movq 0x60(%rsp), %rbx
movq 0x10(%r14), %rdi
callq 0x6e2e
cmpl %ebx, %eax
jle 0xc2c5
xorps %xmm0, %xmm0
cvtsi2sdl 0x58(%r14), %xmm0
movsd %xmm0, 0x28(%rsp)
callq 0x3230
mulsd 0x28(%rsp), %xmm0
callq 0x3460
cvttsd2si %xmm0, %eax
cltd
idivl 0x58(%r14)
movl %edx, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8e48
jmp 0xc22f
movq 0x10(%r14), %rdi
callq 0x6e2a
movslq %eax, %rsi
movq 0x8(%rsp), %rdi
callq 0xce3e
movq 0x50(%rsp), %rax
cmpq %r13, %rax
je 0xc406
movq 0x8(%rsp), %rcx
movq (%rcx), %rbx
movl 0x20(%rax), %ecx
movl %ecx, (%rbx)
addq $0x4, %rbx
movq %rax, %rdi
callq 0x32c0
cmpq %r13, %rax
jne 0xc2aa
jmp 0xc406
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0xc2e9
movq $0x0, 0x18(%rsp)
movq 0x10(%r14), %rdi
callq 0x6e2a
movslq %eax, %rsi
leaq 0x10(%rsp), %rdi
callq 0xce3e
movq 0x50(%rsp), %rax
cmpq %r13, %rax
je 0xc324
movq 0x10(%rsp), %rbx
movl 0x20(%rax), %ecx
movl %ecx, (%rbx)
addq $0x4, %rbx
movq %rax, %rdi
callq 0x32c0
cmpq %r13, %rax
jne 0xc30e
leaq 0x4(%rsp), %rax
movl $0x0, (%rax)
xorl %r13d, %r13d
leaq 0x34(%rsp), %r12
movq 0x10(%r14), %rdi
callq 0x6e2e
cltq
cmpq %rax, %r13
jge 0xc3ef
movq 0x10(%rsp), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x4(%rsp)
movq 0x68(%r14), %rsi
cmpq 0x70(%r14), %rsi
je 0xc36e
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc37d
movq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x8376
xorl %r15d, %r15d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x10(%r14), %rdi
callq 0x6e32
decl %eax
cmpl %eax, %r15d
jge 0xc3e7
movl 0x4(%rsp), %ebp
movq 0x10(%r14), %rdi
callq 0x6d52
addl %ebx, %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, 0x34(%rsp)
movq 0x68(%r14), %rsi
cmpq 0x70(%r14), %rsi
je 0xc3d3
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc3e0
movq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0x8496
incl %r15d
decl %ebx
jmp 0xc385
incq %r13
jmp 0xc337
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc406
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x38(%rsp), %rdi
callq 0x4402
jmp 0xc488
leaq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x8496
movq 0x10(%r14), %rdi
callq 0x6d52
testl %eax, %eax
jle 0xc488
xorl %ebx, %ebx
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x38(%rsp), %r15
movq 0x10(%r14), %rdi
callq 0x6d52
leal (%rax,%r12), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x38(%rsp)
movq 0x68(%r14), %rsi
cmpq 0x70(%r14), %rsi
je 0xc469
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc476
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x8496
incl %ebx
movq 0x10(%r14), %rdi
callq 0x6d52
decl %r12d
cmpl %eax, %ebx
jl 0xc43b
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc4aa
jmp 0xc4a1
jmp 0xc4a1
jmp 0xc4a1
jmp 0xc4a1
movq %rax, %rbx
jmp 0xc4c4
jmp 0xc4aa
jmp 0xc4aa
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc4c4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x38(%rsp), %rdi
callq 0x4402
movq %rbx, %rdi
callq 0x3490