// File: /workspace/github_c_makefile_star2_O2/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 0xb015(%rip), %xmm0     # 0x57010
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19700
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4b19b(%rip)    # 0x971b4
movsd (%rsp), %xmm0
callq 0x18a20
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4b18d(%rip)    # 0x971bc
cvtss2sd (%r12), %xmm0
mulsd 0xafd3(%rip), %xmm0     # 0x57010
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19700
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4b155(%rip)    # 0x971b0
movsd (%rsp), %xmm0
callq 0x18a20
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4b147(%rip)    # 0x971b8
cvtss2sd 0x8(%r12), %xmm0
mulsd 0xaf90(%rip), %xmm0     # 0x57010
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x19700
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4b10e(%rip)    # 0x971ac
movsd (%rsp), %xmm0
callq 0x18a20
testq %r15, %r15
je 0x4c0e7
movss 0x4b103(%rip), %xmm1    # 0x971b8
unpcklps %xmm1, %xmm1            # xmm1 = xmm1[0,0,1,1]
movss 0x4b0f4(%rip), %xmm2    # 0x971b4
movss 0x4b0f4(%rip), %xmm3    # 0x971bc
unpcklps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
mulps %xmm1, %xmm3
movlps %xmm3, (%r15)
movss 0x4b0d6(%rip), %xmm1    # 0x971b0
xorps 0x5bcf(%rip), %xmm1     # 0x51cb0
movss %xmm1, 0x8(%r15)
cvtsd2ss %xmm0, %xmm0
testq %r14, %r14
je 0x4c14e
movss 0x4b0b4(%rip), %xmm1    # 0x971ac
movaps 0x5bb1(%rip), %xmm2     # 0x51cb0
xorps %xmm2, %xmm1
movss 0x4b0a6(%rip), %xmm3    # 0x971b0
mulss %xmm1, %xmm3
xorps %xmm0, %xmm2
movss 0x4b0a3(%rip), %xmm4    # 0x971bc
movss 0x4b093(%rip), %xmm5    # 0x971b4
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 0x4b070(%rip), %xmm1    # 0x971b8
movss %xmm1, 0x8(%r14)
testq %rbx, %rbx
je 0x4c1a6
movss 0x4b055(%rip), %xmm1    # 0x971b0
mulss %xmm0, %xmm1
movss 0x4b045(%rip), %xmm2    # 0x971ac
movaps 0x5b42(%rip), %xmm3     # 0x51cb0
xorps %xmm2, %xmm3
movss 0x4b043(%rip), %xmm4    # 0x971bc
unpcklps %xmm4, %xmm2            # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
movss 0x4b030(%rip), %xmm5    # 0x971b4
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 0x4b017(%rip), %xmm0    # 0x971b8
movss %xmm0, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq