// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/p_view.c
// Function: P_FallingDamage
void P_FallingDamage (edict_t *ent)
{
	float	delta;
	int		damage;
	vec3_t	dir;

	if (ent->s.modelindex != 255)
		return;		// not in the player model

	if (ent->movetype == MOVETYPE_NOCLIP)
		return;

	if ((ent->client->oldvelocity[2] < 0) && (ent->velocity[2] > ent->client->oldvelocity[2]) && (!ent->groundentity))
	{
		delta = ent->client->oldvelocity[2];
	}
	else
	{
		if (!ent->groundentity)
			return;
		delta = ent->velocity[2] - ent->client->oldvelocity[2];
	}
	delta = delta*delta * 0.0001;

	// never take falling damage if completely underwater
	if (ent->waterlevel == 3)
		return;
	if (ent->waterlevel == 2)
		delta *= 0.25;
	if (ent->waterlevel == 1)
		delta *= 0.5;

	if (delta < 1)
		return;

	if (delta < 15)
	{
		ent->s.event = EV_FOOTSTEP;
		return;
	}

	ent->client->fall_value = delta*0.5;
	if (ent->client->fall_value > 40)
		ent->client->fall_value = 40;
	ent->client->fall_time = level.time + FALL_TIME;

	if (delta > 30)
	{
		if (ent->health > 0)
		{
			if (delta >= 55)
				ent->s.event = EV_FALLFAR;
			else
				ent->s.event = EV_FALL;
		}
		ent->pain_debounce_time = level.time;	// no normal pain sound
		damage = (delta-30)/2;
		if (damage < 1)
			damage = 1;
		VectorSet (dir, 0, 0, 1);

		if (!deathmatch->value || !((int)dmflags->value & DF_NO_FALLING) )
			T_Damage (ent, world, world, dir, ent->s.origin, vec3_origin, damage, 0, 0, MOD_FALLING);
	}
	else
	{
		ent->s.event = EV_FALLSHORT;
		return;
	}
}

// Assembly:
cmpl $0xff, 0x28(%rdi)
jne 0x4b9fe
cmpl $0x1, 0x118(%rdi)
je 0x4b9fe
subq $0x18, %rsp
movq 0x58(%rdi), %rax
movss 0xee0(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4b870
movss 0x1c8(%rdi), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4b870
cmpq $0x0, 0x2b8(%rdi)
je 0x4b88d
cmpq $0x0, 0x2b8(%rdi)
je 0x4b9fa
movss 0x1c8(%rdi), %xmm1
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
movl 0x30c(%rdi), %ecx
cmpl $0x3, %ecx
je 0x4b9fa
mulss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0xfff4(%rip), %xmm0     # 0x5b8a0
cvtsd2ss %xmm0, %xmm0
cmpl $0x2, %ecx
jne 0x4b8bd
mulss 0x8b9f(%rip), %xmm0     # 0x5445c
cmpl $0x1, %ecx
jne 0x4b8ca
mulss 0x9b3a(%rip), %xmm0     # 0x55404
movss 0x8656(%rip), %xmm1     # 0x53f28
ucomiss %xmm0, %xmm1
ja 0x4b9fa
movss 0x8b61(%rip), %xmm1     # 0x54444
ucomiss %xmm0, %xmm1
jbe 0x4b8f4
movl $0x2, 0x50(%rdi)
jmp 0x4b9fa
movss 0x9b08(%rip), %xmm1     # 0x55404
mulss %xmm0, %xmm1
movss 0xebf0(%rip), %xmm2     # 0x5a4f8
minss %xmm1, %xmm2
movss %xmm2, 0xea4(%rax)
movq 0x1e485(%rip), %rcx     # 0x69da0
movss 0x4(%rcx), %xmm1
movss 0xff90(%rip), %xmm2     # 0x5b8b8
addss %xmm1, %xmm2
movss %xmm2, 0xea0(%rax)
ucomiss 0x8959(%rip), %xmm0     # 0x54294
jbe 0x4b9f3
cmpl $0x0, 0x254(%rdi)
jle 0x4b95c
ucomiss 0xff97(%rip), %xmm0     # 0x5b8e8
movl $0x5, %eax
sbbl $0x0, %eax
movl %eax, 0x50(%rdi)
movss %xmm1, 0x244(%rdi)
addss 0xff80(%rip), %xmm0     # 0x5b8ec
mulss 0x9a90(%rip), %xmm0     # 0x55404
cvttss2si %xmm0, %ecx
cmpl $0x2, %ecx
movl $0x1, %eax
cmovgel %ecx, %eax
movq $0x0, 0xc(%rsp)
movl $0x3f800000, 0x14(%rsp) # imm = 0x3F800000
movq 0x1e525(%rip), %rcx     # 0x69ec0
movq (%rcx), %rcx
movss 0x20(%rcx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4b9ad
jnp 0x4b9c1
movq 0x1dc64(%rip), %rcx     # 0x69618
movq (%rcx), %rcx
cvttss2si 0x20(%rcx), %ecx
testb $0x8, %cl
jne 0x4b9fa
movq 0x1db90(%rip), %rcx     # 0x69558
movq (%rcx), %rdx
leaq 0x4(%rdi), %r8
xorl %r10d, %r10d
movq 0x1dd8f(%rip), %r9      # 0x69768
leaq 0xc(%rsp), %rcx
movq %rdx, %rsi
pushq $0x16
pushq %r10
pushq %r10
pushq %rax
callq 0x190f0
addq $0x20, %rsp
jmp 0x4b9fa
movl $0x3, 0x50(%rdi)
addq $0x18, %rsp
retq