// File: sus304[P]ForRocket/src/dynamics/dynamics_6dof_aero.cpp
// Function: forrocket::Dynamics6dofAero::operator()(std::array<double, 14ul> const&, std::array<double, 14ul>&, double)
void forrocket::Dynamics6dofAero::operator()(const state& x, state& dx, const double t) {
    Coordinate coordinate;

    // Countup Time
    p_clock->SyncSolverTime(t);
    p_rocket->burn_clock.SyncSolverTime(t);

    // Update Flight Infomation
    coordinate.setECI2ECEF(t);

    p_rocket->position.ECI = Eigen::Map<Eigen::Vector3d>(std::vector<double>(x.begin()+0, x.begin()+3).data());
    p_rocket->position.ECEF = coordinate.dcm.ECI2ECEF * p_rocket->position.ECI;
    p_rocket->position.LLH = coordinate.ECEF2LLH(p_rocket->position.ECEF);

    coordinate.setECEF2NED(p_rocket->position.LLH);

    p_rocket->velocity.ECI = Eigen::Map<Eigen::Vector3d>(std::vector<double>(x.begin()+3, x.begin()+6).data());
    p_rocket->velocity.ECEF = coordinate.dcm.ECI2ECEF * (p_rocket->velocity.ECI - coordinate.dcm.EarthRotate * p_rocket->position.ECI);
    p_rocket->velocity.NED = coordinate.dcm.ECEF2NED * p_rocket->velocity.ECEF;

    p_rocket->attitude.quaternion = Eigen::Map<Eigen::Vector4d>(std::vector<double>(x.begin()+6, x.begin()+10).data()).normalized();

    coordinate.setNED2Body(p_rocket->attitude.quaternion);
    
    p_rocket->attitude.euler_angle = coordinate.EulerAngle();

    p_rocket->angular_velocity = Eigen::Map<Eigen::Vector3d>(std::vector<double>(x.begin()+10, x.begin()+13).data());

    p_rocket->mass.propellant = x[13];


    // Update Environment
    double altitude = p_rocket->position.LLH[2];
    EnvironmentAir air(altitude);
    EnvironmentAir air_sea_level(0.0);
    Eigen::Vector3d gravity_NED(0.0, 0.0, gravity(altitude));

    // Update Airspeed
    p_rocket->velocity.air_body = coordinate.dcm.NED2body * (p_rocket->velocity.NED - p_wind->getNED(altitude));
    p_rocket->dynamic_pressure = 0.5 * air.density * std::pow(p_rocket->velocity.air_body.norm(), 2);
    p_rocket->velocity.mach_number = p_rocket->velocity.air_body.norm() / air.speed_of_sound;

    // Update time and mach parameter
    p_rocket->inertia_tensor = p_rocket->getInertiaTensor();

    p_rocket->length_CG = p_rocket->getLengthCG();    
    p_rocket->length_CP = p_rocket->getLengthCP(p_rocket->velocity.mach_number);
    p_rocket->CA = p_rocket->getCA(p_rocket->velocity.mach_number);
    p_rocket->CNa = p_rocket->getCNa(p_rocket->velocity.mach_number);
    p_rocket->Cld = p_rocket->getCld(p_rocket->velocity.mach_number);
    p_rocket->Clp = p_rocket->getClp(p_rocket->velocity.mach_number);
    p_rocket->Cmq = p_rocket->getCmq(p_rocket->velocity.mach_number);
    p_rocket->Cnr = p_rocket->getCnr(p_rocket->velocity.mach_number);

    // Calculate AoA
    // p_rocket->angle_of_attack = std::atan2(p_rocket->velocity.air_body[2], p_rocket->velocity.air_body[0]);
    if (p_rocket->velocity.air_body.norm() <= 0.0) {
        p_rocket->angle_of_attack = 0.0;
        p_rocket->sideslip_angle = 0.0;
    } else {
        p_rocket->angle_of_attack = std::asin(p_rocket->velocity.air_body[2] / p_rocket->velocity.air_body.norm());
        p_rocket->sideslip_angle = std::asin(-p_rocket->velocity.air_body[1] / p_rocket->velocity.air_body.norm());
    }

    // Calculate Force
    p_rocket->force.thrust = p_rocket->getThrust(air.pressure);
    p_rocket->force.aero = AeroForce(p_rocket);
    p_rocket->force.gravity = (coordinate.dcm.NED2body * gravity_NED) * p_rocket->mass.Sum();

    // Calculate Acceleration
    p_rocket->acceleration.body = p_rocket->force.Sum() / p_rocket->mass.Sum();
    p_rocket->acceleration.ECI = coordinate.dcm.ECEF2ECI * (coordinate.dcm.NED2ECEF * (coordinate.dcm.body2NED * p_rocket->acceleration.body));

    // Calculate Moment
    p_rocket->moment.gyro = GyroEffectMoment(p_rocket);
    p_rocket->moment.thrust = ThrustMoment(p_rocket);
    p_rocket->moment.aero_force = AeroForceMoment(p_rocket);
    p_rocket->moment.aero_dumping = AeroDampingMoment(p_rocket);
    p_rocket->moment.jet_dumping = JetDampingMoment(p_rocket);
    
    // Calculate Angle Velocity
    p_rocket->angular_acceleration = p_rocket->inertia_tensor.inverse() * p_rocket->moment.Sum();

    // Calculate Quaternion
    p_rocket->quaternion_dot = 0.5 * (QuaternionDiff(p_rocket) * p_rocket->attitude.quaternion);


    dx[0] = p_rocket->velocity.ECI[0];  // vel_ECI => pos_ECI
    dx[1] = p_rocket->velocity.ECI[1];  // 
    dx[2] = p_rocket->velocity.ECI[2];  // 
    dx[3] = p_rocket->acceleration.ECI[0];  // acc_ECI => vel_ECI
    dx[4] = p_rocket->acceleration.ECI[1];  // 
    dx[5] = p_rocket->acceleration.ECI[2];  // 
    dx[6] = p_rocket->quaternion_dot[0];  // quatdot => quat
    dx[7] = p_rocket->quaternion_dot[1];  // 
    dx[8] = p_rocket->quaternion_dot[2];  // 
    dx[9] = p_rocket->quaternion_dot[3];  // 
    dx[10] = p_rocket->angular_acceleration[0];  // angular_acceleration => angular_velocity
    dx[11] = p_rocket->angular_acceleration[1];  // 
    dx[12] = p_rocket->angular_acceleration[2];  // 
    dx[13] = -p_rocket->engine.mdot_prop;  // massdot => mass_prop
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x9e0, %rsp            # imm = 0x9E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x878(%rbp)
leaq -0x2e8(%rbp), %rdi
movq %rdi, -0x870(%rbp)
callq 0x2c800
movq -0x878(%rbp), %rax
movq 0x10(%rax), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x34640
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x34640
movq -0x870(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x2d3e0
movq -0x10(%rbp), %rdi
callq 0x5aab0
movq %rax, -0x868(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x18, %rax
movq %rax, -0x860(%rbp)
leaq -0x311(%rbp), %rdi
movq %rdi, -0x858(%rbp)
callq 0x7ac0
movq -0x868(%rbp), %rsi
movq -0x860(%rbp), %rdx
movq -0x858(%rbp), %rcx
leaq -0x310(%rbp), %rdi
callq 0x5aad0
jmp 0x6594f
leaq -0x310(%rbp), %rdi
callq 0x5ab50
movq %rax, -0x880(%rbp)
leaq -0x326(%rbp), %rdi
callq 0x5ab70
jmp 0x65970
movq -0x880(%rbp), %rsi
leaq -0x2f8(%rbp), %rdi
leaq -0x326(%rbp), %rdx
callq 0x5abb0
jmp 0x6598c
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2a0, %rdi            # imm = 0x2A0
leaq -0x2f8(%rbp), %rsi
callq 0x5ac00
jmp 0x659ac
leaq -0x310(%rbp), %rdi
callq 0x7760
leaq -0x311(%rbp), %rdi
callq 0x87a0
movq -0x878(%rbp), %rax
leaq -0x2a8(%rbp), %rdi
movq 0x8(%rax), %rsi
addq $0x2a0, %rsi            # imm = 0x2A0
callq 0x3e710
movq %rax, %rcx
movq -0x878(%rbp), %rax
movq %rcx, -0x338(%rbp)
movq %rdx, -0x330(%rbp)
movq 0x8(%rax), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
leaq -0x338(%rbp), %rsi
callq 0x3e760
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x2b8, %rsi            # imm = 0x2B8
leaq -0x368(%rbp), %rdi
movq %rdi, -0x8b8(%rbp)
callq 0x2f760
movq -0x8b8(%rbp), %rdx
leaq -0x350(%rbp), %rdi
movq %rdi, -0x8b0(%rbp)
leaq -0x2e8(%rbp), %rsi
movq %rsi, -0x8a8(%rbp)
callq 0x2d910
movq -0x8b0(%rbp), %rsi
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2d0, %rdi            # imm = 0x2D0
callq 0x37c30
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x2d0, %rsi            # imm = 0x2D0
leaq -0x380(%rbp), %rdi
movq %rdi, -0x8a0(%rbp)
callq 0x2f760
movq -0x8a8(%rbp), %rdi
movq -0x8a0(%rbp), %rsi
callq 0x2d5e0
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x18, %rax
movq %rax, -0x898(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x30, %rax
movq %rax, -0x890(%rbp)
leaq -0x3a9(%rbp), %rdi
movq %rdi, -0x888(%rbp)
callq 0x7ac0
movq -0x898(%rbp), %rsi
movq -0x890(%rbp), %rdx
movq -0x888(%rbp), %rcx
leaq -0x3a8(%rbp), %rdi
callq 0x5aad0
jmp 0x65b12
leaq -0x3a8(%rbp), %rdi
callq 0x5ab50
movq %rax, -0x8c0(%rbp)
leaq -0x3ab(%rbp), %rdi
callq 0x5ab70
jmp 0x65b33
movq -0x8c0(%rbp), %rsi
leaq -0x390(%rbp), %rdi
leaq -0x3ab(%rbp), %rdx
callq 0x5abb0
jmp 0x65b4f
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
leaq -0x390(%rbp), %rsi
callq 0x5ac00
jmp 0x65b6f
leaq -0x3a8(%rbp), %rdi
callq 0x7760
leaq -0x3a9(%rbp), %rdi
callq 0x87a0
movq -0x878(%rbp), %rax
leaq -0x2a8(%rbp), %rcx
movq %rcx, -0x8f0(%rbp)
movq 0x8(%rax), %rsi
movq %rsi, %rax
addq $0x2e8, %rax            # imm = 0x2E8
movq %rax, -0x8f8(%rbp)
leaq -0x68(%rbp), %rdi
addq $0x2a0, %rsi            # imm = 0x2A0
callq 0x3e710
movq -0x8f8(%rbp), %rsi
movq %rax, -0x408(%rbp)
movq %rdx, -0x400(%rbp)
leaq -0x3f8(%rbp), %rdi
movq %rdi, -0x8e8(%rbp)
leaq -0x408(%rbp), %rdx
callq 0x5ac80
movq -0x8f0(%rbp), %rsi
movq -0x8e8(%rbp), %rdx
leaq -0x3d8(%rbp), %rdi
movq %rdi, -0x8e0(%rbp)
callq 0x5ac30
movq -0x8e0(%rbp), %rsi
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x300, %rdi            # imm = 0x300
callq 0x5acf0
movq -0x878(%rbp), %rax
leaq -0x260(%rbp), %rdi
movq 0x8(%rax), %rsi
addq $0x300, %rsi            # imm = 0x300
callq 0x3e710
movq %rax, %rcx
movq -0x878(%rbp), %rax
movq %rcx, -0x418(%rbp)
movq %rdx, -0x410(%rbp)
movq 0x8(%rax), %rdi
addq $0x318, %rdi            # imm = 0x318
leaq -0x418(%rbp), %rsi
callq 0x3e760
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x30, %rax
movq %rax, -0x8d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x50, %rax
movq %rax, -0x8d0(%rbp)
leaq -0x469(%rbp), %rdi
movq %rdi, -0x8c8(%rbp)
callq 0x7ac0
movq -0x8d8(%rbp), %rsi
movq -0x8d0(%rbp), %rdx
movq -0x8c8(%rbp), %rcx
leaq -0x468(%rbp), %rdi
callq 0x5aad0
jmp 0x65cd9
leaq -0x468(%rbp), %rdi
callq 0x5ab50
movq %rax, -0x900(%rbp)
leaq -0x46b(%rbp), %rdi
callq 0x5ab70
jmp 0x65cfa
movq -0x900(%rbp), %rsi
leaq -0x450(%rbp), %rdi
leaq -0x46b(%rbp), %rdx
callq 0x5ad20
jmp 0x65d16
leaq -0x440(%rbp), %rdi
leaq -0x450(%rbp), %rsi
callq 0x5ad70
jmp 0x65d2b
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x3f0, %rdi            # imm = 0x3F0
leaq -0x440(%rbp), %rsi
callq 0x37c00
jmp 0x65d4b
leaq -0x468(%rbp), %rdi
callq 0x7760
leaq -0x469(%rbp), %rdi
callq 0x87a0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x3f0, %rsi            # imm = 0x3F0
leaq -0x490(%rbp), %rdi
movq %rdi, -0x930(%rbp)
callq 0x38da0
movq -0x930(%rbp), %rsi
leaq -0x2e8(%rbp), %rdi
movq %rdi, -0x928(%rbp)
callq 0x2d040
movq -0x928(%rbp), %rsi
leaq -0x4a8(%rbp), %rdi
movq %rdi, -0x920(%rbp)
callq 0x2ecc0
movq -0x878(%rbp), %rax
movq -0x920(%rbp), %rsi
movq 0x8(%rax), %rdi
addq $0x3d0, %rdi            # imm = 0x3D0
callq 0x37c30
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x50, %rax
movq %rax, -0x918(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x68, %rax
movq %rax, -0x910(%rbp)
leaq -0x4d1(%rbp), %rdi
movq %rdi, -0x908(%rbp)
callq 0x7ac0
movq -0x918(%rbp), %rsi
movq -0x910(%rbp), %rdx
movq -0x908(%rbp), %rcx
leaq -0x4d0(%rbp), %rdi
callq 0x5aad0
jmp 0x65e38
leaq -0x4d0(%rbp), %rdi
callq 0x5ab50
movq %rax, -0x938(%rbp)
leaq -0x4d3(%rbp), %rdi
callq 0x5ab70
jmp 0x65e59
movq -0x938(%rbp), %rsi
leaq -0x4b8(%rbp), %rdi
leaq -0x4d3(%rbp), %rdx
callq 0x5abb0
jmp 0x65e75
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x430, %rdi            # imm = 0x430
leaq -0x4b8(%rbp), %rsi
callq 0x5ac00
jmp 0x65e95
leaq -0x4d0(%rbp), %rdi
callq 0x7760
leaq -0x4d1(%rbp), %rdi
callq 0x87a0
movq -0x10(%rbp), %rdi
movl $0xd, %esi
callq 0x5ae60
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd (%rcx), %xmm0
movq 0x8(%rax), %rcx
movsd %xmm0, 0x218(%rcx)
movq 0x8(%rax), %rdi
addq $0x2a0, %rdi            # imm = 0x2A0
addq $0x30, %rdi
movl $0x2, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x4e0(%rbp)
movsd -0x4e0(%rbp), %xmm0
leaq -0x500(%rbp), %rdi
callq 0x35f30
leaq -0x520(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x35f30
xorps %xmm0, %xmm0
movsd %xmm0, -0x540(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x548(%rbp)
movsd -0x4e0(%rbp), %xmm0
callq 0x4a4a0
movsd %xmm0, -0x550(%rbp)
leaq -0x538(%rbp), %rdi
leaq -0x540(%rbp), %rsi
leaq -0x548(%rbp), %rdx
leaq -0x550(%rbp), %rcx
callq 0x2f6d0
movq -0x878(%rbp), %rax
leaq -0x2e8(%rbp), %rcx
addq $0x40, %rcx
addq $0x90, %rcx
movq %rcx, -0x948(%rbp)
movq 0x8(%rax), %rcx
addq $0x2e8, %rcx            # imm = 0x2E8
addq $0x30, %rcx
movq %rcx, -0x950(%rbp)
movq 0x18(%rax), %rsi
movsd -0x4e0(%rbp), %xmm0
leaq -0x5a0(%rbp), %rdi
callq 0x364d0
movq -0x950(%rbp), %rsi
leaq -0x588(%rbp), %rdi
leaq -0x5a0(%rbp), %rdx
callq 0x66ce0
movq -0x948(%rbp), %rsi
leaq -0x570(%rbp), %rdi
leaq -0x588(%rbp), %rdx
callq 0x66c90
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
leaq -0x570(%rbp), %rsi
callq 0x66d50
movq -0x878(%rbp), %rax
movsd 0x2f644(%rip), %xmm0    # 0x95660
mulsd -0x4f0(%rbp), %xmm0
movsd %xmm0, -0x940(%rbp)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movl $0x2, %edi
callq 0x283f0
movq -0x878(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0x940(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq 0x8(%rax), %rcx
movsd %xmm0, 0x350(%rcx)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movq -0x878(%rbp), %rax
divsd -0x4e8(%rbp), %xmm0
movq 0x8(%rax), %rcx
movsd %xmm0, 0x348(%rcx)
movq 0x8(%rax), %rsi
leaq -0x5e8(%rbp), %rdi
callq 0x522c0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x220, %rdi            # imm = 0x220
leaq -0x5e8(%rbp), %rsi
callq 0x2fcb0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x51d50
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x200(%rcx)
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movsd 0x348(%rax), %xmm0
callq 0x51da0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x208(%rcx)
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movsd 0x348(%rax), %xmm0
callq 0x51df0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x268(%rcx)
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movsd 0x348(%rax), %xmm0
callq 0x51e70
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x270(%rcx)
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movsd 0x348(%rax), %xmm0
callq 0x51ec0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x278(%rcx)
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movsd 0x348(%rax), %xmm0
callq 0x51f10
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x280(%rcx)
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movsd 0x348(%rax), %xmm0
callq 0x51f90
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x288(%rcx)
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movsd 0x348(%rax), %xmm0
callq 0x52010
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x290(%rcx)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x6635e
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, 0x460(%rcx)
movq 0x8(%rax), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x468(%rax)
jmp 0x66450
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
jmp 0x66284
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x7760
leaq -0x311(%rbp), %rdi
callq 0x87a0
jmp 0x66c7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
jmp 0x662c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x7760
leaq -0x3a9(%rbp), %rdi
callq 0x87a0
jmp 0x66c7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
jmp 0x6630a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x7760
leaq -0x469(%rbp), %rdi
callq 0x87a0
jmp 0x66c7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
jmp 0x6634d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
leaq -0x4d0(%rbp), %rdi
callq 0x7760
leaq -0x4d1(%rbp), %rdi
callq 0x87a0
jmp 0x66c7f
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
movl $0x2, %esi
callq 0x52b00
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, -0x960(%rbp)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movaps %xmm0, %xmm1
movsd -0x960(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x66e0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rcx
movsd %xmm0, 0x460(%rcx)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
movl $0x1, %esi
callq 0x52b00
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd (%rcx), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
movsd %xmm0, -0x958(%rbp)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movaps %xmm0, %xmm1
movsd -0x958(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x66e0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rax
movsd %xmm0, 0x468(%rax)
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rsi
movsd -0x4f8(%rbp), %xmm0
leaq -0x600(%rbp), %rdi
callq 0x52090
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x388, %rdi            # imm = 0x388
leaq -0x600(%rbp), %rsi
callq 0x37c30
movq -0x878(%rbp), %rsi
movq 0x8(%rsi), %rdx
leaq -0x618(%rbp), %rdi
callq 0x550d0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x388, %rdi            # imm = 0x388
addq $0x18, %rdi
leaq -0x618(%rbp), %rsi
callq 0x37c30
leaq -0x2e8(%rbp), %rdi
addq $0x40, %rdi
addq $0x90, %rdi
leaq -0x538(%rbp), %rsi
callq 0x3e710
movq %rax, %rcx
movq -0x878(%rbp), %rax
movq %rcx, -0x650(%rbp)
movq %rdx, -0x648(%rbp)
movq 0x8(%rax), %rdi
addq $0x210, %rdi            # imm = 0x210
callq 0x3cdc0
movsd %xmm0, -0x658(%rbp)
leaq -0x640(%rbp), %rdi
leaq -0x650(%rbp), %rsi
leaq -0x658(%rbp), %rdx
callq 0x5ae90
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x388, %rdi            # imm = 0x388
addq $0x30, %rdi
leaq -0x640(%rbp), %rsi
callq 0x5af40
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x388, %rsi            # imm = 0x388
leaq -0x690(%rbp), %rdi
callq 0x3aa30
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x210, %rdi            # imm = 0x210
callq 0x3cdc0
movsd %xmm0, -0x698(%rbp)
leaq -0x678(%rbp), %rdi
leaq -0x690(%rbp), %rsi
leaq -0x698(%rbp), %rdx
callq 0x5af70
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
addq $0x18, %rdi
leaq -0x678(%rbp), %rsi
callq 0x5b020
movq -0x878(%rbp), %rax
leaq -0x2e8(%rbp), %rcx
addq $0x40, %rcx
addq $0x1b0, %rcx            # imm = 0x1B0
movq %rcx, -0x9d8(%rbp)
leaq -0x2e8(%rbp), %rcx
addq $0x40, %rcx
addq $0x168, %rcx            # imm = 0x168
movq %rcx, -0x9e0(%rbp)
leaq -0x2e8(%rbp), %rdi
addq $0x40, %rdi
addq $0x120, %rdi            # imm = 0x120
movq 0x8(%rax), %rsi
addq $0x358, %rsi            # imm = 0x358
addq $0x18, %rsi
callq 0x3e710
movq -0x9e0(%rbp), %rsi
movq %rax, -0x6e0(%rbp)
movq %rdx, -0x6d8(%rbp)
leaq -0x6d0(%rbp), %rdi
leaq -0x6e0(%rbp), %rdx
callq 0x5b0a0
movq -0x9d8(%rbp), %rsi
leaq -0x6b8(%rbp), %rdi
leaq -0x6d0(%rbp), %rdx
callq 0x5b050
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
leaq -0x6b8(%rbp), %rsi
callq 0x5b0f0
movq -0x878(%rbp), %rsi
movq 0x8(%rsi), %rdx
leaq -0x6f8(%rbp), %rdi
callq 0x55230
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x470, %rdi            # imm = 0x470
leaq -0x6f8(%rbp), %rsi
callq 0x37c30
movq -0x878(%rbp), %rsi
movq 0x8(%rsi), %rdx
leaq -0x710(%rbp), %rdi
callq 0x55320
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x470, %rdi            # imm = 0x470
addq $0x18, %rdi
leaq -0x710(%rbp), %rsi
callq 0x37c30
movq -0x878(%rbp), %rsi
movq 0x8(%rsi), %rdx
leaq -0x728(%rbp), %rdi
callq 0x553c0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x470, %rdi            # imm = 0x470
addq $0x30, %rdi
leaq -0x728(%rbp), %rsi
callq 0x37c30
movq -0x878(%rbp), %rsi
movq 0x8(%rsi), %rdx
leaq -0x740(%rbp), %rdi
callq 0x554d0
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x470, %rdi            # imm = 0x470
addq $0x48, %rdi
leaq -0x740(%rbp), %rsi
callq 0x37c30
movq -0x878(%rbp), %rsi
movq 0x8(%rsi), %rdx
leaq -0x758(%rbp), %rdi
callq 0x55660
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x470, %rdi            # imm = 0x470
addq $0x60, %rdi
leaq -0x758(%rbp), %rsi
callq 0x37c30
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x220, %rdi            # imm = 0x220
callq 0x66d80
movq %rax, %rcx
movq -0x878(%rbp), %rax
movq %rcx, -0x770(%rbp)
movq 0x8(%rax), %rsi
addq $0x470, %rsi            # imm = 0x470
leaq -0x788(%rbp), %rdi
callq 0x3d130
leaq -0x770(%rbp), %rdi
leaq -0x788(%rbp), %rsi
callq 0x66e00
movq %rax, %rcx
movq -0x878(%rbp), %rax
movq %rcx, -0x768(%rbp)
movq %rdx, -0x760(%rbp)
movq 0x8(%rax), %rdi
addq $0x448, %rdi            # imm = 0x448
leaq -0x768(%rbp), %rsi
callq 0x66e50
movq -0x878(%rbp), %rsi
movsd 0x2ee2f(%rip), %xmm0    # 0x95660
movsd %xmm0, -0x7c0(%rbp)
movq 0x8(%rsi), %rdx
leaq -0x850(%rbp), %rdi
callq 0x55710
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x3d0, %rsi            # imm = 0x3D0
addq $0x20, %rsi
leaq -0x850(%rbp), %rdi
callq 0x66f20
movq %rax, -0x7d0(%rbp)
movq %rdx, -0x7c8(%rbp)
leaq -0x7b8(%rbp), %rdi
leaq -0x7c0(%rbp), %rsi
leaq -0x7d0(%rbp), %rdx
callq 0x66e80
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x410, %rdi            # imm = 0x410
leaq -0x7b8(%rbp), %rsi
callq 0x66f70
movq -0x878(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
xorl %eax, %eax
movl %eax, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x9d0(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5b120
movsd -0x9d0(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
movl $0x1, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x9c8(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x5b120
movsd -0x9c8(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
movl $0x2, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x9c0(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
callq 0x5b120
movsd -0x9c0(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
xorl %eax, %eax
movl %eax, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x9b8(%rbp)
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0x5b120
movsd -0x9b8(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
movl $0x1, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x9b0(%rbp)
movq -0x18(%rbp), %rdi
movl $0x4, %esi
callq 0x5b120
movsd -0x9b0(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
movl $0x2, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x9a8(%rbp)
movq -0x18(%rbp), %rdi
movl $0x5, %esi
callq 0x5b120
movsd -0x9a8(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x410, %rdi            # imm = 0x410
xorl %eax, %eax
movl %eax, %esi
callq 0x66fa0
movsd (%rax), %xmm0
movsd %xmm0, -0x9a0(%rbp)
movq -0x18(%rbp), %rdi
movl $0x6, %esi
callq 0x5b120
movsd -0x9a0(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x410, %rdi            # imm = 0x410
movl $0x1, %esi
callq 0x66fa0
movsd (%rax), %xmm0
movsd %xmm0, -0x998(%rbp)
movq -0x18(%rbp), %rdi
movl $0x7, %esi
callq 0x5b120
movsd -0x998(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x410, %rdi            # imm = 0x410
movl $0x2, %esi
callq 0x66fa0
movsd (%rax), %xmm0
movsd %xmm0, -0x990(%rbp)
movq -0x18(%rbp), %rdi
movl $0x8, %esi
callq 0x5b120
movsd -0x990(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x410, %rdi            # imm = 0x410
movl $0x3, %esi
callq 0x66fa0
movsd (%rax), %xmm0
movsd %xmm0, -0x988(%rbp)
movq -0x18(%rbp), %rdi
movl $0x9, %esi
callq 0x5b120
movsd -0x988(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x448, %rdi            # imm = 0x448
xorl %eax, %eax
movl %eax, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x980(%rbp)
movq -0x18(%rbp), %rdi
movl $0xa, %esi
callq 0x5b120
movsd -0x980(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x448, %rdi            # imm = 0x448
movl $0x1, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x978(%rbp)
movq -0x18(%rbp), %rdi
movl $0xb, %esi
callq 0x5b120
movsd -0x978(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x448, %rdi            # imm = 0x448
movl $0x2, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x970(%rbp)
movq -0x18(%rbp), %rdi
movl $0xc, %esi
callq 0x5b120
movsd -0x970(%rbp), %xmm0
movq %rax, %rcx
movq -0x878(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rax
movsd 0x60(%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x968(%rbp)
movq -0x18(%rbp), %rdi
movl $0xd, %esi
callq 0x5b120
movsd -0x968(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x9e0, %rsp            # imm = 0x9E0
popq %rbp
retq
movq -0x320(%rbp), %rdi
callq 0x6760
nopl (%rax,%rax)