// File: /workspace/github_cpp_makefile_star2_O3/istellartech[P]OpenTsiolkovsky/src/rocket.cpp
// Function: CsvObserver::operator()(std::array<double, 14ul> const&, double)
void CsvObserver::operator()(const state& x, double t){
    posECI_ << x[1], x[2], x[3];
    velECI_ << x[4], x[5], x[6];

    dcmECI2ECEF_ = dcmECI2ECEF(t);
    posECEF_ = posECEF(dcmECI2ECEF_, posECI_);
    posLLH_ = posLLH(posECEF_);

    /*
    //    It does not calculate after the rocket falls to the ground
    if ( posLLH_[2] < 0) {
        if ((int)t % 10 == 0 && (int)(t*10) % 10 == 0 ){ // progress
            progress(t);
        }
        return;
    }
    */

    //    update rocket variables
    update_from_time_and_altitude(t, posLLH_[2]);

    //    transform coordinate
    dcmECEF2NED_ = dcmECEF2NED(posLLH_);
    dcmNED2ECEF_ = dcmECEF2NED_.transpose();
    dcmECI2NED_ = dcmECI2NED(dcmECEF2NED_, dcmECI2ECEF_);
    dcmNED2ECI_ = dcmECI2NED_.transpose();
    dcmECEF2NED_init_ = dcmECEF2NED(launch_pos_LLH);
    dcmECI2NED_init_ = dcmECI2NED(dcmECEF2NED_init_, dcmECI2ECEF(0.0));
    vel_ECEF_NEDframe_ = vel_ECEF_NEDframe(dcmECI2NED_, velECI_, posECI_);
    vel_wind_NEDframe_ = vel_wind_NEDframe(wind_speed, wind_direction);
    //    air = air.altitude(posLLH_[2]);
    if (air_density_file_exist){
        air = air.altitude_with_variation_table(posLLH_[2], air_density_mat);
    } else{
        air = air.altitude_with_variation(posLLH_[2], variation_ratio_of_air_density);
    }
    //    gravity term : gravity acceleration in the north direction is not considered
    gravityECI_ = gravityECI(posECI_);

    if (is_powered){  // ---- powered flight ----
        switch (power_flight_mode) {
            case _3DoF:
                power_flight_3dof(x,t);
                break;
            case _3DoF_with_delay:  // Unimplemented
                power_flight_3dof_with_delay(x, t);
                break;
            case _6DoF:  // Unimplemented
                power_flight_6dof(x, t);
                break;
            case _6DoF_aerodynamic_stable:  // Unimplemented
                power_flight_6dof_aerodynamic_stable(x, t);
                break;
            default:
                m_dot = 0;
                accECI_ << 0.0, 0.0, 0.0;
                break;
        }
    } else {  // ---- free flight ----
        switch (free_flight_mode) {
            case aerodynamic_stable:
                free_flight_aerodynamic_stable(x, t);
                break;
            case _3DoF_defined:
                free_flight_3dof_defined(x, t);
                break;
            case ballistic_flight:
                free_flight_ballistic(x, t);
                break;
            default:
                m_dot = 0;
                accECI_ << 0.0, 0.0, 0.0;
                break;
        }
    }

    // === following code is different from RocketStage::operator() ===
    accBODY_ = dcmECI2BODY_ * (accECI_ -  gravityECI_);
    downrange = distance_surface(launch_pos_LLH, posLLH_);
    Vector3d posECEF_ = dcmECI2ECEF_ * posECI_;
    Vector3d vel_ECEF_ECEFframe_ = dcmNED2ECEF_ * vel_ECEF_NEDframe_;
    posLLH_IIP_ = posLLH_IIP(posECEF_, vel_ECEF_ECEFframe_);
    kinematic_energy = 0.5 * x[0] * vel_ECEF_NEDframe_.norm() * vel_ECEF_NEDframe_.norm();
    gravity_vector = dcmECI2NED_ * gravityECI_;

    //   ==== Calculte loss velocisy ====
    if (thrust > 0.1 || is_separated == false){
        double vel_ECEF_NEDframe_XY = sqrt(vel_ECEF_NEDframe_[0] * vel_ECEF_NEDframe_[0] +
                                           vel_ECEF_NEDframe_[1] * vel_ECEF_NEDframe_[1]);
        double path_angle_rad = atan2(-vel_ECEF_NEDframe_[2], vel_ECEF_NEDframe_XY);
        loss_gravity = gravity_vector[2] * sin(path_angle_rad);
    } else {
        loss_gravity = 0;
    }
    if (thrust > 0.1){
        loss_thrust = air.pressure * nozzle_exhaust_area / x[0];
    } else {
        loss_thrust = 0;
    }
    loss_aerodynamics = force_axial / x[0];
    loss_total = loss_gravity + loss_aerodynamics + loss_thrust;

    // ==== OUTPUT to CSV ====
    // if rocket was already impacted on the earth, NOT OUTPUT.
    if ( posLLH_[2] > 0 && !flag_duplicate) {
        fout << t << "," << x[0] << "," << thrust << ",";
        fout.precision(8);
        fout << posLLH_[0] << "," << posLLH_[1] << "," << posLLH_[2] << ","
            << x[1] << "," << x[2] << "," << x[3] << ","
            << x[4] << "," << x[5] << "," << x[6] << ","
            << vel_ECEF_NEDframe_[0] << "," << vel_ECEF_NEDframe_[1] << ","
            << vel_ECEF_NEDframe_[2] << ","
            << accECI_[0] << "," << accECI_[1] << "," << accECI_[2] << ","
            << accBODY_[0] << "," << accBODY_[1] << "," << accBODY_[2] << ","
            << Isp << "," << mach_number << ","
            << rad2deg(azimuth) << "," << rad2deg(elevation) << "," << rad2deg(roll) << ","
            << rad2deg(angle_of_attack_[0]) << "," << rad2deg(angle_of_attack_[1]) << ","
            << rad2deg(angle_of_attack_[2]) << ","
            << dynamic_pressure << ","
            << force_air_vector_BODYframe[0] << "," << force_air_vector_BODYframe[1] << ","
            << force_air_vector_BODYframe[2] << "," << force_thrust_vector[0] << ","
            << force_thrust_vector[1] << "," << force_thrust_vector[2] << ","
            << rad2deg(gimbal_angle_pitch) << "," << rad2deg(gimbal_angle_yaw) << ","
            << wind_speed << "," << wind_direction << ","
            << downrange << "," << posLLH_IIP_[0] << "," << posLLH_IIP_[1] << ","
            << dcmBODY2ECI_(0, 0) << "," << dcmBODY2ECI_(0, 1) << "," << dcmBODY2ECI_(0, 2) << ","
            << dcmBODY2ECI_(1, 0) << "," << dcmBODY2ECI_(1, 1) << "," << dcmBODY2ECI_(1, 2) << ","
            << dcmBODY2ECI_(2, 0) << "," << dcmBODY2ECI_(2, 1) << "," << dcmBODY2ECI_(2, 2) << ","
            << int(velECI_.norm()) << "," << kinematic_energy << ","
            << loss_gravity << "," << loss_aerodynamics << "," << loss_thrust << ","
            << is_powered << "," << is_separated 
            << endl;
    }
    flag_duplicate = false;

    if ((int)t % 10 == 0 && (int)(t*10) % 10 == 0 ){ // progress
       progress(t);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x490, %rsp            # imm = 0x490
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x9c0(%rdi), %rax
leaq 0x40(%rsp), %rdi
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movl $0x1, %eax
movq %rax, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movsd 0x8(%rsi), %xmm0
movsd %xmm0, 0x9c0(%rbx)
addq $0x10, %rsi
callq 0x15520
leaq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x15520
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
cmpq $0x3, %rax
jne 0x1527a
cmpq $0x1, 0x50(%rsp)
jne 0x1527a
leaq 0x9d8(%rbx), %rax
leaq 0x40(%rsp), %rdi
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movl $0x1, %eax
movq %rax, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movsd 0x20(%r14), %xmm0
movsd %xmm0, 0x9d8(%rbx)
leaq 0x28(%r14), %rsi
callq 0x15520
leaq 0x30(%r14), %rsi
movq %rax, %rdi
callq 0x15520
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
cmpq $0x3, %rax
jne 0x1527a
cmpq $0x1, 0x50(%rsp)
jne 0x1527a
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x226c0
movaps (%r15), %xmm0
movaps %xmm0, 0xa20(%rbx)
movaps 0x10(%r15), %xmm1
movaps %xmm1, 0xa30(%rbx)
movaps 0x20(%r15), %xmm2
movaps %xmm2, 0xa40(%rbx)
movaps 0x30(%r15), %xmm3
movaps %xmm3, 0xa50(%rbx)
movsd 0x40(%r15), %xmm4
movsd %xmm4, 0xa60(%rbx)
leaq 0x400(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm1, 0x10(%rsi)
movaps %xmm2, 0x20(%rsi)
movaps %xmm3, 0x30(%rsi)
movsd %xmm4, 0x40(%rsi)
movaps 0x9c0(%rbx), %xmm0
leaq 0x2a0(%rsp), %rdx
movaps %xmm0, (%rdx)
movsd 0x9d0(%rbx), %xmm0
movsd %xmm0, 0x10(%rdx)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x22834
movaps (%r15), %xmm0
movups %xmm0, 0xa68(%rbx)
movsd 0x10(%r15), %xmm1
movsd %xmm1, 0xa78(%rbx)
leaq 0x280(%rsp), %rsi
movaps %xmm0, (%rsi)
movsd %xmm1, 0x10(%rsi)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x22920
movaps (%r15), %xmm0
movaps %xmm0, 0xa80(%rbx)
movsd 0x10(%r15), %xmm1
movsd %xmm1, 0xa90(%rbx)
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x11106
movaps 0xa80(%rbx), %xmm0
leaq 0x260(%rsp), %rsi
movaps %xmm0, (%rsi)
movsd 0xa90(%rbx), %xmm0
movsd %xmm0, 0x10(%rsi)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x22aad
movapd (%r15), %xmm0
movupd %xmm0, 0xa98(%rbx)
movapd 0x10(%r15), %xmm1
movupd %xmm1, 0xaa8(%rbx)
movapd 0x20(%r15), %xmm2
movupd %xmm2, 0xab8(%rbx)
movapd 0x30(%r15), %xmm3
movupd %xmm3, 0xac8(%rbx)
movsd 0x40(%r15), %xmm4
movsd %xmm4, 0xad8(%rbx)
movapd %xmm1, %xmm5
movsd %xmm0, %xmm5            # xmm5 = xmm0[0],xmm5[1]
movapd %xmm5, 0xae0(%rbx)
movapd %xmm0, %xmm5
movsd %xmm3, %xmm5            # xmm5 = xmm3[0],xmm5[1]
movapd %xmm5, 0xaf0(%rbx)
movapd %xmm3, %xmm5
movsd %xmm2, %xmm5            # xmm5 = xmm2[0],xmm5[1]
movapd %xmm5, 0xb00(%rbx)
movapd %xmm2, %xmm5
movsd %xmm1, %xmm5            # xmm5 = xmm1[0],xmm5[1]
movapd %xmm5, 0xb10(%rbx)
movsd %xmm4, 0xb20(%rbx)
leaq 0x3b0(%rsp), %rsi
movapd %xmm0, (%rsi)
movapd %xmm1, 0x10(%rsi)
movapd %xmm2, 0x20(%rsi)
movapd %xmm3, 0x30(%rsi)
movsd %xmm4, 0x40(%rsi)
movaps 0xa20(%rbx), %xmm0
leaq 0x360(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps 0xa30(%rbx), %xmm0
movaps %xmm0, 0x10(%rdx)
movaps 0xa40(%rbx), %xmm0
movaps %xmm0, 0x20(%rdx)
movaps 0xa50(%rbx), %xmm0
movaps %xmm0, 0x30(%rdx)
movsd 0xa60(%rbx), %xmm0
movsd %xmm0, 0x40(%rdx)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x22cf4
movapd (%r15), %xmm0
movupd %xmm0, 0xb28(%rbx)
movapd 0x10(%r15), %xmm1
movupd %xmm1, 0xb38(%rbx)
movapd 0x20(%r15), %xmm2
movupd %xmm2, 0xb48(%rbx)
movapd 0x30(%r15), %xmm3
movupd %xmm3, 0xb58(%rbx)
movsd 0x40(%r15), %xmm4
movsd %xmm4, 0xb68(%rbx)
movapd %xmm1, %xmm5
movsd %xmm0, %xmm5            # xmm5 = xmm0[0],xmm5[1]
movapd %xmm5, 0xb70(%rbx)
movsd %xmm3, %xmm0            # xmm0 = xmm3[0],xmm0[1]
movapd %xmm0, 0xb80(%rbx)
movsd %xmm2, %xmm3            # xmm3 = xmm2[0],xmm3[1]
movapd %xmm3, 0xb90(%rbx)
movsd %xmm1, %xmm2            # xmm2 = xmm1[0],xmm2[1]
movapd %xmm2, 0xba0(%rbx)
movsd %xmm4, 0xbb0(%rbx)
movaps 0x340(%rbx), %xmm0
leaq 0x240(%rsp), %rsi
movaps %xmm0, (%rsi)
movsd 0x350(%rbx), %xmm0
movsd %xmm0, 0x10(%rsi)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x22aad
movaps (%r15), %xmm0
movups %xmm0, 0xd68(%rbx)
movaps 0x10(%r15), %xmm1
movups %xmm1, 0xd78(%rbx)
movaps 0x20(%r15), %xmm2
movups %xmm2, 0xd88(%rbx)
movaps 0x30(%r15), %xmm3
movups %xmm3, 0xd98(%rbx)
movsd 0x40(%r15), %xmm4
movsd %xmm4, 0xda8(%rbx)
leaq 0x310(%rsp), %r15
movaps %xmm0, (%r15)
movaps %xmm1, 0x10(%r15)
movaps %xmm2, 0x20(%r15)
movaps %xmm3, 0x30(%r15)
movsd %xmm4, 0x40(%r15)
leaq 0x448(%rsp), %r12
xorps %xmm0, %xmm0
movq %r12, %rdi
callq 0x226c0
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x22cf4
movaps (%r13), %xmm0
movaps %xmm0, 0xdb0(%rbx)
movaps 0x10(%r13), %xmm0
movaps %xmm0, 0xdc0(%rbx)
movaps 0x20(%r13), %xmm0
movaps %xmm0, 0xdd0(%rbx)
movaps 0x30(%r13), %xmm0
movaps %xmm0, 0xde0(%rbx)
movsd 0x40(%r13), %xmm0
movsd %xmm0, 0xdf0(%rbx)
movups 0xb28(%rbx), %xmm0
leaq 0x2c0(%rsp), %rsi
movaps %xmm0, (%rsi)
movups 0xb38(%rbx), %xmm0
movaps %xmm0, 0x10(%rsi)
movups 0xb48(%rbx), %xmm0
movaps %xmm0, 0x20(%rsi)
movups 0xb58(%rbx), %xmm0
movaps %xmm0, 0x30(%rsi)
movsd 0xb68(%rbx), %xmm0
movsd %xmm0, 0x40(%rsi)
movups 0x9d8(%rbx), %xmm0
leaq 0x220(%rsp), %rdx
movaps %xmm0, (%rdx)
movsd 0x9e8(%rbx), %xmm0
movsd %xmm0, 0x10(%rdx)
movaps 0x9c0(%rbx), %xmm0
leaq 0x200(%rsp), %rcx
movaps %xmm0, (%rcx)
movsd 0x9d0(%rbx), %xmm0
movsd %xmm0, 0x10(%rcx)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x22e72
movaps (%r15), %xmm0
movups %xmm0, 0xbb8(%rbx)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0xbc8(%rbx)
movsd 0x918(%rbx), %xmm0
movsd 0x920(%rbx), %xmm1
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x230da
movaps (%r15), %xmm0
movaps %xmm0, 0xbd0(%rbx)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0xbe0(%rbx)
leaq 0x7f8(%rbx), %r15
cmpb $0x1, 0x290(%rbx)
jne 0x142fd
movsd 0xa90(%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x2b8(%rbx), %r12
movq 0x2c0(%rbx), %rdx
movq 0x2c8(%rbx), %rcx
movq %rcx, %rsi
imulq %rdx, %rsi
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x69e0
movq %r13, %rdi
movq %r12, %rsi
callq 0x6a4e
leaq 0x40(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %r15, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x622a
leaq 0x40(%rsp), %rsi
movl $0x120, %edx            # imm = 0x120
movq %r15, %rdi
callq 0x52f0
movq 0x28(%rsp), %rdi
callq 0x5460
jmp 0x1432d
movsd 0xa90(%rbx), %xmm0
movsd 0x270(%rbx), %xmm1
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x5e9c
movl $0x120, %edx            # imm = 0x120
movq %r15, %rdi
movq %r12, %rsi
callq 0x52f0
movaps 0x9c0(%rbx), %xmm0
leaq 0x1e0(%rsp), %rsi
movaps %xmm0, (%rsi)
movsd 0x9d0(%rbx), %xmm0
movsd %xmm0, 0x10(%rsi)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x21930
movaps (%r15), %xmm0
movups %xmm0, 0xe58(%rbx)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0xe68(%rbx)
cmpb $0x1, 0x254(%rbx)
jne 0x143b1
movl 0x278(%rbx), %eax
cmpq $0x3, %rax
movsd 0x8(%rsp), %xmm0
ja 0x144ac
leaq 0x11c78(%rip), %rcx     # 0x26010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11a4e
jmp 0x1451d
movl 0x27c(%rbx), %eax
cmpl $0x2, %eax
movsd 0x8(%rsp), %xmm0
je 0x143eb
cmpl $0x1, %eax
je 0x143db
testl %eax, %eax
jne 0x143f8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1268a
jmp 0x1451d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12bf2
jmp 0x1451d
movq %rbx, %rdi
callq 0x134b0
jmp 0x1451d
xorl %eax, %eax
movq %rax, 0x790(%rbx)
leaq 0x9f0(%rbx), %rcx
leaq 0x40(%rsp), %rdi
movq %rcx, (%rdi)
movq %rax, 0x8(%rdi)
movl $0x1, %ecx
movq %rcx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %rax, 0x9f0(%rbx)
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
callq 0x15520
leaq 0x18(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x15520
jmp 0x144fd
leaq 0x230(%rbx), %rdi
movq 0x238(%rbx), %rdx
leaq 0x125c4(%rip), %rcx     # 0x26a27
movl $0xa, %r8d
jmp 0x144a3
leaq 0x230(%rbx), %rdi
movq 0x238(%rbx), %rdx
leaq 0x125b2(%rip), %rcx     # 0x26a32
movl $0x16, %r8d
jmp 0x144a3
leaq 0x230(%rbx), %rdi
movq 0x238(%rbx), %rdx
leaq 0x12579(%rip), %rcx     # 0x26a16
movl $0x10, %r8d
xorl %esi, %esi
callq 0x5540
jmp 0x1451d
xorl %eax, %eax
movq %rax, 0x790(%rbx)
leaq 0x9f0(%rbx), %rcx
leaq 0x40(%rsp), %rdi
movq %rcx, (%rdi)
movq %rax, 0x8(%rdi)
movl $0x1, %ecx
movq %rcx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %rax, 0x9f0(%rbx)
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
callq 0x15520
leaq 0x18(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x15520
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
cmpq $0x3, %rax
jne 0x1527a
cmpq $0x1, 0x50(%rsp)
jne 0x1527a
movsd 0x9f0(%rbx), %xmm2
subsd 0xe58(%rbx), %xmm2
movsd 0x9f8(%rbx), %xmm0
subsd 0xe60(%rbx), %xmm0
movsd 0xa00(%rbx), %xmm1
subsd 0xe68(%rbx), %xmm1
movsd 0xce8(%rbx), %xmm3
mulsd %xmm2, %xmm3
movsd 0xd00(%rbx), %xmm4
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd 0xd18(%rbx), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm4, %xmm3
movupd 0xcd8(%rbx), %xmm4
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm4, %xmm2
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0xcf0(%rbx), %xmm0
addpd %xmm2, %xmm0
movupd 0xd08(%rbx), %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm2, %xmm1
addpd %xmm0, %xmm1
movupd %xmm1, 0xa08(%rbx)
movsd %xmm3, 0xa18(%rbx)
movaps 0x340(%rbx), %xmm0
leaq 0x1c0(%rsp), %rdi
movaps %xmm0, (%rdi)
movsd 0x350(%rbx), %xmm0
movsd %xmm0, 0x10(%rdi)
movaps 0xa80(%rbx), %xmm0
leaq 0x1a0(%rsp), %rsi
movaps %xmm0, (%rsi)
movsd 0xa90(%rbx), %xmm0
movsd %xmm0, 0x10(%rsi)
callq 0x241c7
movsd %xmm0, 0xe88(%rbx)
movapd 0xa20(%rbx), %xmm4
movsd 0x9c0(%rbx), %xmm9
movsd 0x9c8(%rbx), %xmm3
movsd 0x9d0(%rbx), %xmm1
movsd 0xa30(%rbx), %xmm0
mulsd %xmm9, %xmm0
movsd 0xa48(%rbx), %xmm2
mulsd %xmm3, %xmm2
addsd %xmm0, %xmm2
movsd 0xa60(%rbx), %xmm7
mulsd %xmm1, %xmm7
addsd %xmm2, %xmm7
movapd 0xae0(%rbx), %xmm5
movsd 0xbb8(%rbx), %xmm8
movsd 0xbc0(%rbx), %xmm2
movsd 0xbc8(%rbx), %xmm0
movsd 0xaf0(%rbx), %xmm6
mulsd %xmm8, %xmm6
movsd 0xb08(%rbx), %xmm10
mulsd %xmm2, %xmm10
addsd %xmm6, %xmm10
movsd 0xb20(%rbx), %xmm6
mulsd %xmm0, %xmm6
addsd %xmm10, %xmm6
unpcklpd %xmm9, %xmm4            # xmm4 = xmm4[0],xmm9[0]
movhpd 0xa28(%rbx), %xmm9      # xmm9 = xmm9[0],mem[0]
unpcklpd %xmm8, %xmm5            # xmm5 = xmm5[0],xmm8[0]
movhpd 0xae8(%rbx), %xmm8      # xmm8 = xmm8[0],mem[0]
mulpd %xmm9, %xmm4
movupd 0xa38(%rbx), %xmm9
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm9, %xmm3
addpd %xmm4, %xmm3
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd 0xa50(%rbx), %xmm1
addpd %xmm3, %xmm1
leaq 0x180(%rsp), %rsi
movapd %xmm1, (%rsi)
movsd %xmm7, 0x10(%rsi)
mulpd %xmm8, %xmm5
movupd 0xaf8(%rbx), %xmm1
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm1, %xmm2
addpd %xmm5, %xmm2
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0xb10(%rbx), %xmm0
addpd %xmm2, %xmm0
leaq 0x160(%rsp), %rdx
movapd %xmm0, (%rdx)
movsd %xmm6, 0x10(%rdx)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x244ce
movaps (%r15), %xmm0
movaps %xmm0, 0xe70(%rbx)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0xe80(%rbx)
movsd (%r14), %xmm1
mulsd 0x115b3(%rip), %xmm1    # 0x25d20
movsd 0xbb8(%rbx), %xmm2
mulsd %xmm2, %xmm2
movsd 0xbc0(%rbx), %xmm3
mulsd %xmm3, %xmm3
movsd 0xbc8(%rbx), %xmm0
movapd %xmm0, %xmm4
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
addsd %xmm2, %xmm4
sqrtsd %xmm4, %xmm4
mulsd %xmm4, %xmm1
mulsd %xmm4, %xmm1
movsd %xmm1, 0x960(%rbx)
movupd 0xb28(%rbx), %xmm5
movsd 0xe58(%rbx), %xmm6
movsd 0xe60(%rbx), %xmm1
movsd 0xe68(%rbx), %xmm4
movsd 0xb38(%rbx), %xmm7
mulsd %xmm6, %xmm7
movsd 0xb50(%rbx), %xmm8
mulsd %xmm1, %xmm8
addsd %xmm7, %xmm8
movsd 0xb68(%rbx), %xmm7
mulsd %xmm4, %xmm7
unpcklpd %xmm6, %xmm5            # xmm5 = xmm5[0],xmm6[0]
movhpd 0xb30(%rbx), %xmm6      # xmm6 = xmm6[0],mem[0]
addsd %xmm8, %xmm7
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd 0xb40(%rbx), %xmm1
mulpd %xmm5, %xmm6
addpd %xmm6, %xmm1
movupd 0xb58(%rbx), %xmm5
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm5, %xmm4
addpd %xmm1, %xmm4
movapd %xmm4, 0xe40(%rbx)
movsd %xmm7, 0xe50(%rbx)
movsd 0x760(%rbx), %xmm4
ucomisd 0x1150b(%rip), %xmm4    # 0x25d60
ja 0x14864
xorpd %xmm1, %xmm1
cmpb $0x0, 0x255(%rbx)
jne 0x148a1
addsd %xmm3, %xmm2
xorps %xmm1, %xmm1
sqrtsd %xmm2, %xmm1
xorpd 0x116d9(%rip), %xmm0    # 0x25f50
callq 0x50a0
movsd 0xe50(%rbx), %xmm1
movsd %xmm1, 0x10(%rsp)
callq 0x50f0
movapd %xmm0, %xmm1
mulsd 0x10(%rsp), %xmm1
movsd 0x760(%rbx), %xmm4
movsd %xmm1, 0x998(%rbx)
xorpd %xmm0, %xmm0
ucomisd 0x114ab(%rip), %xmm4    # 0x25d60
xorpd %xmm2, %xmm2
jbe 0x148d0
movsd 0x908(%rbx), %xmm2
mulsd 0x798(%rbx), %xmm2
divsd (%r14), %xmm2
movsd %xmm2, 0x9a8(%rbx)
movsd 0x7e0(%rbx), %xmm3
divsd (%r14), %xmm3
movsd %xmm3, 0x9a0(%rbx)
addsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, 0x9b8(%rbx)
movsd 0xa90(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x151fe
cmpb $0x0, 0x1dbe2(%rip)     # 0x324f8
jne 0x151fe
leaq 0xec0(%rbx), %r12
movq %r12, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x5570
movq %rax, %r13
leaq 0x1214b(%rip), %r15     # 0x26a86
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd (%r14), %xmm0
movq %r13, %rdi
callq 0x5570
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x760(%rbx), %xmm0
movq %r13, %rdi
callq 0x5570
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movq 0xec0(%rbx), %rax
movq -0x18(%rax), %rax
movq $0x8, 0xec8(%rbx,%rax)
movsd 0xa80(%rbx), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xa88(%rbx), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xa90(%rbx), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x8(%r14), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x10(%r14), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x18(%r14), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x20(%r14), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x28(%r14), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x30(%r14), %xmm0
movq %r12, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xbb8(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xbc0(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xbc8(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x9f0(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x9f8(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xa00(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xa08(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xa10(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xa18(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x780(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x958(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x928(%rbx), %xmm0
mulsd 0x110ae(%rip), %xmm0    # 0x25d10
divsd 0x110ae(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x930(%rbx), %xmm0
mulsd 0x1107b(%rip), %xmm0    # 0x25d10
divsd 0x1107b(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x938(%rbx), %xmm0
mulsd 0x11048(%rip), %xmm0    # 0x25d10
divsd 0x11048(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xc30(%rbx), %xmm0
mulsd 0x11015(%rip), %xmm0    # 0x25d10
divsd 0x11015(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xc38(%rbx), %xmm0
mulsd 0x10fe2(%rip), %xmm0    # 0x25d10
divsd 0x10fe2(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xc40(%rbx), %xmm0
mulsd 0x10faf(%rip), %xmm0    # 0x25d10
divsd 0x10faf(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x7d8(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xdf8(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe00(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe08(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe28(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe30(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe38(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x968(%rbx), %xmm0
mulsd 0x10e87(%rip), %xmm0    # 0x25d10
divsd 0x10e87(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x10e5c(%rip), %xmm0    # 0x25d10
mulsd 0x970(%rbx), %xmm0
divsd 0x10e54(%rip), %xmm0    # 0x25d18
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x918(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x920(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe88(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe70(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xe78(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd20(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd38(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd50(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd28(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd40(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd58(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd30(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd48(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0xd60(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movupd 0x9d8(%rbx), %xmm0
mulpd %xmm0, %xmm0
movsd 0x9e8(%rbx), %xmm1
mulsd %xmm1, %xmm1
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm1, %xmm2
addsd %xmm0, %xmm2
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
cvttsd2si %xmm0, %esi
movq %r14, %rdi
callq 0x5630
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x960(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x998(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x9a0(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movsd 0x9a8(%rbx), %xmm0
movq %r14, %rdi
callq 0x5570
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movzbl 0x254(%rbx), %esi
movq %r14, %rdi
callq 0x55c0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5430
movzbl 0x255(%rbx), %esi
movq %r14, %rdi
callq 0x55c0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5370
movsbl %al, %esi
movq %r14, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x5270
movb $0x0, 0x1d2f3(%rip)     # 0x324f8
movsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %eax
imull $0xcccccccd, %eax, %ecx # imm = 0xCCCCCCCD
movl $0x19999998, %eax       # imm = 0x19999998
addl %eax, %ecx
rorl %ecx
cmpl %eax, %ecx
ja 0x15248
movsd 0x10b3e(%rip), %xmm1    # 0x25d68
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
imull $0xcccccccd, %ecx, %ecx # imm = 0xCCCCCCCD
addl %eax, %ecx
rorl %ecx
cmpl %eax, %ecx
ja 0x15248
movq %rbx, %rdi
callq 0x13c74
addq $0x490, %rsp            # imm = 0x490
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x1525f
jmp 0x1525f
jmp 0x1525f
movq %rax, %rbx
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
cmpq $0x3, %rax
jne 0x1527a
cmpq $0x1, 0x50(%rsp)
je 0x152e5
leaq 0x12053(%rip), %rdi     # 0x272d4
leaq 0x120d3(%rip), %rsi     # 0x2735b
leaq 0x120f9(%rip), %rcx     # 0x27388
movl $0x6a, %edx
callq 0x5250
jmp 0x1529b
movq %rax, %rbx
movq 0x28(%rsp), %rdi
callq 0x5460
jmp 0x152e5
movq %rax, %rbx
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
cmpq $0x3, %rax
jne 0x152c5
cmpq $0x1, 0x50(%rsp)
je 0x152e5
callq 0x57c6
movq %rax, %rbx
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
cmpq $0x3, %rax
jne 0x152ed
cmpq $0x1, 0x50(%rsp)
jne 0x152ed
movq %rbx, %rdi
callq 0x5650
callq 0x57a8