// File: /workspace/github_cpp_makefile_star2_O3/istellartech[P]OpenTsiolkovsky/src/rocket.cpp
// Function: RocketStage::free_flight_3dof_defined(std::array<double, 14ul> const&, double)
void RocketStage::free_flight_3dof_defined(const RocketStage::state& x, double t){
    flight_mode = "free_3dof";
    // dcmNED2BODY_ = dcmNED2BODY(azimuth, elevation, roll);
    Matrix3d dcmNAVI2BODY_ = this->quatNAVI2BODY(t).toRotationMatrix();
    Matrix3d dcmNED2NAVI_ = dcmNED2BODY(azimuth_target, elevation_target, roll_target);
    dcmNED2BODY_ = dcmNAVI2BODY_ * dcmNED2NAVI_;
    Vector3d azelro = azimuth_elevation_roll(dcmNED2BODY_);
    elevation = azelro[1];
    azimuth = ((deg2rad(90.0) - elevation_target < 1e-9) && (deg2rad(90.0) - elevation < 1e-9))? azimuth_target : azelro[0];
    roll = ((deg2rad(90.0) - elevation_target < 1e-9) && (deg2rad(90.0) - elevation < 1e-9))? roll_target : azelro[2];
    vel_AIR_BODYframe_ = vel_AIR_BODYframe(dcmNED2BODY_, vel_ECEF_NEDframe_, vel_wind_NEDframe_);
    angle_of_attack_ = angle_of_attack(vel_AIR_BODYframe_);
    dcmECI2BODY_ = dcmECI2BODY(dcmNED2BODY_, dcmECI2NED_);
    dcmBODY2ECI_ = dcmECI2BODY_.transpose();

    //    thrust term
    force_thrust_vector << 0.0, 0.0, 0.0;
    //    aerodynamics term
    vel_AIR_BODYframe_abs = vel_AIR_BODYframe_.norm();
    mach_number = vel_AIR_BODYframe_abs / air.airspeed;
    update_from_mach_number();
    dynamic_pressure = 0.5 * air.density * vel_AIR_BODYframe_abs * vel_AIR_BODYframe_abs;
    force_axial        = CA       * dynamic_pressure * body_area;
    force_normal_yaw   = CN_yaw   * dynamic_pressure * body_area;
    force_normal_pitch = CN_pitch * dynamic_pressure * body_area;
    force_air_vector_BODYframe << - force_axial, - force_normal_yaw, - force_normal_pitch;
    //    dv/dt
    accECI_ = 1/x[0] * (dcmBODY2ECI_ * (force_thrust_vector + force_air_vector_BODYframe))
            + gravityECI_;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x300, %rsp            # imm = 0x300
movsd %xmm0, (%rsp)
movq %rsi, %r14
movq %rdi, %rbx
addq $0x230, %rdi            # imm = 0x230
movq 0x238(%rbx), %rdx
leaq 0x13e3c(%rip), %rcx     # 0x26a5a
movl $0x9, %r8d
xorl %esi, %esi
callq 0x5540
leaq 0x170(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movsd (%rsp), %xmm0
callq 0x13b04
movsd 0x10(%r15), %xmm3
movapd (%r15), %xmm1
movapd %xmm1, %xmm4
unpcklpd %xmm3, %xmm4            # xmm4 = xmm4[0],xmm3[0]
addpd %xmm4, %xmm4
movsd 0x18(%r15), %xmm5
movapd %xmm4, %xmm2
movhpd 0x130dc(%rip), %xmm2    # xmm2 = xmm2[0],mem[0]
mulpd %xmm1, %xmm2
movapd %xmm1, %xmm0
movapd %xmm1, %xmm8
mulpd %xmm2, %xmm0
movapd %xmm0, %xmm1
shufpd $0x1, %xmm5, %xmm0      # xmm0 = xmm0[1],xmm5[0]
movapd %xmm5, %xmm6
unpcklpd %xmm5, %xmm6            # xmm6 = xmm6[0],xmm5[0]
mulpd %xmm4, %xmm6
movapd %xmm4, %xmm7
unpckhpd %xmm4, %xmm7            # xmm7 = xmm7[1],xmm4[1]
movapd %xmm8, %xmm5
mulsd %xmm7, %xmm5
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
shufpd $0x1, %xmm8, %xmm8      # xmm8 = xmm8[1,0]
mulpd %xmm4, %xmm8
mulsd %xmm3, %xmm7
addsd %xmm7, %xmm1
movapd %xmm8, %xmm3
addpd %xmm6, %xmm3
movapd %xmm3, %xmm4
movapd %xmm3, %xmm9
movapd %xmm3, 0x80(%rsp)
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
movapd %xmm4, 0xd0(%rsp)
addsd %xmm2, %xmm7
movsd 0x1237e(%rip), %xmm3    # 0x25070
subsd %xmm7, %xmm3
movapd %xmm3, 0x70(%rsp)
subpd %xmm6, %xmm8
movapd %xmm8, 0x90(%rsp)
movapd %xmm2, %xmm3
addpd %xmm0, %xmm3
mulpd %xmm2, %xmm0
shufpd $0x2, %xmm0, %xmm3      # xmm3 = xmm3[0],xmm0[1]
movapd 0x1329c(%rip), %xmm2    # 0x25fc0
movsd %xmm5, %xmm2            # xmm2 = xmm5[0],xmm2[1]
movapd %xmm2, %xmm4
movapd 0x1329c(%rip), %xmm6    # 0x25fd0
unpcklpd %xmm5, %xmm6            # xmm6 = xmm6[0],xmm5[0]
movapd %xmm6, %xmm2
addpd %xmm0, %xmm6
movapd %xmm6, 0xf0(%rsp)
shufpd $0x1, %xmm1, %xmm0      # xmm0 = xmm0[1],xmm1[0]
subpd %xmm0, %xmm4
movapd %xmm4, 0xc0(%rsp)
movapd %xmm8, %xmm0
movsd %xmm9, %xmm0            # xmm0 = xmm9[0],xmm0[1]
movapd %xmm0, (%rsp)
subpd %xmm3, %xmm2
movapd %xmm2, 0x100(%rsp)
movsd %xmm2, %xmm6            # xmm6 = xmm2[0],xmm6[1]
movapd %xmm6, 0xe0(%rsp)
movsd 0x940(%rbx), %xmm0
movsd 0x948(%rbx), %xmm1
movsd 0x950(%rbx), %xmm2
leaq 0x170(%rsp), %r15
movq %r15, %rdi
callq 0x23304
movapd (%r15), %xmm3
movupd 0x8(%r15), %xmm2
movsd 0x18(%r15), %xmm7
movsd 0x20(%r15), %xmm4
movsd 0x28(%r15), %xmm6
movapd 0xd0(%rsp), %xmm1
mulsd %xmm7, %xmm1
movapd 0x70(%rsp), %xmm0
mulsd %xmm4, %xmm0
addsd %xmm1, %xmm0
movapd 0x90(%rsp), %xmm1
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
movsd 0x30(%r15), %xmm14
movapd %xmm3, %xmm5
unpcklpd %xmm7, %xmm5            # xmm5 = xmm5[0],xmm7[0]
unpcklpd %xmm14, %xmm7           # xmm7 = xmm7[0],xmm14[0]
movapd 0xc0(%rsp), %xmm13
mulpd %xmm13, %xmm7
movapd %xmm2, %xmm8
unpcklpd %xmm4, %xmm8            # xmm8 = xmm8[0],xmm4[0]
movapd %xmm4, %xmm11
movsd 0x38(%r15), %xmm4
unpcklpd %xmm4, %xmm11           # xmm11 = xmm11[0],xmm4[0]
mulpd (%rsp), %xmm11
addpd %xmm7, %xmm11
movapd 0x10(%r15), %xmm7
movapd %xmm7, %xmm10
unpcklpd %xmm6, %xmm10           # xmm10 = xmm10[0],xmm6[0]
movapd %xmm6, %xmm9
movsd 0x40(%r15), %xmm6
unpcklpd %xmm6, %xmm9            # xmm9 = xmm9[0],xmm6[0]
movapd 0xe0(%rsp), %xmm15
mulpd %xmm15, %xmm9
addpd %xmm11, %xmm9
movapd %xmm13, %xmm11
unpckhpd 0x80(%rsp), %xmm11      # xmm11 = xmm11[1],mem[1]
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm11, %xmm3
movapd 0x90(%rsp), %xmm12
movapd %xmm12, %xmm11
movapd 0x70(%rsp), %xmm0
shufpd $0x1, %xmm0, %xmm11     # xmm11 = xmm11[1],xmm0[0]
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm11, %xmm2
addpd %xmm3, %xmm2
mulpd (%rsp), %xmm8
mulpd %xmm13, %xmm5
addpd %xmm5, %xmm8
movapd 0xf0(%rsp), %xmm5
shufpd $0x1, %xmm12, %xmm5     # xmm5 = xmm5[1],xmm12[0]
unpcklpd %xmm7, %xmm7            # xmm7 = xmm7[0,0]
mulpd %xmm5, %xmm7
addpd %xmm2, %xmm7
mulpd %xmm15, %xmm10
addpd %xmm8, %xmm10
movapd %xmm10, 0xca0(%rbx)
movapd %xmm7, 0xc90(%rbx)
movsd %xmm1, 0xcb0(%rbx)
movupd %xmm9, 0xcb8(%rbx)
leaq 0x2b0(%rsp), %rsi
movapd %xmm7, (%rsi)
movapd %xmm10, 0x10(%rsi)
movsd %xmm1, 0x20(%rsi)
movupd %xmm9, 0x28(%rsi)
movapd 0x80(%rsp), %xmm1
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
shufpd $0x1, %xmm13, %xmm1     # xmm1 = xmm1[1],xmm13[0]
unpcklpd %xmm14, %xmm14          # xmm14 = xmm14[0,0]
mulpd %xmm1, %xmm14
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm0, %xmm4
addpd %xmm14, %xmm4
movapd %xmm12, %xmm0
unpcklpd 0x100(%rsp), %xmm0      # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm6, %xmm6            # xmm6 = xmm6[0,0]
mulpd %xmm0, %xmm6
addpd %xmm4, %xmm6
movupd %xmm6, 0xcc8(%rbx)
movupd %xmm6, 0x38(%rsi)
leaq 0xa8(%rsp), %r15
movq %r15, %rdi
callq 0x23725
movsd 0x8(%r15), %xmm0
movsd %xmm0, 0x930(%rbx)
movsd 0x12db5(%rip), %xmm1    # 0x25d50
movapd %xmm1, %xmm3
subsd 0x948(%rbx), %xmm3
movsd 0x12da9(%rip), %xmm2    # 0x25d58
ucomisd %xmm3, %xmm2
jbe 0x12fd8
subsd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jbe 0x12fd8
leaq 0x950(%rbx), %rax
movsd 0x940(%rbx), %xmm0
movsd %xmm0, 0x928(%rbx)
jmp 0x12ff1
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x928(%rbx)
leaq 0xb8(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x938(%rbx)
movaps 0xc90(%rbx), %xmm0
leaq 0x260(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps 0xca0(%rbx), %xmm0
movaps %xmm0, 0x10(%rsi)
movaps 0xcb0(%rbx), %xmm0
movaps %xmm0, 0x20(%rsi)
movaps 0xcc0(%rbx), %xmm0
movaps %xmm0, 0x30(%rsi)
movsd 0xcd0(%rbx), %xmm0
movsd %xmm0, 0x40(%rsi)
movups 0xbb8(%rbx), %xmm0
leaq 0x150(%rsp), %rdx
movaps %xmm0, (%rdx)
movsd 0xbc8(%rbx), %xmm0
movsd %xmm0, 0x10(%rdx)
movaps 0xbd0(%rbx), %xmm0
leaq 0x130(%rsp), %rcx
movaps %xmm0, (%rcx)
movsd 0xbe0(%rbx), %xmm0
movsd %xmm0, 0x10(%rcx)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x2314c
movaps (%r15), %xmm0
movups %xmm0, 0xbe8(%rbx)
movsd 0x10(%r15), %xmm1
movsd %xmm1, 0xbf8(%rbx)
leaq 0x110(%rsp), %rsi
movaps %xmm0, (%rsi)
movsd %xmm1, 0x10(%rsi)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x231c6
movaps (%r15), %xmm0
movaps %xmm0, 0xc30(%rbx)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0xc40(%rbx)
movaps 0xc90(%rbx), %xmm0
leaq 0x210(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps 0xca0(%rbx), %xmm0
movaps %xmm0, 0x10(%rsi)
movaps 0xcb0(%rbx), %xmm0
movaps %xmm0, 0x20(%rsi)
movaps 0xcc0(%rbx), %xmm0
movaps %xmm0, 0x30(%rsi)
movsd 0xcd0(%rbx), %xmm0
movsd %xmm0, 0x40(%rsi)
movups 0xb28(%rbx), %xmm0
leaq 0x1c0(%rsp), %rdx
movaps %xmm0, (%rdx)
movups 0xb38(%rbx), %xmm0
movaps %xmm0, 0x10(%rdx)
movups 0xb48(%rbx), %xmm0
movaps %xmm0, 0x20(%rdx)
movups 0xb58(%rbx), %xmm0
movaps %xmm0, 0x30(%rdx)
movsd 0xb68(%rbx), %xmm0
movsd %xmm0, 0x40(%rdx)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x2389b
movapd (%r15), %xmm0
movupd %xmm0, 0xcd8(%rbx)
movapd 0x10(%r15), %xmm1
movupd %xmm1, 0xce8(%rbx)
movapd 0x20(%r15), %xmm2
movupd %xmm2, 0xcf8(%rbx)
movapd 0x30(%r15), %xmm3
movupd %xmm3, 0xd08(%rbx)
movsd 0x40(%r15), %xmm4
movsd %xmm4, 0xd18(%rbx)
movapd %xmm1, %xmm5
movsd %xmm0, %xmm5            # xmm5 = xmm0[0],xmm5[1]
movapd %xmm5, 0xd20(%rbx)
movsd %xmm3, %xmm0            # xmm0 = xmm3[0],xmm0[1]
movapd %xmm0, 0xd30(%rbx)
movsd %xmm2, %xmm3            # xmm3 = xmm2[0],xmm3[1]
movapd %xmm3, 0xd40(%rbx)
movsd %xmm1, %xmm2            # xmm2 = xmm1[0],xmm2[1]
movapd %xmm2, 0xd50(%rbx)
movsd %xmm4, 0xd60(%rbx)
leaq 0xe28(%rbx), %rax
movq %rax, (%r15)
xorl %eax, %eax
movq %rax, 0x8(%r15)
movl $0x1, %ecx
movq %rcx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %rax, 0xe28(%rbx)
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x15520
leaq 0x10(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x15520
movq 0x38(%rsp), %rax
addq 0x28(%rsp), %rax
cmpq $0x3, %rax
jne 0x13491
cmpq $0x1, 0x30(%rsp)
jne 0x13491
movsd 0xbe8(%rbx), %xmm0
movsd 0xbf0(%rbx), %xmm1
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
movsd 0xbf8(%rbx), %xmm2
mulsd %xmm2, %xmm2
addsd %xmm1, %xmm2
addsd %xmm0, %xmm2
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
movsd %xmm0, 0x7c8(%rbx)
divsd 0x900(%rbx), %xmm0
movsd %xmm0, 0x958(%rbx)
movq %rbx, %rdi
callq 0x13716
movsd 0x910(%rbx), %xmm0
mulsd 0x12a6e(%rip), %xmm0    # 0x25d20
movsd 0x7c8(%rbx), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x7d8(%rbx)
movsd 0x510(%rbx), %xmm1
movsd 0x7b0(%rbx), %xmm2
mulsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x7f0(%rbx)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0x7a0(%rbx), %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
movapd %xmm1, 0x7e0(%rbx)
leaq 0xdf8(%rbx), %rax
movapd 0x12c3b(%rip), %xmm0    # 0x25f50
xorpd %xmm0, %xmm1
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movl $0x1, %eax
movq %rax, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movlpd %xmm1, 0xdf8(%rbx)
xorpd %xmm0, %xmm2
leaq 0x18(%rsp), %rsi
movlpd %xmm2, (%rsi)
callq 0x15520
movsd 0x7e8(%rbx), %xmm0
xorpd 0x12bf0(%rip), %xmm0    # 0x25f50
leaq 0x10(%rsp), %rsi
movlpd %xmm0, (%rsi)
movq %rax, %rdi
callq 0x15520
movq 0x38(%rsp), %rax
addq 0x28(%rsp), %rax
cmpq $0x3, %rax
jne 0x13491
cmpq $0x1, 0x30(%rsp)
jne 0x13491
movsd 0x11cd7(%rip), %xmm5    # 0x25070
divsd (%r14), %xmm5
movsd 0xe28(%rbx), %xmm0
addsd 0xdf8(%rbx), %xmm0
movsd 0xe30(%rbx), %xmm2
addsd 0xe00(%rbx), %xmm2
movsd 0xe38(%rbx), %xmm1
addsd 0xe08(%rbx), %xmm1
movsd 0xd30(%rbx), %xmm3
mulsd %xmm0, %xmm3
movsd 0xd48(%rbx), %xmm4
mulsd %xmm2, %xmm4
addsd %xmm3, %xmm4
movsd 0xd60(%rbx), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm4, %xmm3
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0xd20(%rbx), %xmm0
movupd 0xd38(%rbx), %xmm4
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm4, %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd 0xd50(%rbx), %xmm1
addpd %xmm0, %xmm2
addpd %xmm2, %xmm1
movapd %xmm5, %xmm0
unpcklpd %xmm5, %xmm0            # xmm0 = xmm0[0],xmm5[0]
mulpd %xmm1, %xmm0
movupd 0xe58(%rbx), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, 0x9f0(%rbx)
mulsd %xmm5, %xmm3
addsd 0xe68(%rbx), %xmm3
movsd %xmm3, 0xa00(%rbx)
addq $0x300, %rsp            # imm = 0x300
popq %rbx
popq %r14
popq %r15
retq
jmp 0x13471
jmp 0x13471
jmp 0x13471
movq 0x38(%rsp), %rcx
addq 0x28(%rsp), %rcx
cmpq $0x3, %rcx
jne 0x13491
cmpq $0x1, 0x30(%rsp)
jne 0x13491
movq %rax, %rdi
callq 0x5650
leaq 0x13e3c(%rip), %rdi     # 0x272d4
leaq 0x13ebc(%rip), %rsi     # 0x2735b
leaq 0x13ee2(%rip), %rcx     # 0x27388
movl $0x6a, %edx
callq 0x5250