// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R4Matrix.cpp
// Function: gaps::R4Matrix::Rotate(gaps::R3Vector const&, double)
void R4Matrix:: 
Rotate(const R3Vector& axis, RNAngle radians)
{
    // rotate matrix for arbitrary axis counterclockwise
    // From Graphics Gems I, p. 466
    RNCoord x = axis.X();
    RNCoord y = axis.Y();
    RNCoord z = axis.Z();
    RNScalar c = cos(radians);
    RNScalar s = sin(radians);
    RNScalar t = 1.0 - c;
    R4Matrix rotation(
        t*x*x + c, t*x*y - s*z, t*x*z + s*y, 0.0,
        t*x*y + s*z, t*y*y + c, t*y*z - s*x, 0.0,
        t*x*z - s*y, t*y*z + s*x, t*z*z + c, 0.0,
        0.0, 0.0, 0.0, 1.0);
    *this *= rotation;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movsd %xmm0, 0x100(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x108(%rsp), %rdi
callq 0x38c20
movsd %xmm0, 0xf8(%rsp)
movq 0x108(%rsp), %rdi
callq 0x38c30
movsd %xmm0, 0xf0(%rsp)
movq 0x108(%rsp), %rdi
callq 0x38c40
movsd %xmm0, 0xe8(%rsp)
movsd 0x100(%rsp), %xmm0
callq 0xf930
movsd %xmm0, 0xe0(%rsp)
movsd 0x100(%rsp), %xmm0
callq 0xf100
movsd %xmm0, 0xd8(%rsp)
movsd 0xdf3e3(%rip), %xmm0    # 0x133008
subsd 0xe0(%rsp), %xmm0
movsd %xmm0, 0xd0(%rsp)
movsd 0xd0(%rsp), %xmm0
mulsd 0xf8(%rsp), %xmm0
movsd 0xf8(%rsp), %xmm2
movsd 0xe0(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0xd0(%rsp), %xmm1
mulsd 0xf8(%rsp), %xmm1
movsd 0xf0(%rsp), %xmm3
movsd 0xd8(%rsp), %xmm2
mulsd 0xe8(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movsd 0xd0(%rsp), %xmm2
mulsd 0xf8(%rsp), %xmm2
movsd 0xe8(%rsp), %xmm4
movsd 0xd8(%rsp), %xmm3
mulsd 0xf0(%rsp), %xmm3
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
movsd 0xd0(%rsp), %xmm4
mulsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
movsd 0xd8(%rsp), %xmm3
mulsd 0xe8(%rsp), %xmm3
mulsd %xmm5, %xmm4
addsd %xmm3, %xmm4
movsd 0xd0(%rsp), %xmm5
mulsd 0xf0(%rsp), %xmm5
movsd 0xf0(%rsp), %xmm6
movsd 0xe0(%rsp), %xmm3
mulsd %xmm6, %xmm5
addsd %xmm3, %xmm5
movsd 0xd0(%rsp), %xmm6
mulsd 0xf0(%rsp), %xmm6
movsd 0xe8(%rsp), %xmm7
movsd 0xd8(%rsp), %xmm3
mulsd 0xf8(%rsp), %xmm3
movq %xmm3, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm3
mulsd %xmm7, %xmm6
addsd %xmm3, %xmm6
movsd 0xd0(%rsp), %xmm12
mulsd 0xf8(%rsp), %xmm12
movsd 0xe8(%rsp), %xmm7
movsd 0xd8(%rsp), %xmm3
mulsd 0xf0(%rsp), %xmm3
movq %xmm3, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm3
mulsd %xmm7, %xmm12
addsd %xmm3, %xmm12
movsd 0xd0(%rsp), %xmm11
mulsd 0xf0(%rsp), %xmm11
movsd 0xe8(%rsp), %xmm7
movsd 0xd8(%rsp), %xmm3
mulsd 0xf8(%rsp), %xmm3
mulsd %xmm7, %xmm11
addsd %xmm3, %xmm11
movsd 0xd0(%rsp), %xmm10
mulsd 0xe8(%rsp), %xmm10
movsd 0xe8(%rsp), %xmm7
movsd 0xe0(%rsp), %xmm3
mulsd %xmm7, %xmm10
addsd %xmm3, %xmm10
leaq 0x50(%rsp), %rdi
xorps %xmm9, %xmm9
movsd 0xdf1ac(%rip), %xmm8    # 0x133008
movaps %xmm9, %xmm3
movaps %xmm9, %xmm7
movsd %xmm12, (%rsp)
movsd %xmm11, 0x8(%rsp)
movsd %xmm10, 0x10(%rsp)
movsd %xmm9, 0x18(%rsp)
movsd %xmm9, 0x20(%rsp)
movsd %xmm9, 0x28(%rsp)
movsd %xmm9, 0x30(%rsp)
movsd %xmm8, 0x38(%rsp)
callq 0x51c60
movq 0x48(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x55600
addq $0x118, %rsp            # imm = 0x118
retq
nopw (%rax,%rax)