// File: sus304[P]ForRocket/src/environment/vincenty.cpp
// Function: forrocket::vdownrange(Eigen::Matrix<double, 3, 1, 0, 3, 1>&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&)
std::pair<double, double> forrocket::vdownrange(Eigen::Vector3d& observer_LLH, Eigen::Vector3d& target_LLH) {
    // Input: [lat, lon, alt], [lat, lon, alt] ([deg, m])
    // Output: downrange [m], Azimuth start->end [deg]

    int itr_limit = 5000;

    if (observer_LLH(0) == target_LLH(0) && observer_LLH(1) == target_LLH(1)) {
        return std::make_pair(0.0, 0.0);
    }
    
    double lat1 = deg2rad(observer_LLH(0));
    double lon1 = deg2rad(observer_LLH(1));
    double lat2 = deg2rad(target_LLH(0));
    double lon2 = deg2rad(target_LLH(1));

    WGS84 wgs84;

    double U1 = std::atan((1.0 - wgs84.f) * std::tan(lat1));
    double U2 = std::atan((1.0 - wgs84.f) * std::tan(lat2));
    double diff_lon = lon2 - lon1;

    double sin_sigma = 0.0;
    double cos_sigma = 0.0;
    double sigma = 0.0;
    double sin_alpha = 0.0;
    double cos_alpha = 0.0;
    double cos_2sigma_m = 0.0;
    double coeff = 0.0;

    double lamda = diff_lon;
    for (int i=0; i < itr_limit; ++i) {
        sin_sigma = std::pow(std::cos(U2) * std::sin(lamda), 2) + std::pow(std::cos(U1) * std::sin(U2) - std::sin(U1) * std::cos(U2) * std::cos(lamda), 2);
        sin_sigma = std::sqrt(sin_sigma);
        cos_sigma = std::sin(U1) * std::sin(U2) + std::cos(U1) * std::cos(U2) * std::cos(lamda);
        sigma = std::atan2(sin_sigma, cos_sigma);

        sin_alpha = std::cos(U1) * std::cos(U2) * std::sin(lamda) / sin_sigma;
        cos_alpha = std::sqrt(1.0 - std::pow(sin_alpha, 2));

        cos_2sigma_m = cos_sigma - 2.0 * std::sin(U1) * std::sin(U2) / std::pow(cos_alpha, 2);

        coeff = wgs84.f / 16.0 * std::pow(cos_alpha, 2) * (4.0 + wgs84.f * (4.0 - 3.0 * std::pow(cos_alpha, 2)));
        double lamda_itr = lamda;
        lamda = diff_lon + (1.0 - coeff) * wgs84.f * sin_alpha * (sigma + coeff * sin_sigma * (cos_2sigma_m + coeff * cos_sigma * (-1.0 + 2.0 * cos_2sigma_m)));

        if (std::abs(lamda - lamda_itr) < 1e-12) {
            break;
        } // TODO: 収束しなかった時の処理追加
    }

    double u_squr = std::pow(cos_alpha, 2) * (std::pow(wgs84.a, 2) - std::pow(wgs84.b, 2)) / std::pow(wgs84.b, 2);
    double A = 1.0 + u_squr / 16384.0 * (4096.0 + u_squr * (-768.0 + u_squr * (320.0 - 175.0 * u_squr)));
    double B = u_squr / 1024.0 * (256.0 + u_squr * (-128.0 + u_squr * (74.0 - 47.0 * u_squr)));
    double delta_sigma = B * sin_sigma * (cos_2sigma_m + 0.25 * B *(cos_sigma * (-1.0 + 2.0 * std::pow(cos_2sigma_m, 2))
                        - (1.0 / 6.0) * B * cos_2sigma_m * (-3.0 + 4.0 * std::pow(sin_sigma, 2)) * (-3.0 + 4.0 * std::pow(cos_2sigma_m, 2))));
    
    double downrange = wgs84.b * A * (sigma - delta_sigma);
    double alpha1 = std::atan2(std::cos(U2) * std::sin(lamda), (std::cos(U1) * std::sin(U2) - std::sin(U1) * std::cos(U2) * std::cos(lamda)));  // observer to target azimuth
    double alpha2 = std::atan2(std::cos(U1) * std::sin(lamda), (-std::sin(U1) * std::cos(U2) + std::cos(U1) * std::sin(U2) * std::cos(lamda)));  // target to observer azimuth
    return std::make_pair(downrange, rad2deg(alpha1));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl $0x1388, -0x24(%rbp)    # imm = 0x1388
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x372d0
movsd (%rax), %xmm0
movsd %xmm0, -0x148(%rbp)
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x372d0
movsd -0x148(%rbp), %xmm0
ucomisd (%rax), %xmm0
jne 0x36784
jp 0x36784
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x372d0
movsd (%rax), %xmm0
movsd %xmm0, -0x150(%rbp)
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x372d0
movsd -0x150(%rbp), %xmm0
ucomisd (%rax), %xmm0
jne 0x36784
jp 0x36784
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x37360
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x8(%rbp)
jmp 0x372bc
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x372d0
movsd (%rax), %xmm0
callq 0x7090
movsd %xmm0, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x372d0
movsd (%rax), %xmm0
callq 0x7090
movsd %xmm0, -0x48(%rbp)
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x372d0
movsd (%rax), %xmm0
callq 0x7090
movsd %xmm0, -0x50(%rbp)
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x372d0
movsd (%rax), %xmm0
callq 0x7090
movsd %xmm0, -0x58(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x2ee40
movsd 0x5ee32(%rip), %xmm0    # 0x95638
subsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x160(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x6280
movaps %xmm0, %xmm1
movsd -0x160(%rbp), %xmm0
mulsd %xmm1, %xmm0
callq 0x63b0
movsd %xmm0, -0xa0(%rbp)
movsd 0x5edf7(%rip), %xmm0    # 0x95638
subsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0x50(%rbp), %xmm0
callq 0x6280
movaps %xmm0, %xmm1
movsd -0x158(%rbp), %xmm0
mulsd %xmm1, %xmm0
callq 0x63b0
movsd %xmm0, -0xa8(%rbp)
movsd -0x58(%rbp), %xmm0
subsd -0x48(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xe8(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xf0(%rbp)
movl $0x0, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x36d82
movsd -0xa8(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x1f0(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x6120
movaps %xmm0, %xmm1
movsd -0x1f0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movl $0x2, %edi
callq 0x283f0
movsd %xmm0, -0x1c8(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x1d0(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x6120
movsd %xmm0, -0x1d8(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x6120
movsd %xmm0, -0x1e8(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x67f0
movaps %xmm0, %xmm1
movsd -0x1e8(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1e0(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x67f0
movsd -0x1e0(%rbp), %xmm1
movsd -0x1d8(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x1d0(%rbp), %xmm0
mulsd %xmm3, %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movl $0x2, %edi
callq 0x283f0
movaps %xmm0, %xmm1
movsd -0x1c8(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0xb8(%rbp), %xmm0
callq 0x6370
movsd %xmm0, -0xb8(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x6120
movsd %xmm0, -0x1a8(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x6120
movsd %xmm0, -0x1b0(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x1c0(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x67f0
movaps %xmm0, %xmm1
movsd -0x1c0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1b8(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x67f0
movsd -0x1b8(%rbp), %xmm1
movsd -0x1b0(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x1a8(%rbp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm1
callq 0x60a0
movsd %xmm0, -0xc8(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x1a0(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x67f0
movaps %xmm0, %xmm1
movsd -0x1a0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x198(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x6120
movaps %xmm0, %xmm1
movsd -0x198(%rbp), %xmm0
mulsd %xmm1, %xmm0
divsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0xd0(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movaps %xmm0, %xmm1
movsd 0x5ead7(%rip), %xmm0    # 0x95638
subsd %xmm1, %xmm0
callq 0x6370
movsd %xmm0, -0xd8(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x180(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x6120
movaps %xmm0, %xmm1
movsd 0x60ac6(%rip), %xmm0    # 0x97660
mulsd %xmm1, %xmm0
movsd %xmm0, -0x190(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x6120
movaps %xmm0, %xmm1
movsd -0x190(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x188(%rbp)
movsd -0xd8(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movsd -0x188(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x180(%rbp), %xmm0
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0x78(%rbp), %xmm0
movsd 0x60a4c(%rip), %xmm1    # 0x97658
divsd %xmm1, %xmm0
movsd %xmm0, -0x178(%rbp)
movsd -0xd8(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movaps %xmm0, %xmm1
movsd -0x178(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x168(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x170(%rbp)
movsd -0xd8(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movsd -0x170(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x168(%rbp), %xmm0
movsd 0x609d5(%rip), %xmm3    # 0x97650
mulsd %xmm3, %xmm2
movsd 0x5e9e1(%rip), %xmm3    # 0x95668
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
movsd 0x5e9d1(%rip), %xmm2    # 0x95668
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xe8(%rbp)
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movsd -0xb0(%rbp), %xmm1
movsd 0x5e971(%rip), %xmm0    # 0x95638
subsd -0xe8(%rbp), %xmm0
mulsd -0x78(%rbp), %xmm0
mulsd -0xd0(%rbp), %xmm0
movsd -0xc8(%rbp), %xmm3
movsd -0xe8(%rbp), %xmm2
mulsd -0xb8(%rbp), %xmm2
movsd -0xe0(%rbp), %xmm5
movsd -0xe8(%rbp), %xmm4
mulsd -0xc0(%rbp), %xmm4
movsd -0xe0(%rbp), %xmm6
addsd %xmm6, %xmm6
movsd 0x603b0(%rip), %xmm7    # 0x970d0
addsd %xmm7, %xmm6
mulsd %xmm6, %xmm4
addsd %xmm5, %xmm4
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0xf0(%rbp), %xmm0
subsd -0x100(%rbp), %xmm0
callq 0x373a0
movaps %xmm0, %xmm1
movsd 0x608e4(%rip), %xmm0    # 0x97648
ucomisd %xmm1, %xmm0
jbe 0x36d6c
jmp 0x36d82
jmp 0x36d6e
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x368ed
movsd -0xd8(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movsd %xmm0, -0x298(%rbp)
movsd -0x98(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movsd %xmm0, -0x2a0(%rbp)
movsd -0x70(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movsd -0x2a0(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x298(%rbp), %xmm0
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x290(%rbp)
movsd -0x70(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movaps %xmm0, %xmm1
movsd -0x290(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x108(%rbp)
movsd -0x108(%rbp), %xmm0
movsd 0x6089a(%rip), %xmm1    # 0x976b8
divsd %xmm1, %xmm0
movsd -0x108(%rbp), %xmm1
movsd -0x108(%rbp), %xmm2
movsd -0x108(%rbp), %xmm3
movsd 0x60866(%rip), %xmm4    # 0x976a8
mulsd %xmm4, %xmm3
movsd 0x60862(%rip), %xmm4    # 0x976b0
addsd %xmm4, %xmm3
mulsd %xmm3, %xmm2
movsd 0x60842(%rip), %xmm3    # 0x976a0
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
movsd 0x6082a(%rip), %xmm2    # 0x97698
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd 0x5e7ba(%rip), %xmm1    # 0x95638
addsd %xmm1, %xmm0
movsd %xmm0, -0x110(%rbp)
movsd -0x108(%rbp), %xmm0
movsd 0x607f6(%rip), %xmm1    # 0x97690
divsd %xmm1, %xmm0
movsd -0x108(%rbp), %xmm1
movsd -0x108(%rbp), %xmm2
movsd -0x108(%rbp), %xmm3
movsd 0x607c2(%rip), %xmm4    # 0x97680
mulsd %xmm4, %xmm3
movsd 0x607be(%rip), %xmm4    # 0x97688
addsd %xmm4, %xmm3
mulsd %xmm3, %xmm2
movsd 0x6079e(%rip), %xmm3    # 0x97678
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
movsd 0x60786(%rip), %xmm2    # 0x97670
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
movsd -0x118(%rbp), %xmm0
mulsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x258(%rbp)
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x260(%rbp)
movsd 0x60176(%rip), %xmm0    # 0x970a0
mulsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x268(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x278(%rbp)
movsd -0xe0(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
addsd %xmm0, %xmm0
movsd 0x60168(%rip), %xmm1    # 0x970d0
addsd %xmm1, %xmm0
movsd %xmm0, -0x270(%rbp)
movsd 0x606ec(%rip), %xmm0    # 0x97668
mulsd -0x118(%rbp), %xmm0
mulsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x288(%rbp)
movsd -0xb8(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movaps %xmm0, %xmm1
movsd -0x288(%rbp), %xmm0
movsd 0x5e6af(%rip), %xmm2    # 0x95668
mulsd %xmm2, %xmm1
movsd 0x6068b(%rip), %xmm2    # 0x97650
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x280(%rbp)
movsd -0xe0(%rbp), %xmm0
movl $0x2, %edi
callq 0x283f0
movsd -0x280(%rbp), %xmm4
movsd -0x278(%rbp), %xmm3
movsd -0x270(%rbp), %xmm5
movsd -0x268(%rbp), %xmm1
movsd -0x260(%rbp), %xmm2
movaps %xmm0, %xmm6
movsd -0x258(%rbp), %xmm0
movsd 0x5e646(%rip), %xmm7    # 0x95668
mulsd %xmm7, %xmm6
movsd 0x60622(%rip), %xmm7    # 0x97650
addsd %xmm7, %xmm6
mulsd %xmm6, %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm3
addsd %xmm4, %xmm3
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
movsd -0x70(%rbp), %xmm0
mulsd -0x110(%rbp), %xmm0
movsd -0xc8(%rbp), %xmm1
subsd -0x120(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x128(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x250(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x6120
movaps %xmm0, %xmm1
movsd -0x250(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x228(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x238(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x6120
movsd %xmm0, -0x230(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x6120
movsd %xmm0, -0x248(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x67f0
movaps %xmm0, %xmm1
movsd -0x248(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x240(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x67f0
movsd -0x240(%rbp), %xmm2
movsd -0x238(%rbp), %xmm1
movsd -0x230(%rbp), %xmm3
movaps %xmm0, %xmm4
movsd -0x228(%rbp), %xmm0
mulsd %xmm4, %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
callq 0x60a0
movsd %xmm0, -0x130(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x220(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x6120
movaps %xmm0, %xmm1
movsd -0x220(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1f8(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x6120
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x208(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x200(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0x67f0
movsd %xmm0, -0x218(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x6120
movaps %xmm0, %xmm1
movsd -0x218(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x210(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x67f0
movsd -0x210(%rbp), %xmm2
movsd -0x208(%rbp), %xmm1
movsd -0x200(%rbp), %xmm3
movaps %xmm0, %xmm4
movsd -0x1f8(%rbp), %xmm0
mulsd %xmm4, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
callq 0x60a0
movsd %xmm0, -0x138(%rbp)
movsd -0x130(%rbp), %xmm0
callq 0x70c0
movsd %xmm0, -0x140(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x373c0
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x8(%rbp)
movsd -0x10(%rbp), %xmm0
movsd -0x8(%rbp), %xmm1
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
nop