// File: /workspace/github_cpp_makefile_star2_O3/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 0x5690
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5690
mulsd 0x10(%rsp), %xmm0
leaq 0x38(%rsp), %r14
movq %rbx, (%r14)
movq $0x0, 0x8(%r14)
movl $0x1, %eax
movq %rax, 0x10(%r14)
movq %rax, 0x18(%r14)
movsd %xmm0, (%rbx)
movsd 0x28(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50f0
mulsd 0x10(%rsp), %xmm0
leaq 0x90(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x22604
movq %rax, %r14
movsd 0x28(%rsp), %xmm0
callq 0x50f0
xorpd 0x2ba0(%rip), %xmm0     # 0x25f50
leaq 0x88(%rsp), %rsi
movlpd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x22604
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50f0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x50f0
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50f0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5690
mulsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
subsd %xmm1, %xmm0
leaq 0x80(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x22604
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x50f0
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50f0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50f0
mulsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
leaq 0x78(%rsp), %rsi
movsd %xmm1, (%rsi)
movq %r14, %rdi
callq 0x22604
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x50f0
movsd %xmm0, 0x10(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x5690
mulsd 0x10(%rsp), %xmm0
leaq 0x70(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x22604
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x50f0
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50f0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50f0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5690
mulsd 0x8(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
leaq 0x68(%rsp), %rsi
movsd %xmm1, (%rsi)
movq %r14, %rdi
callq 0x22604
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x50f0
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x50f0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x50f0
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 0x22604
movq %rax, %r14
movsd 0x20(%rsp), %xmm0
callq 0x5690
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x5690
mulsd 0x18(%rsp), %xmm0
leaq 0x58(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x22604
movq 0x50(%rsp), %rax
addq 0x40(%rsp), %rax
cmpq $0x3, %rax
jne 0x23683
cmpq $0x3, 0x48(%rsp)
jne 0x23683
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r14
retq
jmp 0x23663
jmp 0x23663
jmp 0x23663
jmp 0x23663
jmp 0x23663
jmp 0x23663
jmp 0x23663
movq 0x50(%rsp), %rcx
addq 0x40(%rsp), %rcx
cmpq $0x3, %rcx
jne 0x23683
cmpq $0x3, 0x48(%rsp)
jne 0x23683
movq %rax, %rdi
callq 0x5650
leaq 0x3c4a(%rip), %rdi      # 0x272d4
leaq 0x3cca(%rip), %rsi      # 0x2735b
leaq 0x4bf0(%rip), %rcx      # 0x28288
movl $0x6a, %edx
callq 0x5250