// File: /workspace/github_cpp_makefile_star2_O3/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 0xbf2f
movq %rax, 0x68(%r14)
leaq 0x60(%r14), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%r14), %rdi
callq 0x6cfc
movq 0x10(%r14), %rdi
testb %al, %al
je 0xc024
callq 0x6c2c
movl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x6d14
testb %bpl, %bpl
je 0xc098
testb %al, %al
je 0xbfac
movq 0x9057(%rip), %r15      # 0x14fc8
leaq 0x2fd8(%rip), %rsi      # 0xef50
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 %ebx, %ebx
movq %rbx, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rbx, 0x20(%r13)
leaq 0x38(%rsp), %r15
leaq 0x10(%rsp), %r12
movq 0x10(%r14), %rdi
callq 0x6cf0
cmpl %ebx, %eax
jle 0xc156
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 0x8d0c
movq 0x60(%rsp), %rbx
jmp 0xbfd5
callq 0x6d14
testb %al, %al
je 0xc06f
movq 0x8f94(%rip), %r15      # 0x14fc8
leaq 0x2f32(%rip), %rsi      # 0xef6d
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 0xc2d9
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc2e8
testb %al, %al
je 0xc0de
movq 0x8f25(%rip), %r15      # 0x14fc8
leaq 0x2eb0(%rip), %rsi      # 0xef5a
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 %ebx, %ebx
movq %rbx, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rbx, 0x20(%r13)
leaq 0x38(%rsp), %r15
leaq 0x10(%rsp), %r12
movq 0x10(%r14), %rdi
callq 0x6cf4
cmpl %ebx, %eax
jle 0xc19d
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 0x8d0c
movq 0x60(%rsp), %rbx
jmp 0xc107
movq 0x10(%r14), %rdi
callq 0x6cf0
movslq %eax, %rsi
movq 0x8(%rsp), %rdi
callq 0xccd0
movq 0x50(%rsp), %rax
cmpq %r13, %rax
je 0xc2cd
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 0xc182
jmp 0xc2cd
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x10(%r14), %rdi
callq 0x6cf0
movslq %eax, %rsi
leaq 0x10(%rsp), %rdi
callq 0xccd0
movq 0x50(%rsp), %rax
cmpq %r13, %rax
je 0xc1eb
movq 0x10(%rsp), %rbx
movl 0x20(%rax), %ecx
movl %ecx, (%rbx)
addq $0x4, %rbx
movq %rax, %rdi
callq 0x32c0
cmpq %r13, %rax
jne 0xc1d5
leaq 0x4(%rsp), %rax
movl $0x0, (%rax)
xorl %r13d, %r13d
leaq 0x34(%rsp), %r12
movq 0x10(%r14), %rdi
callq 0x6cf4
cltq
cmpq %rax, %r13
jge 0xc2b6
movq 0x10(%rsp), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x4(%rsp)
movq 0x68(%r14), %rsi
cmpq 0x70(%r14), %rsi
je 0xc235
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc244
movq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x824c
xorl %r15d, %r15d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x10(%r14), %rdi
callq 0x6cf8
decl %eax
cmpl %eax, %r15d
jge 0xc2ae
movl 0x4(%rsp), %ebp
movq 0x10(%r14), %rdi
callq 0x6c18
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 0xc29a
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc2a7
movq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0x836c
incl %r15d
decl %ebx
jmp 0xc24c
incq %r13
jmp 0xc1fe
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc2cd
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x38(%rsp), %rdi
callq 0x4370
jmp 0xc34f
leaq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x836c
movq 0x10(%r14), %rdi
callq 0x6c18
testl %eax, %eax
jle 0xc34f
xorl %ebx, %ebx
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x38(%rsp), %r15
movq 0x10(%r14), %rdi
callq 0x6c18
leal (%rax,%r12), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x38(%rsp)
movq 0x68(%r14), %rsi
cmpq 0x70(%r14), %rsi
je 0xc330
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%r14)
jmp 0xc33d
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x836c
incl %ebx
movq 0x10(%r14), %rdi
callq 0x6c18
decl %r12d
cmpl %eax, %ebx
jl 0xc302
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc371
jmp 0xc368
jmp 0xc368
jmp 0xc368
jmp 0xc368
movq %rax, %rbx
jmp 0xc38b
jmp 0xc371
jmp 0xc371
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc38b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x38(%rsp), %rdi
callq 0x4370
movq %rbx, %rdi
callq 0x3490
nop