// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Quaternion.cpp
// Function: gaps::R3Quaternion::Multiply(gaps::R3Quaternion const&)
void R3Quaternion::
Multiply(const R3Quaternion& q2)
{
    // Multiply quaternion (equivalent to concatenating rotations)
    RNScalar q1[4]; q1[0] = v[0]; q1[1] = v[1]; q1[2] = v[2]; q1[3] = v[3];
    v[0] = q1[0]*q2[0] - q1[1]*q2[1] - q1[2]*q2[2] - q1[3]*q2[3];
    v[1] = q1[0]*q2[1] + q1[1]*q2[0] + q1[2]*q2[3] - q1[3]*q2[2];
    v[2] = q1[0]*q2[2] - q1[1]*q2[3] + q1[2]*q2[0] + q1[3]*q2[1];
    v[3] = q1[0]*q2[3] + q1[1]*q2[2] - q1[2]*q2[1] + q1[3]*q2[0];
    // Normalize();
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0xe0(%rsp)
movsd (%rax), %xmm0
movsd %xmm0, 0xf0(%rsp)
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0xf8(%rsp)
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x100(%rsp)
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x108(%rsp)
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x118(%rsp), %rdi
xorl %esi, %esi
callq 0x51af0
movsd %xmm0, 0x10(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0x51af0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x18(%rsp), %xmm0
mulsd %xmm3, %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x118(%rsp), %rdi
movl $0x2, %esi
callq 0x51af0
movsd 0x20(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x28(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x108(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x118(%rsp), %rdi
movl $0x3, %esi
callq 0x51af0
movsd 0x30(%rsp), %xmm1
movq 0xe0(%rsp), %rax
movaps %xmm0, %xmm2
movsd 0x38(%rsp), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0x51af0
movsd %xmm0, 0x48(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x118(%rsp), %rdi
xorl %esi, %esi
callq 0x51af0
movsd 0x40(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x50(%rsp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x118(%rsp), %rdi
movl $0x3, %esi
callq 0x51af0
movsd 0x58(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x60(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x108(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x118(%rsp), %rdi
movl $0x2, %esi
callq 0x51af0
movsd 0x68(%rsp), %xmm1
movq 0xe0(%rsp), %rax
movaps %xmm0, %xmm2
movsd 0x70(%rsp), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rax)
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x118(%rsp), %rdi
movl $0x2, %esi
callq 0x51af0
movsd %xmm0, 0x80(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0x118(%rsp), %rdi
movl $0x3, %esi
callq 0x51af0
movsd 0x78(%rsp), %xmm1
movsd 0x80(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x88(%rsp), %xmm0
mulsd %xmm3, %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
movq 0x118(%rsp), %rdi
xorl %esi, %esi
callq 0x51af0
movsd 0x90(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x98(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
movsd 0x108(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
movq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0x51af0
movsd 0xa0(%rsp), %xmm1
movq 0xe0(%rsp), %rax
movaps %xmm0, %xmm2
movsd 0xa8(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rax)
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
movq 0x118(%rsp), %rdi
movl $0x3, %esi
callq 0x51af0
movsd %xmm0, 0xb8(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0xb0(%rsp)
movq 0x118(%rsp), %rdi
movl $0x2, %esi
callq 0x51af0
movsd 0xb0(%rsp), %xmm1
movsd 0xb8(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0xc0(%rsp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xc8(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0xd0(%rsp)
movq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0x51af0
movsd 0xc8(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0xd0(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xd8(%rsp)
movsd 0x108(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movq 0x118(%rsp), %rdi
xorl %esi, %esi
callq 0x51af0
movsd 0xd8(%rsp), %xmm1
movq 0xe0(%rsp), %rax
movaps %xmm0, %xmm2
movsd 0xe8(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rax)
addq $0x128, %rsp            # imm = 0x128
retq
nopl (%rax)