// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x6c(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x68(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x64(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x60(%rax)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
addss 0x28(%rax), %xmm0
movss %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
addss 0x2c(%rax), %xmm0
movss %xmm0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
addss 0x30(%rax), %xmm0
movss %xmm0, -0x10(%rbp)
movq 0x1f54c(%rip), %rax     # 0x82600
movq 0x68(%rax), %rax
leaq -0x18(%rbp), %rdi
callq *%rax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x38, %eax
cmpl $0x0, %eax
je 0x630df
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x74(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x74(%rax)
jmp 0x630f0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x74(%rax), %ecx
andl $-0x2, %ecx
movl %ecx, 0x74(%rax)
movl -0xc(%rbp), %eax
andl $0x9, %eax
cmpl $0x0, %eax
je 0x63129
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
movss 0xcddd(%rip), %xmm0     # 0x6feec
movss 0x146f9(%rip), %xmm1    # 0x77810
xorps %xmm2, %xmm2
movss 0x146ea(%rip), %xmm3    # 0x7780c
callq 0x18e30
jmp 0x631a2
movl -0xc(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x63162
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
xorps %xmm0, %xmm0
movss 0xd149(%rip), %xmm1     # 0x70294
movss 0x146d5(%rip), %xmm2    # 0x77828
movss 0x146b1(%rip), %xmm3    # 0x7780c
callq 0x18e30
jmp 0x631a0
movl -0xc(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x6319e
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
movss 0xf9cf(%rip), %xmm0     # 0x72b50
movss 0x14687(%rip), %xmm1    # 0x77810
movss 0xfccb(%rip), %xmm2     # 0x72e5c
movss 0x1467b(%rip), %xmm3    # 0x77814
callq 0x18e30
jmp 0x631a0
jmp 0x631a2
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf04(%rax), %xmm0
movq 0x1fbe7(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x63276
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf04(%rax), %xmm0
movq 0x1fbc3(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1e, -0x1c(%rbp)
jne 0x63239
movq 0x1f407(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq 0x1467f(%rip), %rdi     # 0x7788f
movq 0x1f3e9(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x30(%rbp), %rdi
movl %eax, %edx
movq -0x28(%rbp), %rax
movl $0x3, %esi
movss 0xccbb(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
cmpl $0x1e, -0x1c(%rbp)
jg 0x6324a
movl -0x1c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x63271
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
xorps %xmm1, %xmm1
movss 0xcc8b(%rip), %xmm2     # 0x6feec
movss 0x145c7(%rip), %xmm3    # 0x77830
movaps %xmm1, %xmm0
callq 0x18e30
jmp 0x634fa
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf08(%rax), %xmm0
movq 0x1fb13(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x6334a
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf08(%rax), %xmm0
movq 0x1faef(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1e, -0x1c(%rbp)
jne 0x6330d
movq 0x1f333(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x145bd(%rip), %rdi     # 0x778a1
movq 0x1f315(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x40(%rbp), %rdi
movl %eax, %edx
movq -0x38(%rbp), %rax
movl $0x3, %esi
movss 0xcbe7(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
cmpl $0x1e, -0x1c(%rbp)
jg 0x6331e
movl -0x1c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x63345
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
movss 0xcbba(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movss 0x144f3(%rip), %xmm3    # 0x77830
movaps %xmm1, %xmm0
callq 0x18e30
jmp 0x634f8
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf10(%rax), %xmm0
movq 0x1fa3f(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x6341e
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf10(%rax), %xmm0
movq 0x1fa1b(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1e, -0x1c(%rbp)
jne 0x633e1
movq 0x1f25f(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x10783(%rip), %rdi     # 0x73b3b
movq 0x1f241(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x50(%rbp), %rdi
movl %eax, %edx
movq -0x48(%rbp), %rax
movl $0x3, %esi
movss 0xcb13(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
cmpl $0x1e, -0x1c(%rbp)
jg 0x633f2
movl -0x1c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x63419
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
xorps %xmm2, %xmm2
movss 0xcae3(%rip), %xmm1     # 0x6feec
movss 0x1441f(%rip), %xmm3    # 0x77830
movaps %xmm2, %xmm0
callq 0x18e30
jmp 0x634f6
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf0c(%rax), %xmm0
movq 0x1f96b(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x634f4
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf0c(%rax), %xmm0
movq 0x1f947(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1e, -0x1c(%rbp)
jne 0x634b5
movq 0x1f18b(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq 0x106af(%rip), %rdi     # 0x73b3b
movq 0x1f16d(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x60(%rbp), %rdi
movl %eax, %edx
movq -0x58(%rbp), %rax
movl $0x3, %esi
movss 0xca3f(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
cmpl $0x1e, -0x1c(%rbp)
jg 0x634c6
movl -0x1c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x634f2
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
movss 0x1433a(%rip), %xmm2    # 0x77814
movss 0xca0a(%rip), %xmm1     # 0x6feec
movss 0x14342(%rip), %xmm3    # 0x7782c
movaps %xmm2, %xmm0
callq 0x18e30
jmp 0x634f4
jmp 0x634f6
jmp 0x634f8
jmp 0x634fa
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xea8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x63563
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xeb0(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xeb4(%rax), %xmm1
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xeb8(%rax), %xmm2
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xea8(%rax), %xmm3
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
callq 0x18e30
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xeac(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x635b4
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xeac(%rax), %xmm3
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0x60, %rdi
movss 0x14295(%rip), %xmm0    # 0x77834
movss 0xcee9(%rip), %xmm1     # 0x70490
movss 0x14261(%rip), %xmm2    # 0x77810
callq 0x18e30
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xea8(%rax), %xmm0
movss 0x1426c(%rip), %xmm1    # 0x77838
subss %xmm1, %xmm0
movss %xmm0, 0xea8(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
ucomiss 0xea8(%rax), %xmm0
jbe 0x635ff
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xea8(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xeac(%rax), %xmm0
movss 0xcc7d(%rip), %xmm1     # 0x70294
subss %xmm1, %xmm0
movss %xmm0, 0xeac(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
ucomiss 0xeac(%rax), %xmm0
jbe 0x6364a
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xeac(%rax)
addq $0x60, %rsp
popq %rbp
retq