// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/p_view.c
// Function: SV_CalcBlend
void SV_CalcBlend (edict_t *ent)
{
	int		contents;
	vec3_t	vieworg;
	int		remaining;

	ent->client->ps.blend[0] = ent->client->ps.blend[1] = 
		ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

	// add for contents
	VectorAdd (ent->s.origin, ent->client->ps.viewoffset, vieworg);
	contents = gi.pointcontents (vieworg);
	if (contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER) )
		ent->client->ps.rdflags |= RDF_UNDERWATER;
	else
		ent->client->ps.rdflags &= ~RDF_UNDERWATER;

	if (contents & (CONTENTS_SOLID|CONTENTS_LAVA))
		SV_AddBlend (1.0, 0.3f, 0.0, 0.6f, ent->client->ps.blend);
	else if (contents & CONTENTS_SLIME)
		SV_AddBlend (0.0, 0.1f, 0.05f, 0.6f, ent->client->ps.blend);
	else if (contents & CONTENTS_WATER)
		SV_AddBlend (0.5, 0.3f, 0.2f, 0.4f, ent->client->ps.blend);

	// add for powerups
	if (ent->client->quad_framenum > level.framenum)
	{
		remaining = ent->client->quad_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0, 0, 1, 0.08f, ent->client->ps.blend);
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		remaining = ent->client->invincible_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (1, 1, 0, 0.08f, ent->client->ps.blend);
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		remaining = ent->client->enviro_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0, 1, 0, 0.08f, ent->client->ps.blend);
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		remaining = ent->client->breather_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0.4f, 1, 0.4f, 0.04f, ent->client->ps.blend);
	}

	// add for damage
	if (ent->client->damage_alpha > 0)
		SV_AddBlend (ent->client->damage_blend[0],ent->client->damage_blend[1]
		,ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);

	if (ent->client->bonus_alpha > 0)
		SV_AddBlend (0.85f, 0.7f, 0.3f, ent->client->bonus_alpha, ent->client->ps.blend);

	// drop the damage value
	ent->client->damage_alpha -= 0.06f;
	if (ent->client->damage_alpha < 0)
		ent->client->damage_alpha = 0;

	// drop the bonus value
	ent->client->bonus_alpha -= 0.1f;
	if (ent->client->bonus_alpha < 0)
		ent->client->bonus_alpha = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rax)
