// File: /workspace/github_cpp_makefile_star2_O1/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, %ebp
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x15d80(%rip), %rsi     # 0x1d727
leaq 0x15d84(%rip), %rdx     # 0x1d732
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x43da
movq %r12, %rdi
callq 0x60e8
movq %rbx, 0x10(%rsp)
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x79df
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32b0
movl %ebp, 0x4(%rsp)
movl 0x1c(%r15), %eax
movslq 0x130(%r15), %rbx
decl %eax
cltd
idivl %ebx
cmpl $-0x2, %eax
jle 0x7cdb
movl %eax, %r13d
movl %eax, %ebp
incl %ebp
movq %r15, 0x18(%rsp)
je 0x7a5c
movl %ebp, %edi
shlq $0x3, %rdi
callq 0x3370
movq %rax, %r12
testl %r13d, %r13d
je 0x7a29
movl %r12d, %eax
andl $0xf, %eax
jne 0x7d19
testq %r12, %r12
jne 0x7a5f
movl $0x8, %edi
callq 0x3130
movq 0x27581(%rip), %rcx     # 0x2efc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x27583(%rip), %rsi     # 0x2efd0
movq 0x27554(%rip), %rdx     # 0x2efa8
movq %rax, %rdi
callq 0x3440
xorl %r12d, %r12d
movslq %ebp, %r15
movabsq $0x7ffffffffffffffe, %r14 # imm = 0x7FFFFFFFFFFFFFFE
andq %r15, %r14
testl %r13d, %r13d
jle 0x7a8e
leaq -0x8(,%r14,8), %rdx
andq $-0x10, %rdx
addq $0x10, %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x3160
cmpq %r15, %r14
jge 0x7aaf
leaq (,%r15,8), %rdx
movq %rdx, %rdi
andq $-0x10, %rdi
addq %r12, %rdi
andl $0x8, %edx
xorl %esi, %esi
callq 0x3160
testl %r13d, %r13d
js 0x7b89
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
testq %rax, %rax
setne %dl
testq %rcx, %rcx
sets %sil
testb %sil, %dl
jne 0x7cbc
movq 0x8(%rdi), %rdx
leaq -0x1(%rcx), %r14
movq %rdx, %rdi
shlq $0x4, %rdi
leaq (%rdi,%rax), %r8
addq $0x8, %r8
movq %rbx, %r9
shlq $0x4, %r9
xorl %r10d, %r10d
movq %r10, %rsi
imulq %rbx, %rsi
testq %rsi, %rsi
js 0x7c7e
cmpq %rsi, %rdx
jle 0x7c7e
shlq $0x4, %rsi
addq %rax, %rsi
testq %rcx, %rcx
je 0x7b6c
jle 0x7c9d
movsd (%rsi), %xmm0
movsd 0x8(%rsi), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
cmpq $0x1, %rcx
je 0x7b70
movq %r8, %r11
movq %r14, %rsi
movsd -0x8(%r11), %xmm1
movsd (%r11), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
addsd %xmm1, %xmm0
addq %rdi, %r11
decq %rsi
jne 0x7b47
jmp 0x7b70
xorpd %xmm0, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, (%r12,%r10,8)
incq %r10
addq %r9, %r8
cmpq %rbp, %r10
jne 0x7afb
testl %r13d, %r13d
jle 0x7bc4
movsd (%r12), %xmm0
movl $0x1, %ecx
xorl %eax, %eax
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
movsd (%r12,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %rcx, %rax
maxsd %xmm0, %xmm1
incq %rcx
movapd %xmm1, %xmm0
cmpq %rcx, %r15
jne 0x7ba4
jmp 0x7bcf
xorl %eax, %eax
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
testl %esi, %esi
movq 0x18(%rsp), %rdx
js 0x7cfa
movslq %esi, %rcx
cmpq %rcx, 0x1c8(%rdx)
jle 0x7cfa
movq 0x1c0(%rdx), %rdx
imull %eax, %ebx
incl %ebx
movl %ebx, (%rdx,%rcx,4)
cltq
movq %rax, %rcx
shlq $0x4, %rcx
movq (%rdi), %rdx
movq 0x10(%rdi), %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
je 0x7cbc
movq %rdi, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x1, 0x70(%rsp)
testl %eax, %eax
movq 0x10(%rsp), %rbx
js 0x7c7e
cmpq %rax, 0x8(%rdi)
jle 0x7c7e
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0xfc6e
movq %r12, %rdi
callq 0x3320
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1627c(%rip), %rdi     # 0x1df01
leaq 0x1631c(%rip), %rsi     # 0x1dfa8
leaq 0x168a8(%rip), %rcx     # 0x1e53b
movl $0x7a, %edx
callq 0x31b0
leaq 0x16a35(%rip), %rdi     # 0x1e6d9
leaq 0x16a72(%rip), %rsi     # 0x1e71d
leaq 0x16a84(%rip), %rcx     # 0x1e736
movl $0x19d, %edx            # imm = 0x19D
callq 0x31b0
leaq 0x163bf(%rip), %rdi     # 0x1e082
leaq 0x16462(%rip), %rsi     # 0x1e12c
leaq 0x16937(%rip), %rcx     # 0x1e608
movl $0xaf, %edx
callq 0x31b0
leaq 0x1675d(%rip), %rdi     # 0x1e43f
leaq 0x14b38(%rip), %rsi     # 0x1c821
leaq 0x167d9(%rip), %rcx     # 0x1e4c9
movl $0x138, %edx            # imm = 0x138
callq 0x31b0
leaq 0x15595(%rip), %rdi     # 0x1d296
leaq 0x14d14(%rip), %rsi     # 0x1ca1c
leaq 0x155a4(%rip), %rcx     # 0x1d2b3
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x31b0
leaq 0x14bbb(%rip), %rdi     # 0x1c8db
leaq 0x14c6e(%rip), %rsi     # 0x1c995
leaq 0x14c86(%rip), %rcx     # 0x1c9b4
movl $0xa1, %edx
callq 0x31b0
movq %rax, %rbx
movq %r12, %rdi
callq 0x3320
jmp 0x7d5f
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d5f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3460
nop