// File: /workspace/github_cpp_makefile_star2_O3/Pyboon[P]sage/sage.cpp
// Function: Sage::ReadAntennaResponse()
void Sage::ReadAntennaResponse(){
    // init Antenna array 
    string path = config.path_antenna;    
    for(int i = 0; i < config.Tx; ++i){
        TxArrayEphi.emplace_back(MatrixXcd::Zero(181,91));
        TxArrayEtheta.emplace_back(MatrixXcd::Zero(181,91));
    }
    for(int i = 0; i < config.Rx; ++i){
        RxArrayEphi.emplace_back(MatrixXcd::Zero(181,91));
        RxArrayEtheta.emplace_back(MatrixXcd::Zero(181,91));
    }
    // read antenna response
    double temp_response = 0.0;
    ifstream fTxReEphi(path+"/TxReEphi", ios::binary);
    ifstream fTxImEphi(path+"/TxImEphi", ios::binary);
    ifstream fTxReEtheta(path+"/TxReEtheta", ios::binary);
    ifstream fTxImEtheta(path+"/TxImEtheta", ios::binary);
    if(!fTxReEphi|| !fTxImEphi || !fTxReEtheta || !fTxImEtheta){
        cerr<<"TxEphi or TxEtheta is not exist!"<<endl;
        abort();
    }
    for(int k = 0; k< config.Tx; ++k){
        for(int j = 0; j< 91; ++j){
            for(int i = 0; i< 181; ++i){
                fTxReEphi.read((char*)&temp_response, sizeof(double));
                TxArrayEphi[k](i,j).real(temp_response);
                fTxImEphi.read((char*)&temp_response, sizeof(double));
                TxArrayEphi[k](i,j).imag(temp_response);
                fTxReEtheta.read((char*)&temp_response, sizeof(double));
                TxArrayEtheta[k](i,j).real(temp_response);
                fTxImEtheta.read((char*)&temp_response, sizeof(double));
                TxArrayEtheta[k](i,j).imag(temp_response);
            }
        }
    }

    ifstream fRxReEphi(path+"/RxReEphi", ios::binary);
    ifstream fRxImEphi(path+"/RxImEphi", ios::binary);
    ifstream fRxReEtheta(path+"/RxReEtheta", ios::binary);
    ifstream fRxImEtheta(path+"/RxImEtheta", ios::binary);
    if(!fRxReEphi|| !fRxImEphi || !fRxReEtheta || !fRxImEtheta){
        cerr<<"RxEphi or RxEtheta is not exist!"<<endl;
        abort();
    }
    for(int k = 0; k< config.Rx; ++k){
        for(int j = 0; j< 91; ++j){
            for(int i = 0; i< 181; ++i){
                fRxReEphi.read((char*)&temp_response, sizeof(double));
                RxArrayEphi[k](i,j).real(temp_response);
                fRxImEphi.read((char*)&temp_response, sizeof(double));
                RxArrayEphi[k](i,j).imag(temp_response);
                fRxReEtheta.read((char*)&temp_response, sizeof(double));
                RxArrayEtheta[k](i,j).real(temp_response);
                fRxImEtheta.read((char*)&temp_response, sizeof(double));
                RxArrayEtheta[k](i,j).imag(temp_response);
            }
        }
    }
    // for(int i = 0;i<181; ++i){
    //     cout<<RxArrayEphi[1](i,0)<<endl;
    // }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1098, %rsp           # imm = 0x1098
movq %rdi, %rbx
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x20(%rdi), %rsi
movq 0x28(%rdi), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x4336
movq %rbx, (%rsp)
cmpl $0x0, 0xc(%rbx)
leaq 0x68(%rsp), %rbx
jle 0x4ebe
movq (%rsp), %rax
leaq 0x160(%rax), %r14
leaq 0x178(%rax), %r15
xorl %ebp, %ebp
xorps %xmm0, %xmm0
leaq 0x58(%rsp), %r12
movups %xmm0, (%rbx)
movq $0xb5, 0x58(%rsp)
movq $0x5b, 0x60(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x6128
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0xb5, 0x58(%rsp)
movq $0x5b, 0x60(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x6128
incl %ebp
movq (%rsp), %rax
cmpl 0xc(%rax), %ebp
xorps %xmm0, %xmm0
jl 0x4e6d
movq (%rsp), %rax
cmpl $0x0, 0x8(%rax)
jle 0x4f35
movq (%rsp), %rax
leaq 0x190(%rax), %r14
leaq 0x1a8(%rax), %r15
xorl %ebp, %ebp
xorps %xmm0, %xmm0
leaq 0x58(%rsp), %r12
movups %xmm0, (%rbx)
movq $0xb5, 0x58(%rsp)
movq $0x5b, 0x60(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x6128
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0xb5, 0x58(%rsp)
movq $0x5b, 0x60(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x6128
incl %ebp
movq (%rsp), %rax
cmpl 0x8(%rax), %ebp
xorps %xmm0, %xmm0
jl 0x4ee4
movq $0x0, 0x8(%rsp)
leaq 0xea0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe90(%rsp), %rdi
callq 0x4336
leaq 0x172d2(%rip), %rsi     # 0x1c23d
leaq 0xe90(%rsp), %rdi
callq 0x34a0
leaq 0x58(%rsp), %rdi
leaq 0xe90(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0xe90(%rsp), %rdi
cmpq %r14, %rdi
je 0x4fac
movq 0xea0(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0xc98(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc88(%rsp), %rdi
callq 0x4336
leaq 0x1726e(%rip), %rsi     # 0x1c247
leaq 0xc88(%rsp), %rdi
callq 0x34a0
leaq 0xe90(%rsp), %rdi
leaq 0xc88(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0xc88(%rsp), %rdi
cmpq %r14, %rdi
je 0x501d
movq 0xc98(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0xa90(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa80(%rsp), %rdi
callq 0x4336
leaq 0x17207(%rip), %rsi     # 0x1c251
leaq 0xa80(%rsp), %rdi
callq 0x34a0
leaq 0xc88(%rsp), %rdi
leaq 0xa80(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0xa80(%rsp), %rdi
cmpq %r14, %rdi
je 0x508e
movq 0xa90(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x888(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x878(%rsp), %rdi
callq 0x4336
leaq 0x171a2(%rip), %rsi     # 0x1c25d
leaq 0x878(%rsp), %rdi
callq 0x34a0
leaq 0xa80(%rsp), %rdi
leaq 0x878(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0x878(%rsp), %rdi
cmpq %r14, %rdi
je 0x50ff
movq 0x888(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x58(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x78(%rsp,%rax)
jne 0x5774
movq 0xe90(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xeb0(%rsp,%rax)
jne 0x5774
movq 0xc88(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xca8(%rsp,%rax)
jne 0x5774
movq 0xa80(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xaa0(%rsp,%rax)
jne 0x5774
movq (%rsp), %rax
cmpl $0x0, 0xc(%rax)
jle 0x5303
xorl %ecx, %ecx
leaq 0x8(%rsp), %r15
movq %rcx, 0x30(%rsp)
leaq (%rcx,%rcx,2), %r14
xorl %r12d, %r12d
xorl %r13d, %r13d
movl $0x8, %ebp
xorl %ebx, %ebx
movl $0x8, %edx
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x160(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
imulq %r12, %rax
addq (%rcx), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, -0x8(%rbp,%rax)
movl $0x8, %edx
leaq 0xe90(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x160(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
movsd 0x8(%rsp), %xmm0
imulq %r12, %rax
addq (%rcx), %rax
movsd %xmm0, (%rbp,%rax)
movl $0x8, %edx
leaq 0xc88(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x178(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
imulq %r12, %rax
addq (%rcx), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, -0x8(%rbp,%rax)
movl $0x8, %edx
leaq 0xa80(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x178(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
movsd 0x8(%rsp), %xmm0
imulq %r12, %rax
addq (%rcx), %rax
movsd %xmm0, (%rbp,%rax)
incq %rbx
addq $0x10, %rbp
cmpq $0xb5, %rbx
jne 0x518c
incq %r13
addq $0x10, %r12
cmpq $0x5b, %r13
jne 0x5185
movq 0x30(%rsp), %rcx
incq %rcx
movq (%rsp), %rax
movslq 0xc(%rax), %rax
cmpq %rax, %rcx
jl 0x5176
leaq 0x680(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x670(%rsp), %rdi
callq 0x4336
leaq 0x16f5a(%rip), %rsi     # 0x1c28a
leaq 0x670(%rsp), %rdi
callq 0x34a0
leaq 0x878(%rsp), %rdi
leaq 0x670(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0x670(%rsp), %rdi
cmpq %r14, %rdi
je 0x5374
movq 0x680(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x478(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x468(%rsp), %rdi
callq 0x4336
leaq 0x16ef3(%rip), %rsi     # 0x1c294
leaq 0x468(%rsp), %rdi
callq 0x34a0
leaq 0x670(%rsp), %rdi
leaq 0x468(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0x468(%rsp), %rdi
cmpq %r14, %rdi
je 0x53e5
movq 0x478(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x270(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x260(%rsp), %rdi
callq 0x4336
leaq 0x16e8c(%rip), %rsi     # 0x1c29e
leaq 0x260(%rsp), %rdi
callq 0x34a0
leaq 0x468(%rsp), %rdi
leaq 0x260(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0x260(%rsp), %rdi
cmpq %r14, %rdi
je 0x5456
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x4336
leaq 0x16e2d(%rip), %rsi     # 0x1c2aa
leaq 0x38(%rsp), %rdi
callq 0x34a0
leaq 0x260(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movl $0x4, %edx
callq 0x33f0
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x54b5
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x878(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x898(%rsp,%rax)
jne 0x579a
movq 0x670(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x690(%rsp,%rax)
jne 0x579a
movq 0x468(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x488(%rsp,%rax)
jne 0x579a
movq 0x260(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x280(%rsp,%rax)
jne 0x579a
movq (%rsp), %rax
cmpl $0x0, 0x8(%rax)
jle 0x56c2
xorl %ecx, %ecx
leaq 0x8(%rsp), %r15
movq %rcx, 0x30(%rsp)
leaq (%rcx,%rcx,2), %r14
xorl %r12d, %r12d
xorl %r13d, %r13d
movl $0x8, %ebp
xorl %ebx, %ebx
movl $0x8, %edx
leaq 0x878(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x190(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
imulq %r12, %rax
addq (%rcx), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, -0x8(%rbp,%rax)
movl $0x8, %edx
leaq 0x670(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x190(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
movsd 0x8(%rsp), %xmm0
imulq %r12, %rax
addq (%rcx), %rax
movsd %xmm0, (%rbp,%rax)
movl $0x8, %edx
leaq 0x468(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x1a8(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
imulq %r12, %rax
addq (%rcx), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, -0x8(%rbp,%rax)
movl $0x8, %edx
leaq 0x260(%rsp), %rdi
movq %r15, %rsi
callq 0x3330
movq (%rsp), %rax
movq 0x1a8(%rax), %rcx
movq 0x8(%rcx,%r14,8), %rax
cmpq %rbx, %rax
jle 0x5755
leaq (%rcx,%r14,8), %rcx
cmpq %r13, 0x10(%rcx)
jle 0x5755
movsd 0x8(%rsp), %xmm0
imulq %r12, %rax
addq (%rcx), %rax
movsd %xmm0, (%rbp,%rax)
incq %rbx
addq $0x10, %rbp
cmpq $0xb5, %rbx
jne 0x5548
incq %r13
addq $0x10, %r12
cmpq $0x5b, %r13
jne 0x5541
movq 0x30(%rsp), %rcx
incq %rcx
movq (%rsp), %rax
movslq 0x8(%rax), %rax
cmpq %rax, %rcx
jl 0x5532
leaq 0x260(%rsp), %rdi
callq 0x30a0
leaq 0x468(%rsp), %rdi
callq 0x30a0
leaq 0x670(%rsp), %rdi
callq 0x30a0
leaq 0x878(%rsp), %rdi
callq 0x30a0
leaq 0xa80(%rsp), %rdi
callq 0x30a0
leaq 0xc88(%rsp), %rdi
callq 0x30a0
leaq 0xe90(%rsp), %rdi
callq 0x30a0
leaq 0x58(%rsp), %rdi
callq 0x30a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5743
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x172ab(%rip), %rdi     # 0x1ca07
leaq 0x172d9(%rip), %rsi     # 0x1ca3c
leaq 0x172f5(%rip), %rcx     # 0x1ca5f
movl $0x16d, %edx            # imm = 0x16D
callq 0x31b0
movq 0x29875(%rip), %rdi     # 0x2eff0
leaq 0x16ae7(%rip), %rsi     # 0x1c269
movl $0x20, %edx
callq 0x32d0
movq 0x2985d(%rip), %rdi     # 0x2eff0
callq 0x3120
jmp 0x57be
movq 0x2984f(%rip), %rdi     # 0x2eff0
leaq 0x16b0e(%rip), %rsi     # 0x1c2b6
movl $0x20, %edx
callq 0x32d0
movq 0x29837(%rip), %rdi     # 0x2eff0
callq 0x3120
callq 0x3170
jmp 0x57c5
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x5968
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x5968
movq %rax, %rbx
jmp 0x5968
jmp 0x57f2
movq %rax, %rbx
movq 0x260(%rsp), %rdi
cmpq %r14, %rdi
je 0x5975
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x5975
movq %rax, %rbx
jmp 0x5975
jmp 0x5825
movq %rax, %rbx
movq 0x468(%rsp), %rdi
cmpq %r14, %rdi
je 0x5982
movq 0x478(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x5982
movq %rax, %rbx
jmp 0x5982
jmp 0x5858
movq %rax, %rbx
movq 0x670(%rsp), %rdi
cmpq %r14, %rdi
je 0x5994
movq 0x680(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x5994
jmp 0x5991
jmp 0x5888
movq %rax, %rbx
movq 0x878(%rsp), %rdi
cmpq %r14, %rdi
je 0x59a1
movq 0x888(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x59a1
movq %rax, %rbx
jmp 0x59a1
jmp 0x58bb
movq %rax, %rbx
movq 0xa80(%rsp), %rdi
cmpq %r14, %rdi
je 0x59ae
movq 0xa90(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x59ae
movq %rax, %rbx
jmp 0x59ae
jmp 0x58ee
movq %rax, %rbx
movq 0xc88(%rsp), %rdi
cmpq %r14, %rdi
je 0x59bb
movq 0xc98(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x59bb
movq %rax, %rbx
jmp 0x59bb
jmp 0x5921
movq %rax, %rbx
movq 0xe90(%rsp), %rdi
cmpq %r14, %rdi
je 0x59c5
movq 0xea0(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x59c5
jmp 0x5953
jmp 0x5958
jmp 0x5991
jmp 0x5953
jmp 0x5953
jmp 0x5953
movq %rax, %rbx
jmp 0x59c5
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0x30a0
leaq 0x468(%rsp), %rdi
callq 0x30a0
leaq 0x670(%rsp), %rdi
callq 0x30a0
leaq 0x878(%rsp), %rdi
callq 0x30a0
jmp 0x5994
movq %rax, %rbx
leaq 0xa80(%rsp), %rdi
callq 0x30a0
leaq 0xc88(%rsp), %rdi
callq 0x30a0
leaq 0xe90(%rsp), %rdi
callq 0x30a0
leaq 0x58(%rsp), %rdi
callq 0x30a0
leaq 0x20(%rsp), %rax
movq 0x10(%rsp), %rdi
cmpq %rax, %rdi
je 0x59e1
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
callq 0x3450
nop