// File: /workspace/github_c_makefile_star2_O2/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 0x18320
movq 0x237dd(%rip), %rax     # 0x666a8
cmpl $0x0, (%rax)
je 0x42ed5
callq 0x18b70
movq 0x23ec4(%rip), %r14     # 0x66da0
movss 0xc8(%r14), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x42eef
jnp 0x42efe
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x58(%rbx), %r15
movq 0x23fb7(%rip), %r12     # 0x66ec0
movq (%r12), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x42f19
jnp 0x42f45
movl 0x750(%r15), %eax
cmpl 0xe04(%r15), %eax
je 0x42f45
movss 0x4(%r14), %xmm0
subss 0xf28(%r15), %xmm0
ucomiss 0xbfc5(%rip), %xmm0     # 0x4ef04
jae 0x4306a
movl (%r14), %eax
pushq $0x14
popq %rcx
cltd
idivl %ecx
testl %edx, %edx
jne 0x42f93
cmpq $0x0, 0x9138(%r15)
movq %r15, %rax
je 0x42f82
movslq 0xb8(%r15), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x194d0
pushq $0x1
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x194d0
movq 0x58(%rbx), %rax
testb $0x2, 0x1108(%rax)
je 0x42f93
movq %rbx, %rdi
callq 0x184b0
cmpl $0x0, 0xe48(%r15)
jne 0x42fab
cmpl $0x0, 0xe04(%r15)
je 0x43080
andl $0x0, 0xe48(%r15)
cmpl $0x0, 0x260(%rbx)
je 0x4300d
movss 0x4(%r14), %xmm0
ucomiss 0xf28(%r15), %xmm0
jbe 0x42eef
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 0x4308d
movq %rbx, %rdi
callq 0x197d0
andl $0x0, 0xe44(%r15)
jmp 0x42eef
andl $0x0, 0xe44(%r15)
cmpl $0x0, 0x110c(%r15)
jne 0x42eef
movl $0xc0, %edi
addq 0x58(%rbx), %rdi
leaq 0xb30d(%rip), %rsi      # 0x4e340
callq 0x18c70
leaq 0x135af(%rip), %rsi     # 0x565ee
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x198c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18d20
movl $0x1, 0x110c(%r15)
jmp 0x42eef
movq %rbx, %rdi
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x19480
movq %rbx, %rdi
callq 0x19750
jmp 0x42fb3
ucomiss %xmm1, %xmm0
jne 0x43098
jnp 0x42eef
movq 0x23579(%rip), %rax     # 0x66618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xa, %eax
jae 0x42eef
jmp 0x42ff8