// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rax)
movss 0x4(%rdi), %xmm0
addss 0x28(%rax), %xmm0
leaq 0xc(%rsp), %rdi
movss %xmm0, (%rdi)
movss 0x8(%rbx), %xmm0
addss 0x2c(%rax), %xmm0
movss %xmm0, 0x4(%rdi)
movss 0xc(%rbx), %xmm0
addss 0x30(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
movq 0x1e3af(%rip), %r14     # 0x69600
callq *0x68(%r14)
xorl %ecx, %ecx
testb $0x38, %al
setne %cl
movq 0x58(%rbx), %rdx
movl 0x74(%rdx), %esi
andl $-0x2, %esi
orl %esi, %ecx
movl %ecx, 0x74(%rdx)
testb $0x9, %al
je 0x4b2e0
movq 0x58(%rbx), %rax
movss 0x6c(%rax), %xmm0
movss 0x8ca8(%rip), %xmm2     # 0x53f28
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
mulss 0x10621(%rip), %xmm1    # 0x5b8b0
addss %xmm0, %xmm1
divss %xmm1, %xmm0
subss %xmm0, %xmm2
movss 0x60(%rax), %xmm3
mulss %xmm0, %xmm3
addss %xmm2, %xmm3
movss %xmm3, 0x60(%rax)
movss 0x10603(%rip), %xmm3    # 0x5b8b8
mulss %xmm2, %xmm3
movss 0x64(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x64(%rax)
xorps %xmm3, %xmm3
mulss 0x68(%rax), %xmm0
mulss %xmm2, %xmm3
addss %xmm3, %xmm0
jmp 0x4b3d2
testb $0x10, %al
jne 0x4b35e
testb $0x20, %al
je 0x4b3dc
movq 0x58(%rbx), %rax
movss 0x6c(%rax), %xmm0
movss 0x8c2b(%rip), %xmm2     # 0x53f28
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
mulss 0x105c8(%rip), %xmm1    # 0x5b8d4
addss %xmm0, %xmm1
divss %xmm1, %xmm0
subss %xmm0, %xmm2
movss 0xa0e4(%rip), %xmm3     # 0x55404
mulss %xmm2, %xmm3
movss 0x60(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x60(%rax)
movss 0x1057a(%rip), %xmm3    # 0x5b8b8
mulss %xmm2, %xmm3
movss 0x64(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x64(%rax)
mulss 0xbb78(%rip), %xmm2     # 0x56ed4
jmp 0x4b3c9
movq 0x58(%rbx), %rax
movss 0x6c(%rax), %xmm0
movss 0x8bb9(%rip), %xmm2     # 0x53f28
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
mulss 0x10532(%rip), %xmm1    # 0x5b8b0
addss %xmm0, %xmm1
divss %xmm1, %xmm0
subss %xmm0, %xmm2
xorps %xmm3, %xmm3
mulss %xmm2, %xmm3
movss 0x60(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x60(%rax)
movss 0x8ee5(%rip), %xmm3     # 0x54290
mulss %xmm2, %xmm3
movss 0x64(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x64(%rax)
mulss 0x10507(%rip), %xmm2    # 0x5b8d0
mulss 0x68(%rax), %xmm0
addss %xmm2, %xmm0
movss %xmm0, 0x68(%rax)
movss %xmm1, 0x6c(%rax)
movq 0x1e9bd(%rip), %rax     # 0x69da0
xorps %xmm0, %xmm0
cvtsi2ssl (%rax), %xmm0
movq 0x58(%rbx), %rax
movss 0xf04(%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4b4b0
subss %xmm0, %xmm1
cvttss2si %xmm1, %ebp
cmpl $0x1e, %ebp
jne 0x4b436
movq 0x20(%r14), %r15
leaq 0x10500(%rip), %rdi     # 0x5b917
callq *0x48(%r14)
movss 0x8b05(%rip), %xmm0     # 0x53f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
cmpl $0x1f, %ebp
setl %al
testb $0x4, %bpl
sete %cl
testb %cl, %al
jne 0x4b6c7
movq 0x58(%rbx), %rax
movss 0x6c(%rax), %xmm0
movss 0x8acc(%rip), %xmm1     # 0x53f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x10471(%rip), %xmm2    # 0x5b8dc
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
xorps %xmm3, %xmm3
mulss %xmm1, %xmm3
movss 0x60(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x60(%rax)
movss 0x64(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x64(%rax)
mulss 0x68(%rax), %xmm0
addss %xmm1, %xmm0
jmp 0x4b6bd
movss 0xf08(%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4b56e
subss %xmm0, %xmm1
cvttss2si %xmm1, %ebp
cmpl $0x1e, %ebp
jne 0x4b4f8
movq 0x20(%r14), %r15
leaq 0x10450(%rip), %rdi     # 0x5b929
callq *0x48(%r14)
movss 0x8a43(%rip), %xmm0     # 0x53f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
cmpl $0x1f, %ebp
setl %al
testb $0x4, %bpl
sete %cl
testb %cl, %al
jne 0x4b6c7
movq 0x58(%rbx), %rax
movss 0x6c(%rax), %xmm0
movss 0x8a0a(%rip), %xmm1     # 0x53f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x103af(%rip), %xmm2    # 0x5b8dc
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
movss 0x60(%rax), %xmm3
mulss %xmm0, %xmm3
addss %xmm1, %xmm3
movss %xmm3, 0x60(%rax)
movss 0x64(%rax), %xmm3
mulss %xmm0, %xmm3
addss %xmm1, %xmm3
movss %xmm3, 0x64(%rax)
xorps %xmm3, %xmm3
mulss 0x68(%rax), %xmm0
mulss %xmm1, %xmm3
jmp 0x4b6b9
movss 0xf10(%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4b5ff
subss %xmm0, %xmm1
cvttss2si %xmm1, %ebp
cmpl $0x1e, %ebp
jne 0x4b5b6
movq 0x20(%r14), %r15
leaq 0xc61c(%rip), %rdi      # 0x57bb3
callq *0x48(%r14)
movss 0x8985(%rip), %xmm0     # 0x53f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
cmpl $0x1f, %ebp
setl %al
testb $0x4, %bpl
sete %cl
testb %cl, %al
jne 0x4b6c7
movq 0x58(%rbx), %rax
movss 0x6c(%rax), %xmm0
movss 0x894c(%rip), %xmm1     # 0x53f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x102f1(%rip), %xmm2    # 0x5b8dc
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
xorps %xmm3, %xmm3
jmp 0x4b68c
movss 0xf0c(%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4b6c7
subss %xmm0, %xmm1
cvttss2si %xmm1, %ebp
cmpl $0x1e, %ebp
jne 0x4b647
movq 0x20(%r14), %r15
leaq 0xc58b(%rip), %rdi      # 0x57bb3
callq *0x48(%r14)
movss 0x88f4(%rip), %xmm0     # 0x53f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
cmpl $0x1f, %ebp
setl %al
testb $0x4, %bpl
sete %cl
testb %cl, %al
jne 0x4b6c7
movq 0x58(%rbx), %rax
movss 0x6c(%rax), %xmm0
movss 0x88bf(%rip), %xmm1     # 0x53f28
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
mulss 0x10260(%rip), %xmm2    # 0x5b8d8
addss %xmm0, %xmm2
divss %xmm2, %xmm0
subss %xmm0, %xmm1
movss 0x10248(%rip), %xmm3    # 0x5b8d4
mulss %xmm1, %xmm3
movss 0x60(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x60(%rax)
movss 0x64(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm1, %xmm4
movss %xmm4, 0x64(%rax)
mulss 0x68(%rax), %xmm0
addss %xmm3, %xmm0
movss %xmm0, 0x68(%rax)
movss %xmm2, 0x6c(%rax)
movq 0x58(%rbx), %rax
movss 0xea8(%rax), %xmm4
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm4
jbe 0x4b756
movss 0x6c(%rax), %xmm1
movss 0x8840(%rip), %xmm3     # 0x53f28
movaps %xmm3, %xmm2
subss %xmm1, %xmm2
mulss %xmm4, %xmm2
addss %xmm1, %xmm2
divss %xmm2, %xmm1
subss %xmm1, %xmm3
movss 0xeb0(%rax), %xmm4
mulss %xmm3, %xmm4
movss 0x60(%rax), %xmm5
mulss %xmm1, %xmm5
addss %xmm4, %xmm5
movss %xmm5, 0x60(%rax)
movss 0xeb4(%rax), %xmm4
mulss %xmm3, %xmm4
movss 0x64(%rax), %xmm5
mulss %xmm1, %xmm5
addss %xmm4, %xmm5
movss %xmm5, 0x64(%rax)
mulss 0xeb8(%rax), %xmm3
mulss 0x68(%rax), %xmm1
addss %xmm3, %xmm1
movss %xmm1, 0x68(%rax)
movss %xmm2, 0x6c(%rax)
movss 0xeac(%rax), %xmm3
ucomiss %xmm0, %xmm3
jbe 0x4b7de
movss 0x6c(%rax), %xmm0
movss 0x87b8(%rip), %xmm2     # 0x53f28
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
mulss %xmm3, %xmm1
addss %xmm0, %xmm1
divss %xmm1, %xmm0
subss %xmm0, %xmm2
movss 0x10151(%rip), %xmm3    # 0x5b8e0
mulss %xmm2, %xmm3
movss 0x60(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x60(%rax)
movss 0x8ca7(%rip), %xmm3     # 0x54454
mulss %xmm2, %xmm3
movss 0x64(%rax), %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movss %xmm4, 0x64(%rax)
mulss 0x100ed(%rip), %xmm2    # 0x5b8b8
mulss 0x68(%rax), %xmm0
addss %xmm2, %xmm0
movss %xmm0, 0x68(%rax)
movss %xmm1, 0x6c(%rax)
movss 0xea8(%rax), %xmm0
movss 0xeac(%rax), %xmm1
addss 0x100ee(%rip), %xmm0    # 0x5b8e4
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
maxss %xmm0, %xmm3
movss %xmm3, 0xea8(%rax)
addss 0x93f0(%rip), %xmm1     # 0x54c00
maxss %xmm1, %xmm2
movss %xmm2, 0xeac(%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq