// File: /workspace/github_cpp_makefile_star2_O2/istellartech[P]OpenTsiolkovsky/src/coordinate_transform.cpp
// Function: dcmNED2BODY(double, double, double)
Matrix3d dcmNED2BODY(double azimuth_rad, double elevation_rad, double roll_rad){
    Matrix3d dcm;
    double az = azimuth_rad;
    double el = elevation_rad;
    double ro = roll_rad;

    dcm <<  cos(el)*cos(az), cos(el)*sin(az), -sin(el),
    -cos(ro)*sin(az)+sin(ro)*sin(el)*cos(az), cos(ro)*cos(az)+sin(ro)*sin(el)*sin(az), sin(ro)*cos(el),
    sin(ro)*sin(az)+cos(ro)*sin(el)*cos(az),  -sin(ro)*cos(az)+cos(ro)*sin(el)*sin(az),  cos(ro)*cos(el);

    /*
    auto angleaxis_inv = AngleAxisd(az, Vector3d::UnitZ()) * AngleAxisd(el, Vector3d::UnitY()) * AngleAxisd(ro, Vector3d::UnitX());
    dcm = angleaxis_inv.inverse().toRotationMatrix();
    */

    return dcm;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movsd %xmm2, 0x20(%rsp)
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x18(%rsp)
movq %rdi, %rbx
movapd %xmm1, %xmm0
callq 0x5680
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5680
mulsd 0x10(%rsp), %xmm0
leaq 0x78(%rsp), %r14
movq %rbx, (%r14)
andq $0x0, 0x8(%r14)
pushq $0x1
popq %rax
movq %rax, 0x10(%r14)
movq %rax, 0x18(%r14)
movsd %xmm0, (%rbx)
movsd 0x28(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50e0
mulsd 0x10(%rsp), %xmm0
leaq 0x70(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x1c988
movq %rax, %r14
movsd 0x28(%rsp), %xmm0
callq 0x50e0
xorpd 0x1ba9(%rip), %xmm0     # 0x1f010
leaq 0x68(%rsp), %rsi
movlpd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x1c988
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50e0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x50e0
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50e0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5680
mulsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
subsd %xmm1, %xmm0
leaq 0x60(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x1c988
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x50e0
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50e0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50e0
mulsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
leaq 0x58(%rsp), %rsi
movsd %xmm1, (%rsi)
movq %r14, %rdi
callq 0x1c988
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x50e0
movsd %xmm0, 0x10(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x5680
mulsd 0x10(%rsp), %xmm0
leaq 0x50(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x1c988
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x50e0
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50e0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50e0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5680
mulsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
leaq 0x48(%rsp), %rsi
movsd %xmm1, (%rsi)
movq %r14, %rdi
callq 0x1c988
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x50e0
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50e0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50e0
mulsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
subsd %xmm1, %xmm0
leaq 0x40(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x1c988
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x5680
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x5680
mulsd 0x18(%rsp), %xmm0
leaq 0x38(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x1c988
leaq 0x78(%rsp), %rdi
callq 0x1ca30
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r14
retq
jmp 0x1d706
jmp 0x1d706
jmp 0x1d706
jmp 0x1d706
jmp 0x1d706
jmp 0x1d706
jmp 0x1d706
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x1ca30
movq %rbx, %rdi
callq 0x5640