// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/p_client.c
// Function: ClientConnect
qboolean ClientConnect (edict_t *ent, char *userinfo)
{
	char	*value;

	// check to see if they are on the banned IP list
	value = Info_ValueForKey (userinfo, "ip");
	if (SV_FilterPacket(value)) {
		Info_SetValueForKey(userinfo, "rejmsg", "Banned.");
		return false;
	}


	// check for a spectator
	value = Info_ValueForKey (userinfo, "spectator");
	if (deathmatch->value && *value && strcmp(value, "0")) {
		int i, numspec;

		if (*spectator_password->string && 
			strcmp(spectator_password->string, "none") && 
			strcmp(spectator_password->string, value)) {
			Info_SetValueForKey(userinfo, "rejmsg", "Spectator password required or incorrect.");
			return false;
		}

		// count spectators
		for (i = numspec = 0; i < maxclients->value; i++)
			if (g_edicts[i+1].inuse && g_edicts[i+1].client->pers.spectator)
				numspec++;

		if (numspec >= maxspectators->value) {
			Info_SetValueForKey(userinfo, "rejmsg", "Server spectator limit is full.");
			return false;
		}
	} else 
	
	{
		// check for a password
		value = Info_ValueForKey (userinfo, "password");
		if (*password->string && strcmp(password->string, "none") && 
			strcmp(password->string, value)) {
			Info_SetValueForKey(userinfo, "rejmsg", "Password required or incorrect.");
			return false;
		}
	}


	// must have name to connect
	value = Info_ValueForKey(userinfo, "name");
	if (strcmp(value, "") == 0)
	{
		Info_SetValueForKey(userinfo, "rejmsg", "You must have a name.");
		return false;
	}
	
	// they can connect
	ent->client = game.clients + (ent - g_edicts - 1);
	
	if (ent->client->p_stats_player)
	{
		ent->client->p_stats_player->dropped = true;
		ent->client->p_stats_player->info.teamnum = ent->client->ctf.teamnum;
		ent->client->p_stats_player = NULL;
	}

	// if there is already a body waiting for us (a loadgame), just
	// take it, otherwise spawn one from scratch
	if (ent->inuse == false)
	{
		// clear the respawning variables
		InitClientResp (ent->client);
		if (!game.autosaved || !ent->client->pers.weapon)
			InitClientPersistent (ent->client);
	}

	ClientUserinfoChanged (ent, userinfo);

#ifdef OLDOBSERVERCODE
	// CTF CODE -- LM_JORM
	value = Info_ValueForKey (userinfo, "autoobserve");
	if (value[0] == '1')
		ent->client->autoobserve = 1;
	else
		ent->client->autoobserve = 0;
#endif

	// Hati - copy enterframe to ctf struct and clear popup entity
	ent->client->ctf.original_enterframe = level.framenum;
	ent->client->ctf.popup_ent = NULL;
	ent->client->last_popup_frame = 0;

	// Hati - initialize spam control variables
	ent->client->spam_band_count = CTF_SPAM_BAND_MAX;
	ent->client->spam_freq_count = CTF_SPAM_FREQ_MIN;
	ent->client->spam_freq_time = level.time;
	
	// STATS-BEGIN LM_Hati
	{
		stats_player_s *p_player = NULL;
		
		if (strcmp(ent->client->pers.netname, "") != 0) //not a blank string
		{
			p_player = stats_find_dropped_player(ent->client->pers.netname);
		}
		if (p_player == NULL)
		{
			p_player = stats_new_player(ent->client->pers.netname);
		}
		ent->client->p_stats_player = p_player;
	}
	// STATS-END LM_Hati

	// END LM_JORM
	

	if (game.maxclients > 1)
		gi.dprintf ("%s connected\n", ent->client->pers.netname);

	ent->svflags = 0; // make sure we start with known default
	ent->client->pers.connected = true;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x1a89e(%rip), %rsi     # 0x75dd9
callq 0x18cb0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x19320
cmpl $0x0, %eax
je 0x5b575
movq -0x18(%rbp), %rdi
leaq 0x1bc76(%rip), %rsi     # 0x771d3
leaq 0x1bc76(%rip), %rdx     # 0x771da
callq 0x185b0
movl $0x0, -0x4(%rbp)
jmp 0x5ba3a
movq -0x18(%rbp), %rdi
leaq 0x1baec(%rip), %rsi     # 0x7706c
callq 0x18cb0
movq %rax, -0x20(%rbp)
movq 0x27930(%rip), %rax     # 0x82ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x5b5a7
jp 0x5b5a7
jmp 0x5b70b
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x5b70b
movq -0x20(%rbp), %rdi
leaq 0x1c6ee(%rip), %rsi     # 0x77cb0
callq 0x18bf0
cmpl $0x0, %eax
je 0x5b70b
movq 0x27651(%rip), %rax     # 0x82c28
movq (%rax), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x5b644
movq 0x2763b(%rip), %rax     # 0x82c28
movq (%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x18b65(%rip), %rsi     # 0x74160
callq 0x18bf0
cmpl $0x0, %eax
je 0x5b644
movq 0x2761c(%rip), %rax     # 0x82c28
movq (%rax), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x18bf0
cmpl $0x0, %eax
je 0x5b644
movq -0x18(%rbp), %rdi
leaq 0x1bba7(%rip), %rsi     # 0x771d3
leaq 0x1bbaf(%rip), %rdx     # 0x771e2
callq 0x185b0
movl $0x0, -0x4(%rbp)
jmp 0x5ba3a
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
cvtsi2ssl -0x24(%rbp), %xmm1
movq 0x26ed2(%rip), %rax     # 0x82530
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x5b6ce
movq 0x26ee6(%rip), %rax     # 0x82558
movq (%rax), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x4a8, %rcx, %rcx      # imm = 0x4A8
addq %rcx, %rax
cmpl $0x0, 0x60(%rax)
je 0x5b6c1
movq 0x26ec3(%rip), %rax     # 0x82558
movq (%rax), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x4a8, %rcx, %rcx      # imm = 0x4A8
addq %rcx, %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0x750(%rax)
je 0x5b6c1
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x5b6c3
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5b652
cvtsi2ssl -0x28(%rbp), %xmm0
movq 0x2785e(%rip), %rax     # 0x82f38
movq (%rax), %rax
ucomiss 0x20(%rax), %xmm0
jb 0x5b706
movq -0x18(%rbp), %rdi
leaq 0x1bae5(%rip), %rsi     # 0x771d3
leaq 0x16dd1(%rip), %rdx     # 0x724c6
callq 0x185b0
movl $0x0, -0x4(%rbp)
jmp 0x5ba3a
jmp 0x5b795
movq -0x18(%rbp), %rdi
leaq 0x194eb(%rip), %rsi     # 0x74c01
callq 0x18cb0
movq %rax, -0x20(%rbp)
movq 0x27132(%rip), %rax     # 0x82858
movq (%rax), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x5b793
movq 0x2711c(%rip), %rax     # 0x82858
movq (%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x18a16(%rip), %rsi     # 0x74160
callq 0x18bf0
cmpl $0x0, %eax
je 0x5b793
movq 0x270fd(%rip), %rax     # 0x82858
movq (%rax), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x18bf0
cmpl $0x0, %eax
je 0x5b793
movq -0x18(%rbp), %rdi
leaq 0x1ba58(%rip), %rsi     # 0x771d3
leaq 0x1ba8a(%rip), %rdx     # 0x7720c
callq 0x185b0
movl $0x0, -0x4(%rbp)
jmp 0x5ba3a
jmp 0x5b795
movq -0x18(%rbp), %rdi
leaq 0x19379(%rip), %rsi     # 0x74b19
callq 0x18cb0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x157cc(%rip), %rsi     # 0x70f80
callq 0x18bf0
cmpl $0x0, %eax
jne 0x5b7e1
movq -0x18(%rbp), %rdi
leaq 0x1ba0a(%rip), %rsi     # 0x771d3
leaq 0x1ba5c(%rip), %rdx     # 0x7722c
callq 0x185b0
movl $0x0, -0x4(%rbp)
jmp 0x5ba3a
movq 0x27558(%rip), %rax     # 0x82d40
movq 0x408(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x26d5e(%rip), %rdx     # 0x82558
movq (%rdx), %rdx
subq %rdx, %rax
movl $0x4a8, %esi            # imm = 0x4A8
cqto
idivq %rsi
subq $0x1, %rax
imulq $0x9140, %rax, %rax     # imm = 0x9140
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpq $0x0, 0x9138(%rax)
je 0x5b87d
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x9138(%rax), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x1100(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x9138(%rax), %rax
movl %ecx, 0x204(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq $0x0, 0x9138(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x60(%rax)
jne 0x5b8c5
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x18ee0
movq 0x274a5(%rip), %rax     # 0x82d40
cmpl $0x0, 0x620(%rax)
je 0x5b8b6
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpq $0x0, 0x730(%rax)
jne 0x5b8c3
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x19b80
jmp 0x5b8c5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x19d18
movq 0x274c7(%rip), %rax     # 0x82da0
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl %ecx, 0x9128(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq $0x0, 0x9130(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x0, 0x10fc(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq $0x1c2, 0x10e0(%rax) # imm = 0x1C2
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq $0x0, 0x10d8(%rax)
movq 0x27465(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movss %xmm0, 0x10d0(%rax)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xc0, %rdi
addq $0x200, %rdi            # imm = 0x200
leaq 0x1560b(%rip), %rsi     # 0x70f80
callq 0x18bf0
cmpl $0x0, %eax
je 0x5b99e
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xc0, %rdi
addq $0x200, %rdi            # imm = 0x200
callq 0x19160
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x5b9c4
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xc0, %rdi
addq $0x200, %rdi            # imm = 0x200
callq 0x184b0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0x9138(%rax)
movq 0x27362(%rip), %rax     # 0x82d40
cmpl $0x1, 0x610(%rax)
jle 0x5ba13
movq 0x26c12(%rip), %rax     # 0x82600
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
addq $0xc0, %rsi
addq $0x200, %rsi            # imm = 0x200
leaq 0x1b833(%rip), %rdi     # 0x77242
movb $0x0, %al
callq *%rcx
movq -0x10(%rbp), %rax
movl $0x0, 0xc8(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x1, 0x304(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)