// File: /workspace/github_cpp_makefile_star2_O2/Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::SignalConstruct(int)
RowVectorXcd IsiSage::SignalConstruct(const int iL){
    MatrixX2cd C2 = getAntennaResponse(result.theta_rx(iL), result.phi_rx(iL), 2);
    MatrixX2cd C1 = getAntennaResponse(result.theta_tx(iL), result.phi_tx(iL), 1);
    RowVectorXcd signal(config.subchannel_num * config.cycle_num);
    complex<double> temp = 0;
    for(int i_cyc = 0; i_cyc < config.cycle_num; ++i_cyc){
        for(int i_tx = 0; i_tx < config.Tx; ++i_tx){
            for(int i_rx = 0; i_rx < config.Rx; ++i_rx){
                double t = (i_cyc * config.Tcy + i_tx * config.Tt + i_rx * config.Tr) * config.T; 
                temp.real(cos(2*PI* result.doppler(iL) *t));
                temp.imag(sin(2*PI* result.doppler(iL) *t));
                complex<double> pattern_signal = 0;
                for(int p1 = 0; p1 < 2; ++p1){
                    for(int p2 = 0; p2 < 2; ++p2){
                        pattern_signal += result.alpha(2*p1+p2,iL) * C2(i_rx, p1) * C1(i_tx, p2);
                    }
                }
                signal(i_cyc*config.subchannel_num+i_tx*config.Rx+i_rx) = temp * pattern_signal;
            }
        }
    }
    return signal;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
leaq 0x200(%rsi), %rdi
movslq %edx, %r15
movq %r15, %rsi
callq 0x564e
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x210(%rbx), %rdi
movq %r15, %rsi
callq 0x564e
movsd (%rax), %xmm1
movq (%rbx), %rax
leaq 0x78(%rsp), %rdi
pushq $0x2
popq %rdx
movq %rbx, %rsi
movsd 0x8(%rsp), %xmm0
callq *0x20(%rax)
leaq 0x1e0(%rbx), %rdi
movq %r15, %rsi
callq 0x564e
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x1f0(%rbx), %rdi
movq %r15, %rsi
callq 0x564e
movsd (%rax), %xmm1
movq (%rbx), %rax
leaq 0x68(%rsp), %rdi
pushq $0x1
popq %rdx
movq %rbx, %rsi
movsd 0x8(%rsp), %xmm0
callq *0x20(%rax)
movl 0x10(%rbx), %eax
imull 0xa0(%rbx), %eax
leaq 0x20(%rsp), %rsi
movl %eax, (%rsi)
movq 0x10(%rsp), %rdi
callq 0xafb6
leaq 0x1d0(%rbx), %r14
leaq 0x220(%rbx), %rax
movq %rax, 0x60(%rsp)
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %rax
movapd %xmm0, (%rax)
xorl %r12d, %r12d
movq %rbx, 0x48(%rsp)
movq %r14, 0x40(%rsp)
cmpl 0x10(%rbx), %r12d
jge 0x893b
xorl %r13d, %r13d
movq %r12, 0x50(%rsp)
movslq 0xc(%rbx), %rax
cmpq %rax, %r13
jge 0x8933
xorl %ebp, %ebp
movq %r13, 0x8(%rsp)
movslq 0x8(%rbx), %rax
cmpq %rax, %rbp
jge 0x892b
movl 0xbc(%rbx), %eax
imull %r12d, %eax
movl 0xb4(%rbx), %ecx
imull %r13d, %ecx
addl %eax, %ecx
movl 0xb8(%rbx), %eax
imull %ebp, %eax
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
mulsd 0xa8(%rbx), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x564e
movsd 0x14c27(%rip), %xmm1    # 0x1d3e8
movsd (%rax), %xmm0
mulsd %xmm1, %xmm0
mulsd 0x18(%rsp), %xmm0
callq 0x3470
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x564e
movsd 0x14bfb(%rip), %xmm0    # 0x1d3e8
movsd (%rax), %xmm1
mulsd %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x3080
movsd %xmm0, 0x28(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x88bd
xorl %r12d, %r12d
cmpq $0x2, %r12
je 0x88b1
leaq (%r12,%r13), %rsi
movq 0x60(%rsp), %rdi
movq %r15, %r14
movq %r15, %rdx
callq 0x54d6
movq %rax, %r15
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x5596
movq %r15, %rdi
movq %rax, %rsi
callq 0xab66
movsd %xmm0, 0x88(%rsp)
movsd %xmm1, 0x90(%rsp)
leaq 0x68(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
callq 0x5596
leaq 0x88(%rsp), %rdi
movq %rax, %rsi
callq 0xab66
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
addpd 0x30(%rsp), %xmm0
movapd %xmm0, 0x30(%rsp)
incq %r12
movq %r14, %r15
jmp 0x8826
incq %rbx
addq $0x2, %r13
jmp 0x8819
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xab66
movsd %xmm0, 0x18(%rsp)
movsd %xmm1, 0x58(%rsp)
movq 0x48(%rsp), %rbx
movq 0x50(%rsp), %r12
movq 0x8(%rsp), %r13
movl 0xa0(%rbx), %eax
imull %r12d, %eax
movl 0x8(%rbx), %ecx
imull %r13d, %ecx
addl %ebp, %eax
addl %ecx, %eax
movslq %eax, %rsi
movq 0x10(%rsp), %rdi
callq 0xafe6
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
incq %rbp
movq 0x40(%rsp), %r14
jmp 0x876e
incq %r13
jmp 0x875a
incl %r12d
jmp 0x8748
movq 0x68(%rsp), %rdi
callq 0x32c0
movq 0x78(%rsp), %rdi
callq 0x32c0
movq 0x10(%rsp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x8981
movq %rax, %rbx
jmp 0x898b
jmp 0x8974
jmp 0x8974
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0xb326
movq 0x68(%rsp), %rdi
callq 0x32c0
movq 0x78(%rsp), %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3430
nop