// File: /workspace/github_cpp_makefile_star2_O3/Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::InitTau(Eigen::Matrix<std::complex<double>, -1, -1, 0, -1, -1>, int)
RowVectorXcd IsiSage::InitTau(const complex_mat data, const int iL){
    Util::log("init tau...");
    // go through all CIR find tau index with max power 
    int min_tau = 1;
    int max_tau = config.sample_codes;
    int step = config.delay_step;
    int tau_size = (max_tau-min_tau)/step + 1;
    VectorXd tau_power_sum(tau_size);
    tau_power_sum.setZero(tau_size);
    for(int i_tau = 0; i_tau < tau_size; ++i_tau){
        tau_power_sum(i_tau) = data.row(i_tau*step).norm();
    }
    // get index of max tau_power_sum
    int max_index = 0;
    tau_power_sum.maxCoeff(&max_index);
    result.tau(iL) = min_tau + max_index * step;
    //return tau_power
    return data.row(max_index);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %ecx, 0xc(%rsp)
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %rbp
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15ef6(%rip), %rsi     # 0x1d7b7
leaq 0x15efa(%rip), %rdx     # 0x1d7c2
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x43cc
movq %r12, %rdi
callq 0x60be
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x78f4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32a0
movl 0x1c(%rbx), %eax
movq %rbx, 0x18(%rsp)
movslq 0x130(%rbx), %rbx
decl %eax
cltd
idivl %ebx
cmpl $-0x2, %eax
jle 0x7bd5
movl %eax, %r13d
movq %rbp, 0x10(%rsp)
incl %eax
je 0x797a
movl %eax, %ebp
leaq (,%rbp,8), %rdi
callq 0x3360
movq %rax, %r12
testl %r13d, %r13d
je 0x7940
movl %r12d, %eax
andl $0xf, %eax
jne 0x7c13
testq %r12, %r12
je 0x7c32
movl %ebp, %r15d
andl $0x7ffffffe, %r15d      # imm = 0x7FFFFFFE
testl %r13d, %r13d
je 0x798c
leaq -0x8(,%r15,8), %rdx
andq $-0x10, %rdx
addq $0x10, %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x3160
movb $0x1, %al
movq %rax, (%rsp)
jmp 0x7994
movq $0x0, (%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
jmp 0x7994
movq $0x0, (%rsp)
cmpl %ebp, %r15d
je 0x79bb
leaq (,%rbp,8), %rdx
movabsq $0x3fffffff0, %rdi      # imm = 0x3FFFFFFF0
andq %rdx, %rdi
addq %r12, %rdi
andl $0x8, %edx
xorl %esi, %esi
callq 0x3160
testl %r13d, %r13d
movq 0x18(%rsp), %r13
js 0x7a97
movq (%r14), %rax
movq 0x10(%r14), %rcx
testq %rax, %rax
setne %dl
testq %rcx, %rcx
sets %sil
testb %sil, %dl
jne 0x7bb6
movq 0x8(%r14), %rdx
leaq -0x1(%rcx), %rsi
movq %rdx, %rdi
shlq $0x4, %rdi
leaq (%rdi,%rax), %r8
addq $0x8, %r8
movq %rbx, %r9
shlq $0x4, %r9
xorl %r10d, %r10d
movq %r10, %r11
imulq %rbx, %r11
testq %r11, %r11
js 0x7b78
cmpq %r11, %rdx
jle 0x7b78
shlq $0x4, %r11
addq %rax, %r11
testq %rcx, %rcx
je 0x7a7a
jle 0x7b97
movsd (%r11), %xmm0
movsd 0x8(%r11), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
cmpq $0x1, %rcx
je 0x7a7e
movq %r8, %r11
movq %rsi, %r15
movsd -0x8(%r11), %xmm1
movsd (%r11), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
addsd %xmm1, %xmm0
addq %rdi, %r11
decq %r15
jne 0x7a55
jmp 0x7a7e
xorpd %xmm0, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, (%r12,%r10,8)
incq %r10
addq %r9, %r8
cmpq %rbp, %r10
jne 0x7a07
xorl %eax, %eax
cmpb $0x0, (%rsp)
je 0x7aca
movsd (%r12), %xmm0
movl $0x1, %ecx
xorl %eax, %eax
movsd (%r12,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %rcx, %rax
maxsd %xmm0, %xmm1
incq %rcx
movapd %xmm1, %xmm0
cmpq %rcx, %rbp
jne 0x7aac
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
js 0x7bf4
movslq %ecx, %rcx
cmpq %rcx, 0x1c8(%r13)
jle 0x7bf4
movq 0x1c0(%r13), %rdx
imull %eax, %ebx
incl %ebx
movl %ebx, (%rdx,%rcx,4)
cltq
movq %rax, %rcx
shlq $0x4, %rcx
movq (%r14), %rdx
movq 0x10(%r14), %rsi
addq %rdx, %rcx
movq %rcx, 0x40(%rsp)
movq %rsi, 0x50(%rsp)
testq %rdx, %rdx
sete %cl
testq %rsi, %rsi
setns %dl
orb %cl, %dl
movq 0x10(%rsp), %rbx
je 0x7bb6
movq %r14, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x1, 0x70(%rsp)
testl %eax, %eax
js 0x7b78
cmpq %rax, 0x8(%r14)
jle 0x7b78
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0xfd4e
movq %r12, %rdi
callq 0x3310
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16412(%rip), %rdi     # 0x1df91
leaq 0x164b2(%rip), %rsi     # 0x1e038
leaq 0x16a3e(%rip), %rcx     # 0x1e5cb
movl $0x7a, %edx
callq 0x31b0
leaq 0x16bcb(%rip), %rdi     # 0x1e769
leaq 0x16c08(%rip), %rsi     # 0x1e7ad
leaq 0x16c1a(%rip), %rcx     # 0x1e7c6
movl $0x19d, %edx            # imm = 0x19D
callq 0x31b0
leaq 0x16555(%rip), %rdi     # 0x1e112
leaq 0x165f8(%rip), %rsi     # 0x1e1bc
leaq 0x16acd(%rip), %rcx     # 0x1e698
movl $0xaf, %edx
callq 0x31b0
leaq 0x168f3(%rip), %rdi     # 0x1e4cf
leaq 0x14c5e(%rip), %rsi     # 0x1c841
leaq 0x1696f(%rip), %rcx     # 0x1e559
movl $0x138, %edx            # imm = 0x138
callq 0x31b0
leaq 0x156bb(%rip), %rdi     # 0x1d2b6
leaq 0x14e3a(%rip), %rsi     # 0x1ca3c
leaq 0x156ca(%rip), %rcx     # 0x1d2d3
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x31b0
leaq 0x14ce1(%rip), %rdi     # 0x1c8fb
leaq 0x14d94(%rip), %rsi     # 0x1c9b5
leaq 0x14dac(%rip), %rcx     # 0x1c9d4
movl $0xa1, %edx
callq 0x31b0
movl $0x8, %edi
callq 0x3130
movq 0x2737d(%rip), %rcx     # 0x2efc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x2737f(%rip), %rsi     # 0x2efd0
movq 0x27350(%rip), %rdx     # 0x2efa8
movq %rax, %rdi
callq 0x3430
movq %rax, %rbx
movq %r12, %rdi
callq 0x3310
jmp 0x7c87
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x7c87
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
callq 0x3450
nop