// File: DavidLBruce[P]sim3dof/build/../src/FcTse6.cpp
// Function: FcTse6::MscToCart(Matrix&, Matrix&)
void FcTse6::MscToCart( Matrix &mscState,
                        Matrix &cartRel )
{
  double range = 1.0 / mscState(2);
  double rDot = mscState(3) * range;

  double cth = cos( mscState(0) );
  double sth = sin( mscState(0) );

  double thDot = mscState(1);

  cartRel(0) = range * cth;
  cartRel(1) = range * sth;
  
  cartRel(2) = rDot * cth - range * thDot * sth;
  cartRel(3) = rDot * sth + range * thDot * cth;

  cartRel(4) = range * ( mscState(4) * cth - mscState(5) * sth );
  cartRel(5) = range * ( mscState(4) * sth + mscState(5) * cth );

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x1fd40
movsd 0x19c2b(%rip), %xmm0    # 0x24008
divsd (%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x1fd40
movsd (%rax), %xmm0
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x1fd40
movsd (%rax), %xmm0
callq 0x3430
movsd %xmm0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x1fd40
movsd (%rax), %xmm0
callq 0x30a0
movsd %xmm0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x1fd40
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x20(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x1fd40
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x20(%rbp), %xmm0
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x1fd40
movsd -0x98(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x28(%rbp), %xmm0
movsd -0x30(%rbp), %xmm2
movsd -0x20(%rbp), %xmm1
mulsd -0x40(%rbp), %xmm1
mulsd -0x38(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
callq 0x1fd40
movsd -0x90(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x28(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
movsd -0x20(%rbp), %xmm1
mulsd -0x40(%rbp), %xmm1
mulsd -0x30(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0x1fd40
movsd -0x88(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x1fd40
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x1fd40
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm3
movsd -0x70(%rbp), %xmm0
movsd (%rax), %xmm2
mulsd -0x38(%rbp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rdi
movl $0x4, %esi
callq 0x1fd40
movsd -0x68(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x1fd40
movsd (%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x1fd40
movsd -0x60(%rbp), %xmm1
movsd -0x58(%rbp), %xmm3
movsd -0x50(%rbp), %xmm0
movsd (%rax), %xmm2
mulsd -0x30(%rbp), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x18(%rbp), %rdi
movl $0x5, %esi
callq 0x1fd40
movsd -0x48(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0xa0, %rsp
popq %rbp
retq
nop