// File: /workspace/github_c_makefile_star2_O3/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, (%rsp)
movq %rdx, %rbx
movq %rdi, %r14
movss 0x8(%rsi), %xmm0
movss %xmm0, 0xc(%rsp)
movsd (%rsi), %xmm0
movaps %xmm0, 0x10(%rsp)
leaq 0x44(%rsp), %r12
movq %r12, %rdi
callq 0x18b80
movss (%r12), %xmm0
movss 0xc(%rsp), %xmm6
movaps %xmm6, %xmm2
mulss %xmm0, %xmm2
leaq 0xe0(%rsp), %r15
movss %xmm0, (%r15)
movaps 0x10(%rsp), %xmm5
movss %xmm5, 0x8(%r15)
movaps %xmm5, %xmm3
shufps $0x55, %xmm5, %xmm3     # xmm3 = xmm3[1,1],xmm5[1,1]
movss %xmm3, 0x14(%r15)
movss %xmm6, 0x20(%r15)
movsd 0x4(%r12), %xmm1
movaps %xmm1, %xmm4
shufps $0x55, %xmm1, %xmm4     # xmm4 = xmm4[1,1],xmm1[1,1]
mulss %xmm3, %xmm0
mulss %xmm4, %xmm3
mulss %xmm1, %xmm6
subss %xmm3, %xmm6
movss %xmm1, 0xc(%r15)
movss %xmm4, 0x18(%r15)
mulss %xmm5, %xmm4
subss %xmm2, %xmm4
movaps %xmm5, %xmm2
mulss %xmm1, %xmm2
subss %xmm2, %xmm0
movss %xmm6, 0x4(%r15)
movss %xmm4, 0x10(%r15)
movss %xmm0, 0x1c(%r15)
movaps (%r15), %xmm2
leaq 0xb0(%rsp), %r12
movaps %xmm2, (%r12)
movaps 0x10(%r15), %xmm2
movaps %xmm2, 0x10(%r12)
movl 0x20(%r15), %eax
movl %eax, 0x20(%r12)
movsd %xmm1, 0x4(%r12)
movss %xmm6, 0xc(%r12)
movss %xmm0, 0x14(%r12)
movsd %xmm5, 0x18(%r12)
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %r13
movaps %xmm0, 0x10(%r13)
movaps %xmm0, (%r13)
movl $0x3f800000, 0x20(%r13) # imm = 0x3F800000
xorps %xmm0, %xmm0
cvtss2sd (%rsp), %xmm0
mulsd 0x9380(%rip), %xmm0     # 0x59438
divsd 0x9370(%rip), %xmm0     # 0x59430
movsd %xmm0, (%rsp)
callq 0x18990
movapd %xmm0, 0x10(%rsp)
movsd (%rsp), %xmm0
callq 0x19550
movapd 0x10(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
cvtpd2ps %xmm1, %xmm0
movlpd %xmm0, (%r13)
movsd (%rsp), %xmm0
callq 0x19550
cvtsd2ss %xmm0, %xmm0
xorps 0x5bcd(%rip), %xmm0     # 0x55cd0
movss %xmm0, 0xc(%r13)
movsd (%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 0x50145
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq