// File: /workspace/github_c_makefile_star2_O1/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 0x21fa1(%rip), %rax     # 0x696a8
cmpl $0x0, (%rax)
je 0x47711
callq 0x18ad0
movq 0x22688(%rip), %r14     # 0x69da0
movss 0xc8(%r14), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x4772b
jnp 0x4773a
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x58(%rbx), %r15
movq 0x2277b(%rip), %r12     # 0x69ec0
movq (%r12), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x47755
jnp 0x47781
movl 0x750(%r15), %eax
cmpl 0xe04(%r15), %eax
je 0x47781
movss 0x4(%r14), %xmm0
subss 0xf28(%r15), %xmm0
ucomiss 0xc789(%rip), %xmm0     # 0x53f04
jae 0x478b9
imull $0xcccccccd, (%r14), %eax # imm = 0xCCCCCCCD
addl $0x19999998, %eax       # imm = 0x19999998
rorl $0x2, %eax
cmpl $0xccccccc, %eax        # imm = 0xCCCCCCC
ja 0x477d9
cmpq $0x0, 0x9138(%r15)
je 0x477c4
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 0x477d9
movq %rbx, %rdi
callq 0x18480
cmpl $0x0, 0xe48(%r15)
jne 0x477f1
cmpl $0x0, 0xe04(%r15)
je 0x478cf
movl $0x0, 0xe48(%r15)
cmpl $0x0, 0x260(%rbx)
je 0x47859
movss 0x4(%r14), %xmm0
ucomiss 0xf28(%r15), %xmm0
jbe 0x4772b
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 0x478dc
movq %rbx, %rdi
callq 0x19610
movl $0x0, 0xe44(%r15)
jmp 0x4772b
movl $0x0, 0xe44(%r15)
cmpl $0x0, 0x110c(%r15)
jne 0x4772b
movl $0xc0, %edi
addq 0x58(%rbx), %rdi
leaq 0xbabe(%rip), %rsi      # 0x53340
callq 0x18bb0
leaq 0x13ab0(%rip), %rsi     # 0x5b33e
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x19700
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18c40
movl $0x1, 0x110c(%r15)
jmp 0x4772b
movq %rbx, %rdi
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x19300
movq %rbx, %rdi
callq 0x19590
jmp 0x477fc
ucomiss %xmm1, %xmm0
jne 0x478e7
jnp 0x4772b
movq 0x21d2a(%rip), %rax     # 0x69618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xa, %eax
jae 0x4772b
jmp 0x47841