// File: sus304[P]ForRocket/src/dynamics/dynamics_6dof_programrate.cpp
// Function: forrocket::Dynamics6dofProgramRate::operator()(std::array<double, 14ul> const&, std::array<double, 14ul>&, double)
void forrocket::Dynamics6dofProgramRate::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.euler_angle = p_rocket->getAttitude();
    coordinate.setNED2Body(p_rocket->attitude.euler_angle);
    p_rocket->attitude.quaternion = coordinate.Quaternion(p_rocket->attitude.euler_angle);

    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->moment.thrust = ThrustMoment();
    // p_rocket->moment.aero_force = AeroForceMoment();
    // p_rocket->moment.aero_dumping = AeroDampingMoment();
    // p_rocket->moment.jet_dumping = JetDampingMoment();
    
    // // Calculate Angle Velocity
    // p_rocket->angular_acceleration = p_rocket->getInertiaTensor().inverse() * p_rocket->moment.Sum();

    // // Calculate Quaternion
    // p_rocket->quaternion_dot = 0.5 * QuaternionDiff();


    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] = 0.0;  // quatdot => quat
    dx[7] = 0.0;  // 
    dx[8] = 0.0;  // 
    dx[9] = 0.0;  // 
    dx[10] = 0.0;  // angular_acceleration => angular_velocity
    dx[11] = 0.0;  // 
    dx[12] = 0.0;  // 
    dx[13] = -p_rocket->engine.mdot_prop;  // massdot => mass_prop
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x780, %rsp            # imm = 0x780
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x6b8(%rbp)
leaq -0x2e8(%rbp), %rdi
movq %rdi, -0x6b0(%rbp)
callq 0x2c800
movq -0x6b8(%rbp), %rax
movq 0x10(%rax), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x34640
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x34640
movq -0x6b0(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x2d3e0
movq -0x10(%rbp), %rdi
callq 0x5aab0
movq %rax, -0x6a8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x18, %rax
movq %rax, -0x6a0(%rbp)
leaq -0x311(%rbp), %rdi
movq %rdi, -0x698(%rbp)
callq 0x7ac0
movq -0x6a8(%rbp), %rsi
movq -0x6a0(%rbp), %rdx
movq -0x698(%rbp), %rcx
leaq -0x310(%rbp), %rdi
callq 0x5aad0
jmp 0x6ec6f
leaq -0x310(%rbp), %rdi
callq 0x5ab50
movq %rax, -0x6c0(%rbp)
leaq -0x326(%rbp), %rdi
callq 0x5ab70
jmp 0x6ec90
movq -0x6c0(%rbp), %rsi
leaq -0x2f8(%rbp), %rdi
leaq -0x326(%rbp), %rdx
callq 0x5abb0
jmp 0x6ecac
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2a0, %rdi            # imm = 0x2A0
leaq -0x2f8(%rbp), %rsi
callq 0x5ac00
jmp 0x6eccc
leaq -0x310(%rbp), %rdi
callq 0x7760
leaq -0x311(%rbp), %rdi
callq 0x87a0
movq -0x6b8(%rbp), %rax
leaq -0x2a8(%rbp), %rdi
movq 0x8(%rax), %rsi
addq $0x2a0, %rsi            # imm = 0x2A0
callq 0x3e710
movq %rax, %rcx
movq -0x6b8(%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 -0x6b8(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x2b8, %rsi            # imm = 0x2B8
leaq -0x368(%rbp), %rdi
movq %rdi, -0x6f8(%rbp)
callq 0x2f760
movq -0x6f8(%rbp), %rdx
leaq -0x350(%rbp), %rdi
movq %rdi, -0x6f0(%rbp)
leaq -0x2e8(%rbp), %rsi
movq %rsi, -0x6e8(%rbp)
callq 0x2d910
movq -0x6f0(%rbp), %rsi
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2d0, %rdi            # imm = 0x2D0
callq 0x37c30
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x2d0, %rsi            # imm = 0x2D0
leaq -0x380(%rbp), %rdi
movq %rdi, -0x6e0(%rbp)
callq 0x2f760
movq -0x6e8(%rbp), %rdi
movq -0x6e0(%rbp), %rsi
callq 0x2d5e0
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x18, %rax
movq %rax, -0x6d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5aab0
addq $0x30, %rax
movq %rax, -0x6d0(%rbp)
leaq -0x3a9(%rbp), %rdi
movq %rdi, -0x6c8(%rbp)
callq 0x7ac0
movq -0x6d8(%rbp), %rsi
movq -0x6d0(%rbp), %rdx
movq -0x6c8(%rbp), %rcx
leaq -0x3a8(%rbp), %rdi
callq 0x5aad0
jmp 0x6ee32
leaq -0x3a8(%rbp), %rdi
callq 0x5ab50
movq %rax, -0x700(%rbp)
leaq -0x3ab(%rbp), %rdi
callq 0x5ab70
jmp 0x6ee53
movq -0x700(%rbp), %rsi
leaq -0x390(%rbp), %rdi
leaq -0x3ab(%rbp), %rdx
callq 0x5abb0
jmp 0x6ee6f
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
leaq -0x390(%rbp), %rsi
callq 0x5ac00
jmp 0x6ee8f
leaq -0x3a8(%rbp), %rdi
callq 0x7760
leaq -0x3a9(%rbp), %rdi
callq 0x87a0
movq -0x6b8(%rbp), %rax
leaq -0x2e8(%rbp), %rcx
addq $0x40, %rcx
movq %rcx, -0x720(%rbp)
movq 0x8(%rax), %rcx
addq $0x2e8, %rcx            # imm = 0x2E8
movq %rcx, -0x728(%rbp)
leaq -0x2e8(%rbp), %rdi
addq $0x40, %rdi
addq $0x240, %rdi            # imm = 0x240
movq 0x8(%rax), %rsi
addq $0x2a0, %rsi            # imm = 0x2A0
callq 0x3e710
movq -0x728(%rbp), %rsi
movq %rax, -0x408(%rbp)
movq %rdx, -0x400(%rbp)
leaq -0x3f8(%rbp), %rdi
leaq -0x408(%rbp), %rdx
callq 0x5ac80
movq -0x720(%rbp), %rsi
leaq -0x3d8(%rbp), %rdi
leaq -0x3f8(%rbp), %rdx
callq 0x5ac30
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x18, %rdi
leaq -0x3d8(%rbp), %rsi
callq 0x5acf0
movq -0x6b8(%rbp), %rax
leaq -0x2e8(%rbp), %rdi
addq $0x40, %rdi
addq $0x48, %rdi
movq 0x8(%rax), %rsi
addq $0x2e8, %rsi            # imm = 0x2E8
addq $0x18, %rsi
callq 0x3e710
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
movq %rcx, -0x418(%rbp)
movq %rdx, -0x410(%rbp)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x30, %rdi
leaq -0x418(%rbp), %rsi
callq 0x3e760
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x430(%rbp), %rdi
callq 0x52550
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x3d0, %rdi            # imm = 0x3D0
leaq -0x430(%rbp), %rsi
callq 0x37c30
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x3d0, %rsi            # imm = 0x3D0
leaq -0x448(%rbp), %rdi
callq 0x2f760
leaq -0x2e8(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x2cb30
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x3d0, %rsi            # imm = 0x3D0
leaq -0x488(%rbp), %rdi
callq 0x2f760
leaq -0x470(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
leaq -0x488(%rbp), %rdx
callq 0x2de40
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x3d0, %rdi            # imm = 0x3D0
addq $0x20, %rdi
leaq -0x470(%rbp), %rsi
callq 0x37ac0
movq -0x10(%rbp), %rdi
movl $0xd, %esi
callq 0x5ae60
movq %rax, %rcx
movq -0x6b8(%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, -0x490(%rbp)
movsd -0x490(%rbp), %xmm0
leaq -0x4b0(%rbp), %rdi
callq 0x35f30
leaq -0x4d0(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x35f30
xorps %xmm0, %xmm0
movsd %xmm0, -0x4f0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x4f8(%rbp)
movsd -0x490(%rbp), %xmm0
callq 0x4a4a0
movsd %xmm0, -0x500(%rbp)
leaq -0x4e8(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
leaq -0x4f8(%rbp), %rdx
leaq -0x500(%rbp), %rcx
callq 0x2f6d0
movq -0x6b8(%rbp), %rax
leaq -0x2e8(%rbp), %rcx
addq $0x40, %rcx
addq $0x90, %rcx
movq %rcx, -0x710(%rbp)
movq 0x8(%rax), %rcx
addq $0x2e8, %rcx            # imm = 0x2E8
addq $0x30, %rcx
movq %rcx, -0x718(%rbp)
movq 0x18(%rax), %rsi
movsd -0x490(%rbp), %xmm0
leaq -0x550(%rbp), %rdi
callq 0x364d0
movq -0x718(%rbp), %rsi
leaq -0x538(%rbp), %rdi
leaq -0x550(%rbp), %rdx
callq 0x66ce0
movq -0x710(%rbp), %rsi
leaq -0x520(%rbp), %rdi
leaq -0x538(%rbp), %rdx
callq 0x66c90
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
leaq -0x520(%rbp), %rsi
callq 0x66d50
movq -0x6b8(%rbp), %rax
movsd 0x2647c(%rip), %xmm0    # 0x95660
mulsd -0x4a0(%rbp), %xmm0
movsd %xmm0, -0x708(%rbp)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movl $0x2, %edi
callq 0x283f0
movq -0x6b8(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0x708(%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 -0x6b8(%rbp), %rax
divsd -0x498(%rbp), %xmm0
movq 0x8(%rax), %rcx
movsd %xmm0, 0x348(%rcx)
movq 0x8(%rax), %rsi
leaq -0x598(%rbp), %rdi
callq 0x522c0
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x220, %rdi            # imm = 0x220
leaq -0x598(%rbp), %rsi
callq 0x2fcb0
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x51d50
movq -0x6b8(%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 -0x6b8(%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 -0x6b8(%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 -0x6b8(%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 -0x6b8(%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 -0x6b8(%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 -0x6b8(%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 -0x6b8(%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 0x6f4a0
movq -0x6b8(%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 0x6f592
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
jmp 0x6f44c
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 0x6fa4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x320(%rbp)
movl %eax, -0x324(%rbp)
jmp 0x6f48f
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 0x6fa4a
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
movl $0x2, %esi
callq 0x52b00
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, -0x738(%rbp)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movaps %xmm0, %xmm1
movsd -0x738(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x66e0
movq -0x6b8(%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 -0x6b8(%rbp), %rax
movsd (%rcx), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
movsd %xmm0, -0x730(%rbp)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
addq $0x48, %rdi
callq 0x55fb0
movaps %xmm0, %xmm1
movsd -0x730(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x66e0
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rax
movsd %xmm0, 0x468(%rax)
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rsi
movsd -0x4a8(%rbp), %xmm0
leaq -0x5b0(%rbp), %rdi
callq 0x52090
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x388, %rdi            # imm = 0x388
leaq -0x5b0(%rbp), %rsi
callq 0x37c30
movq -0x6b8(%rbp), %rsi
movq 0x8(%rsi), %rdx
leaq -0x5c8(%rbp), %rdi
callq 0x550d0
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x388, %rdi            # imm = 0x388
addq $0x18, %rdi
leaq -0x5c8(%rbp), %rsi
callq 0x37c30
leaq -0x2e8(%rbp), %rdi
addq $0x40, %rdi
addq $0x90, %rdi
leaq -0x4e8(%rbp), %rsi
callq 0x3e710
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
movq %rcx, -0x600(%rbp)
movq %rdx, -0x5f8(%rbp)
movq 0x8(%rax), %rdi
addq $0x210, %rdi            # imm = 0x210
callq 0x3cdc0
movsd %xmm0, -0x608(%rbp)
leaq -0x5f0(%rbp), %rdi
leaq -0x600(%rbp), %rsi
leaq -0x608(%rbp), %rdx
callq 0x5ae90
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x388, %rdi            # imm = 0x388
addq $0x30, %rdi
leaq -0x5f0(%rbp), %rsi
callq 0x5af40
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x388, %rsi            # imm = 0x388
leaq -0x640(%rbp), %rdi
callq 0x3aa30
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x210, %rdi            # imm = 0x210
callq 0x3cdc0
movsd %xmm0, -0x648(%rbp)
leaq -0x628(%rbp), %rdi
leaq -0x640(%rbp), %rsi
leaq -0x648(%rbp), %rdx
callq 0x5af70
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
addq $0x18, %rdi
leaq -0x628(%rbp), %rsi
callq 0x5b020
movq -0x6b8(%rbp), %rax
leaq -0x2e8(%rbp), %rcx
addq $0x40, %rcx
addq $0x1b0, %rcx            # imm = 0x1B0
movq %rcx, -0x778(%rbp)
leaq -0x2e8(%rbp), %rcx
addq $0x40, %rcx
addq $0x168, %rcx            # imm = 0x168
movq %rcx, -0x780(%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 -0x780(%rbp), %rsi
movq %rax, -0x690(%rbp)
movq %rdx, -0x688(%rbp)
leaq -0x680(%rbp), %rdi
leaq -0x690(%rbp), %rdx
callq 0x5b0a0
movq -0x778(%rbp), %rsi
leaq -0x668(%rbp), %rdi
leaq -0x680(%rbp), %rdx
callq 0x5b050
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
leaq -0x668(%rbp), %rsi
callq 0x5b0f0
movq -0x6b8(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
xorl %eax, %eax
movl %eax, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x770(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5b120
movsd -0x770(%rbp), %xmm0
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
movl $0x1, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x768(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x5b120
movsd -0x768(%rbp), %xmm0
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
movl $0x2, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x760(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
callq 0x5b120
movsd -0x760(%rbp), %xmm0
movq %rax, %rcx
movq -0x6b8(%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, -0x758(%rbp)
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0x5b120
movsd -0x758(%rbp), %xmm0
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
movl $0x1, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x750(%rbp)
movq -0x18(%rbp), %rdi
movl $0x4, %esi
callq 0x5b120
movsd -0x750(%rbp), %xmm0
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rdi
addq $0x358, %rdi            # imm = 0x358
movl $0x2, %esi
callq 0x52b00
movsd (%rax), %xmm0
movsd %xmm0, -0x748(%rbp)
movq -0x18(%rbp), %rdi
movl $0x5, %esi
callq 0x5b120
movsd -0x748(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl $0x6, %esi
callq 0x5b120
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl $0x7, %esi
callq 0x5b120
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl $0x8, %esi
callq 0x5b120
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl $0x9, %esi
callq 0x5b120
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl $0xa, %esi
callq 0x5b120
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl $0xb, %esi
callq 0x5b120
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl $0xc, %esi
callq 0x5b120
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
xorps %xmm0, %xmm0
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, -0x740(%rbp)
movq -0x18(%rbp), %rdi
movl $0xd, %esi
callq 0x5b120
movsd -0x740(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x780, %rsp            # imm = 0x780
popq %rbp
retq
movq -0x320(%rbp), %rdi
callq 0x6760
nopw %cs:(%rax,%rax)