// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/q_shared.c
// Function: AngleVectors
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
{
	float		angle;
	static float		sr, sp, sy, cr, cp, cy;
	// static to help MS compiler fp bugs

	angle = angles[YAW] * (M_PI*2 / 360);
	sy = sin(angle);
	cy = cos(angle);
	angle = angles[PITCH] * (M_PI*2 / 360);
	sp = sin(angle);
	cp = cos(angle);
	angle = angles[ROLL] * (M_PI*2 / 360);
	sr = sin(angle);
	cr = cos(angle);

	if (forward)
	{
		forward[0] = cp*cy;
		forward[1] = cp*sy;
		forward[2] = -sp;
	}
	if (right)
	{
		right[0] = (-1*sr*sp*cy+-1*cr*-sy);
		right[1] = (-1*sr*sp*sy+-1*cr*cy);
		right[2] = -1*sr*cp;
	}
	if (up)
	{
		up[0] = (cr*sp*cy+-sr*-sy);
		up[1] = (cr*sp*sy+-sr*cy);
		up[2] = cr*cp;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
cvtss2sd 0x4(%rdi), %xmm0
mulsd 0xaba3(%rip), %xmm0     # 0x5b050
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19550
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x48be9(%rip)    # 0x990b4
movsd (%rsp), %xmm0
callq 0x18990
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x48bdb(%rip)    # 0x990bc
xorps %xmm0, %xmm0
cvtss2sd (%r12), %xmm0
mulsd 0xab5e(%rip), %xmm0     # 0x5b050
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19550
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x48ba0(%rip)    # 0x990b0
movsd (%rsp), %xmm0
callq 0x18990
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x48b92(%rip)    # 0x990b8
xorps %xmm0, %xmm0
cvtss2sd 0x8(%r12), %xmm0
mulsd 0xab18(%rip), %xmm0     # 0x5b050
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19550
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x48b56(%rip)    # 0x990ac
movsd (%rsp), %xmm0
callq 0x18990
testq %r15, %r15
je 0x5059f
movss 0x48b4b(%rip), %xmm1    # 0x990b8
unpcklps %xmm1, %xmm1            # xmm1 = xmm1[0,0,1,1]
movss 0x48b3c(%rip), %xmm2    # 0x990b4
movss 0x48b3c(%rip), %xmm3    # 0x990bc
unpcklps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
mulps %xmm1, %xmm3
movlps %xmm3, (%r15)
movss 0x48b1e(%rip), %xmm1    # 0x990b0
xorps 0x5737(%rip), %xmm1     # 0x55cd0
movss %xmm1, 0x8(%r15)
cvtsd2ss %xmm0, %xmm0
testq %r14, %r14
je 0x50606
movss 0x48afc(%rip), %xmm1    # 0x990ac
movaps 0x5719(%rip), %xmm2     # 0x55cd0
xorps %xmm2, %xmm1
movss 0x48aee(%rip), %xmm3    # 0x990b0
mulss %xmm1, %xmm3
xorps %xmm0, %xmm2
movss 0x48aeb(%rip), %xmm4    # 0x990bc
movss 0x48adb(%rip), %xmm5    # 0x990b4
movaps %xmm5, %xmm6
unpcklps %xmm4, %xmm6            # xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1]
movaps %xmm0, %xmm7
unpcklps %xmm2, %xmm7            # xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
mulps %xmm6, %xmm7
unpcklps %xmm3, %xmm3            # xmm3 = xmm3[0,0,1,1]
unpcklps %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
mulps %xmm3, %xmm4
addps %xmm7, %xmm4
movlps %xmm4, (%r14)
mulss 0x48ab8(%rip), %xmm1    # 0x990b8
movss %xmm1, 0x8(%r14)
testq %rbx, %rbx
je 0x5065e
movss 0x48a9d(%rip), %xmm1    # 0x990b0
mulss %xmm0, %xmm1
movss 0x48a8d(%rip), %xmm2    # 0x990ac
movaps 0x56aa(%rip), %xmm3     # 0x55cd0
xorps %xmm2, %xmm3
movss 0x48a8b(%rip), %xmm4    # 0x990bc
unpcklps %xmm4, %xmm2            # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
movss 0x48a78(%rip), %xmm5    # 0x990b4
unpcklps %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
unpcklps %xmm3, %xmm5            # xmm5 = xmm5[0],xmm3[0],xmm5[1],xmm3[1]
mulps %xmm2, %xmm5
unpcklps %xmm1, %xmm1            # xmm1 = xmm1[0,0,1,1]
mulps %xmm1, %xmm4
addps %xmm5, %xmm4
movlps %xmm4, (%rbx)
mulss 0x48a5f(%rip), %xmm0    # 0x990b8
movss %xmm0, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq