// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/p_client.c
// Function: ClientBeginServerFrame
void ClientBeginServerFrame (edict_t *ent)
{
	gclient_t	*client;
	int			buttonMask;


	// CTF CODE -- LM_JORM
	RuneThinkHook(ent);
	if (VoteStarted)
		Check_Vote();               //Vampire -- Checking if the time is up for the voting menu
	// END CTF CODE -- LM_JORM
	
	if (level.intermissiontime)
		return;

	client = ent->client;

	if (deathmatch->value &&
		client->pers.spectator != client->resp.spectator &&
		(level.time - client->respawn_time) >= 5) {
		spectator_respawn(ent);
		return;
	}


	// STATS-BEGIN LM_Hati
	if (!(level.framenum % STATS_PLAYER_SAMPLE_RATE))
	{
		if (client->p_stats_player)
		{
			stats_add(ent, STATS_PING_TOTAL, client->ping);
			stats_add(ent, STATS_PING_SAMPLES, 1);
		}
		
		// Alert referee if others have failed his pingalerts
		// Only referees can have ping alerts
		if (ent->client->ctf.extra_flags & CTF_EXTRAFLAGS_REFEREE)
			PingAlert(ent);
	}
	// STATS-END LM_Hati
	
	// run weapon animations if it hasn't been done by a ucmd_t
	if (!client->weapon_thunk && !client->resp.spectator)
		Think_Weapon (ent);
	else
		client->weapon_thunk = false;


	//sprintf(DBuffer, "resp cnt %ld", Respawn_Count);
	//Debug_Show(DBuffer);


	if(ent->deadflag)
	{
		// wait for any button just going down
		if ( level.time > client->respawn_time)
		{
			// in deathmatch, only wait for attack button
			if (deathmatch->value)
				buttonMask = BUTTON_ATTACK;
			else
				buttonMask = -1;

			if ( ( client->latched_buttons & buttonMask ) ||
				(deathmatch->value && ((int)dmflags->value & DF_FORCE_RESPAWN) ) )
			{
				respawn(ent);
				client->latched_buttons = 0;
			}
		}
		return;
	}

#ifdef MONSTERS_OK
	// add player trail so monsters can follow
	if (!deathmatch->value)
		if (!visible (ent, PlayerTrail_LastSpot() ) )
			PlayerTrail_Add (ent->s.old_origin);
#endif

	client->latched_buttons = 0;

	if (!client->ctf.goodskin)
	{
		char *s, set[MAX_INFO_STRING];
		s = Info_ValueForKey (ent->client->pers.userinfo, "skin");
		sprintf(set, "skin %s\n", s);
		ForceCommand(ent, set);
		client->ctf.goodskin = true;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
callq 0x182f0
movq 0x21ba2(%rip), %rax     # 0x686a8
cmpl $0x0, (%rax)
je 0x46b10
callq 0x18ad0
movq 0x22289(%rip), %r14     # 0x68da0
movss 0xc8(%r14), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x46b2a
jnp 0x46b39
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x58(%rbx), %r15
movq 0x2237c(%rip), %r12     # 0x68ec0
movq (%r12), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x46b54
jnp 0x46b80
movl 0x750(%r15), %eax
cmpl 0xe04(%r15), %eax
je 0x46b80
movss 0x4(%r14), %xmm0
subss 0xf28(%r15), %xmm0
ucomiss 0xc38e(%rip), %xmm0     # 0x52f08
jae 0x46cbb
imull $0xcccccccd, (%r14), %eax # imm = 0xCCCCCCCD
addl $0x19999998, %eax       # imm = 0x19999998
rorl $0x2, %eax
cmpl $0xccccccc, %eax        # imm = 0xCCCCCCC
ja 0x46bdb
cmpq $0x0, 0x9138(%r15)
movq %r15, %rax
je 0x46bca
movslq 0xb8(%r15), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x19330
movl $0x1, %edx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x19330
movq 0x58(%rbx), %rax
testb $0x2, 0x1108(%rax)
je 0x46bdb
movq %rbx, %rdi
callq 0x18480
cmpl $0x0, 0xe48(%r15)
jne 0x46bf3
cmpl $0x0, 0xe04(%r15)
je 0x46cd1
movl $0x0, 0xe48(%r15)
cmpl $0x0, 0x260(%rbx)
je 0x46c5b
movss 0x4(%r14), %xmm0
ucomiss 0xf28(%r15), %xmm0
jbe 0x46b2a
movq (%r12), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
cmpeqss %xmm0, %xmm2
movd %xmm2, %eax
orl $0x1, %eax
testl %eax, 0xe44(%r15)
je 0x46cde
movq %rbx, %rdi
callq 0x19610
movl $0x0, 0xe44(%r15)
jmp 0x46b2a
movl $0x0, 0xe44(%r15)
cmpl $0x0, 0x110c(%r15)
jne 0x46b2a
movl $0xc0, %edi
addq 0x58(%rbx), %rdi
leaq 0xb6bc(%rip), %rsi      # 0x52340
callq 0x18bb0
leaq 0x1396e(%rip), %rsi     # 0x5a5fe
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x196f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18c40
movl $0x1, 0x110c(%r15)
jmp 0x46b2a
movq %rbx, %rdi
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x19300
movq %rbx, %rdi
callq 0x19590
jmp 0x46bfe
ucomiss %xmm1, %xmm0
jne 0x46ce9
jnp 0x46b2a
movq 0x21928(%rip), %rax     # 0x68618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xa, %eax
jae 0x46b2a
jmp 0x46c43