movsd 0x4(%rdi), %xmm0
movsd 0x28(%rax), %xmm1
addps %xmm0, %xmm1
movq %rsp, %rdi
movlps %xmm1, (%rdi)
movss 0xc(%rbx), %xmm0
addss 0x30(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
movq 0x1e020(%rip), %r14     # 0x68600
callq *0x68(%r14)
xorl %edx, %edx
testb $0x38, %al
setne %dl
movq 0x58(%rbx), %rcx
movl 0x74(%rcx), %esi
andl $-0x2, %esi
orl %esi, %edx
movl %edx, 0x74(%rcx)
testb $0x9, %al
je 0x4a662
movss 0x6c(%rcx), %xmm0
movss 0x891d(%rip), %xmm1     # 0x52f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x105c6(%rip), %xmm2    # 0x5abe0
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
movsd 0x60(%rcx), %xmm3
movss 0x105b5(%rip), %xmm4    # 0x5abe8
mulss %xmm1, %xmm4
movaps %xmm0, %xmm5
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
mulps %xmm3, %xmm5
movaps %xmm1, %xmm3
unpcklps %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
addps %xmm5, %xmm3
movlps %xmm3, 0x60(%rcx)
xorps %xmm3, %xmm3
mulss 0x68(%rcx), %xmm0
mulss %xmm1, %xmm3
addss %xmm3, %xmm0
jmp 0x4a71d
testb $0x10, %al
jne 0x4a6c2
testb $0x20, %al
je 0x4a727
movss 0x6c(%rcx), %xmm0
movss 0x88ad(%rip), %xmm1     # 0x52f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x1057a(%rip), %xmm2    # 0x5ac04
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
movsd 0x60(%rcx), %xmm3
movaps %xmm1, %xmm4
unpcklps %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
mulps 0x104d8(%rip), %xmm4    # 0x5ab80
movaps %xmm0, %xmm5
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
mulps %xmm3, %xmm5
addps %xmm4, %xmm5
movlps %xmm5, 0x60(%rcx)
mulss 0xb908(%rip), %xmm1     # 0x55fc8
jmp 0x4a714
movss 0x6c(%rcx), %xmm0
movss 0x8859(%rip), %xmm1     # 0x52f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x10502(%rip), %xmm2    # 0x5abe0
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
movsd 0x60(%rcx), %xmm3
movaps %xmm1, %xmm4
unpcklps %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
mulps 0x10474(%rip), %xmm4    # 0x5ab70
movaps %xmm0, %xmm5
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
mulps %xmm3, %xmm5
addps %xmm4, %xmm5
movlps %xmm5, 0x60(%rcx)
mulss 0x104ec(%rip), %xmm1    # 0x5ac00
mulss 0x68(%rcx), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x68(%rcx)
movss %xmm2, 0x6c(%rcx)
movq 0x1e672(%rip), %rax     # 0x68da0
xorps %xmm0, %xmm0
cvtsi2ssl (%rax), %xmm0
movss 0xf04(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4a783
subss %xmm0, %xmm1
cvttss2si %xmm1, %eax
cmpl $0x1e, %eax
jne 0x4a7d8
movq 0x20(%r14), %r15
leaq 0x104e9(%rip), %rdi     # 0x5ac47
callq *0x48(%r14)
movss 0x87be(%rip), %xmm0     # 0x52f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movq 0x58(%rbx), %rcx
jmp 0x4a7e8
movss 0xf08(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4a83d
subss %xmm0, %xmm1
cvttss2si %xmm1, %eax
cmpl $0x1e, %eax
jne 0x4a892
movq 0x20(%r14), %r15
leaq 0x104a9(%rip), %rdi     # 0x5ac59
callq *0x48(%r14)
movss 0x876c(%rip), %xmm0     # 0x52f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movq 0x58(%rbx), %rcx
jmp 0x4a8a2
setle %dl
testb $0x4, %al
sete %al
testb %al, %dl
jne 0x4a9ef
movss 0x6c(%rcx), %xmm0
movss 0x8733(%rip), %xmm1     # 0x52f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x10408(%rip), %xmm2    # 0x5ac0c
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
xorps %xmm3, %xmm3
mulss %xmm1, %xmm3
movsd 0x60(%rcx), %xmm4
movaps %xmm0, %xmm5
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
mulps %xmm4, %xmm5
unpcklps %xmm3, %xmm3            # xmm3 = xmm3[0,0,1,1]
addps %xmm5, %xmm3
movlps %xmm3, 0x60(%rcx)
mulss 0x68(%rcx), %xmm0
addss %xmm1, %xmm0
jmp 0x4a9e5
movss 0xf10(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4a8f6
subss %xmm0, %xmm1
cvttss2si %xmm1, %eax
cmpl $0x1e, %eax
jne 0x4a944
movq 0x20(%r14), %r15
leaq 0xc43d(%rip), %rdi      # 0x56ca7
callq *0x48(%r14)
movss 0x86b2(%rip), %xmm0     # 0x52f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movq 0x58(%rbx), %rcx
jmp 0x4a954
setle %dl
testb $0x4, %al
sete %al
testb %al, %dl
jne 0x4a9ef
movss 0x6c(%rcx), %xmm0
movss 0x8679(%rip), %xmm1     # 0x52f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x1034e(%rip), %xmm2    # 0x5ac0c
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
movsd 0x60(%rcx), %xmm3
movaps %xmm0, %xmm4
unpcklps %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1]
mulps %xmm3, %xmm4
movaps %xmm1, %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
addps %xmm4, %xmm3
movlps %xmm3, 0x60(%rcx)
xorps %xmm3, %xmm3
mulss 0x68(%rcx), %xmm0
mulss %xmm1, %xmm3
jmp 0x4a9e1
movss 0xf0c(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4a9ef
subss %xmm0, %xmm1
cvttss2si %xmm1, %eax
cmpl $0x1e, %eax
jne 0x4a981
movq 0x20(%r14), %r15
leaq 0xc388(%rip), %rdi      # 0x56ca7
callq *0x48(%r14)
movss 0x85fd(%rip), %xmm0     # 0x52f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movq 0x58(%rbx), %rcx
jmp 0x4a98d
setle %dl
testb $0x4, %al
sete %al
testb %al, %dl
jne 0x4a9ef
movss 0x6c(%rcx), %xmm0
movss 0x85c7(%rip), %xmm1     # 0x52f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x1029c(%rip), %xmm2    # 0x5ac0c
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
xorps %xmm3, %xmm3
jmp 0x4a9bd
setle %dl
testb $0x4, %al
sete %al
testb %al, %dl
jne 0x4a9ef
movss 0x6c(%rcx), %xmm0
movss 0x858e(%rip), %xmm1     # 0x52f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x1025f(%rip), %xmm2    # 0x5ac08
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
movss 0x10247(%rip), %xmm3    # 0x5ac04
mulss %xmm1, %xmm3
movsd 0x60(%rcx), %xmm4
movaps %xmm0, %xmm5
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
mulps %xmm4, %xmm5
movaps %xmm3, %xmm4
unpcklps %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
addps %xmm5, %xmm4
movlps %xmm4, 0x60(%rcx)
mulss 0x68(%rcx), %xmm0
addss %xmm3, %xmm0
movss %xmm0, 0x68(%rcx)
movss %xmm2, 0x6c(%rcx)
movss 0xea8(%rcx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x4aa64
movss 0x6c(%rcx), %xmm2
movss 0x851c(%rip), %xmm3     # 0x52f28
movaps %xmm3, %xmm4
subss %xmm2, %xmm4
mulss %xmm0, %xmm4
addss %xmm2, %xmm4
divss %xmm4, %xmm2
subss %xmm2, %xmm3
movsd 0xeb0(%rcx), %xmm5
movsd 0x60(%rcx), %xmm6
movaps %xmm3, %xmm7
unpcklps %xmm3, %xmm7            # xmm7 = xmm7[0],xmm3[0],xmm7[1],xmm3[1]
mulps %xmm5, %xmm7
movaps %xmm2, %xmm5
unpcklps %xmm2, %xmm5            # xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1]
mulps %xmm6, %xmm5
addps %xmm7, %xmm5
movlps %xmm5, 0x60(%rcx)
mulss 0xeb8(%rcx), %xmm3
mulss 0x68(%rcx), %xmm2
addss %xmm3, %xmm2
movss %xmm2, 0x68(%rcx)
movss %xmm4, 0x6c(%rcx)
movss 0xeac(%rcx), %xmm2
ucomiss %xmm1, %xmm2
jbe 0x4aad2
movss 0x6c(%rcx), %xmm1
movss 0x84aa(%rip), %xmm3     # 0x52f28
movaps %xmm3, %xmm4
subss %xmm1, %xmm4
mulss %xmm2, %xmm4
addss %xmm1, %xmm4
divss %xmm4, %xmm1
subss %xmm1, %xmm3
movsd 0x60(%rcx), %xmm5
movaps %xmm3, %xmm6
unpcklps %xmm3, %xmm6            # xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
mulps 0x100e9(%rip), %xmm6    # 0x5ab90
movaps %xmm1, %xmm7
unpcklps %xmm1, %xmm7            # xmm7 = xmm7[0],xmm1[0],xmm7[1],xmm1[1]
mulps %xmm5, %xmm7
addps %xmm6, %xmm7
movlps %xmm7, 0x60(%rcx)
mulss 0x10129(%rip), %xmm3    # 0x5abe8
mulss 0x68(%rcx), %xmm1
addss %xmm3, %xmm1
movss %xmm1, 0x68(%rcx)
movss %xmm4, 0x6c(%rcx)
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
addps 0x100c4(%rip), %xmm0    # 0x5aba0
xorps %xmm1, %xmm1
maxps %xmm0, %xmm1
movlps %xmm1, 0xea8(%rcx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq