// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/q_shared.c
// Function: RotatePointAroundVector
void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees )
{
	float	m[3][3];
	float	im[3][3];
	float	zrot[3][3];
	float	tmpmat[3][3];
	float	rot[3][3];
	int	i;
	vec3_t vr, vup, vf;

	vf[0] = dir[0];
	vf[1] = dir[1];
	vf[2] = dir[2];

	PerpendicularVector( vr, dir );
	CrossProduct( vr, vf, vup );

	m[0][0] = vr[0];
	m[1][0] = vr[1];
	m[2][0] = vr[2];

	m[0][1] = vup[0];
	m[1][1] = vup[1];
	m[2][1] = vup[2];

	m[0][2] = vf[0];
	m[1][2] = vf[1];
	m[2][2] = vf[2];

	memcpy( im, m, sizeof( im ) );

	im[0][1] = m[1][0];
	im[0][2] = m[2][0];
	im[1][0] = m[0][1];
	im[1][2] = m[2][1];
	im[2][0] = m[0][2];
	im[2][1] = m[1][2];

	memset( zrot, 0, sizeof( zrot ) );
	zrot[0][0] = zrot[1][1] = zrot[2][2] = 1.0F;

	zrot[0][0] = cos( DEG2RAD( degrees ) );
	zrot[0][1] = sin( DEG2RAD( degrees ) );
	zrot[1][0] = -sin( DEG2RAD( degrees ) );
	zrot[1][1] = cos( DEG2RAD( degrees ) );

	R_ConcatRotations( m, zrot, tmpmat );
	R_ConcatRotations( tmpmat, im, rot );

	for ( i = 0; i < 3; i++ )
	{
		dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * point[2];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movss %xmm0, 0x8(%rsp)
movq %rdx, %rbx
movq %rdi, %r14
movss (%rsi), %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x4(%rsi), %xmm0
movss %xmm0, 0x14(%rsp)
movss 0x8(%rsi), %xmm0
movss %xmm0, 0x18(%rsp)
leaq 0x44(%rsp), %r15
movq %r15, %rdi
callq 0x18b80
movss (%r15), %xmm3
movss 0x4(%r15), %xmm0
movss 0x8(%r15), %xmm1
movss 0x14(%rsp), %xmm7
movaps %xmm7, %xmm4
mulss %xmm1, %xmm4
movaps %xmm0, %xmm2
movss 0x18(%rsp), %xmm5
mulss %xmm5, %xmm2
subss %xmm4, %xmm2
movaps %xmm5, %xmm4
movaps %xmm5, %xmm8
mulss %xmm3, %xmm4
movaps %xmm1, %xmm5
movss 0x1c(%rsp), %xmm6
mulss %xmm6, %xmm5
subss %xmm4, %xmm5
movaps %xmm6, %xmm4
mulss %xmm0, %xmm4
leaq 0xe0(%rsp), %r15
movss %xmm3, (%r15)
mulss %xmm7, %xmm3
subss %xmm4, %xmm3
movss %xmm0, 0xc(%r15)
movss %xmm1, 0x18(%r15)
movss %xmm2, 0x4(%r15)
movss %xmm5, 0x10(%r15)
movss %xmm3, 0x1c(%r15)
movss %xmm6, 0x8(%r15)
movss %xmm7, 0x14(%r15)
movss %xmm8, 0x20(%r15)
movaps (%r15), %xmm4
leaq 0xb0(%rsp), %r12
movaps %xmm4, (%r12)
movaps 0x10(%r15), %xmm4
movaps %xmm4, 0x10(%r12)
movl 0x20(%r15), %eax
movl %eax, 0x20(%r12)
movss %xmm0, 0x4(%r12)
movss %xmm1, 0x8(%r12)
movss %xmm2, 0xc(%r12)
movss %xmm3, 0x14(%r12)
movss %xmm6, 0x18(%r12)
movss %xmm7, 0x1c(%r12)
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %r13
movaps %xmm0, 0x10(%r13)
movaps %xmm0, (%r13)
movl $0x0, 0x20(%r13)
movl $0x3f800000, %eax       # imm = 0x3F800000
movl %eax, 0x20(%r13)
movl %eax, 0x10(%r13)
xorps %xmm0, %xmm0
cvtss2sd 0x8(%rsp), %xmm0
mulsd 0x93d5(%rip), %xmm0     # 0x5a228
divsd 0x93c5(%rip), %xmm0     # 0x5a220
movsd %xmm0, 0x8(%rsp)
callq 0x18990
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%r13)
movsd 0x8(%rsp), %xmm0
callq 0x19550
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%r13)
movsd 0x8(%rsp), %xmm0
callq 0x19550
cvtsd2ss %xmm0, %xmm0
xorps 0x5d75(%rip), %xmm0     # 0x56c10
movss %xmm0, 0xc(%r13)
movsd 0x8(%rsp), %xmm0
callq 0x18990
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%r13)
leaq 0x50(%rsp), %rbp
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x19480
leaq 0x20(%rsp), %rdx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x19480
movl $0x2, %eax
movss 0x1c(%rsp,%rax,4), %xmm0
mulss 0x4(%rbx), %xmm0
movss 0x18(%rsp,%rax,4), %xmm1
mulss (%rbx), %xmm1
addss %xmm0, %xmm1
movss 0x20(%rsp,%rax,4), %xmm0
mulss 0x8(%rbx), %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%r14)
addq $0x4, %r14
addq $0x3, %rax
cmpq $0xb, %rax
jne 0x50ede
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq