// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_cmds.c
// Function: Cmd_Kick_f
void Cmd_Kick_f (edict_t *ent)
{
	unsigned long i=0;
	char *p;
	edict_t * target = NULL;
	edict_t * player = NULL;

	char message[MAX_INFO_STRING];

	if (!(ent->client->ctf.extra_flags & CTF_EXTRAFLAGS_REFEREE))
	{
		ctf_SafePrint(ent, PRINT_HIGH, "You are not a Referee\n");
		return;
	}

	p = gi.args();
	if (!sscanf(p, "%lu", &i))
	{
		ctf_SafePrint(ent, PRINT_HIGH, "Usage: kick <number>\nUse \"users\" to list players by number.\n");
		return;
	}

	player = ctf_findplayer(NULL, NULL, CTF_TEAM_IGNORETEAM);
	while (player)
	{
		if (player->client->ctf.ctfid == i)
			target = player;

		player = ctf_findplayer(player, NULL, CTF_TEAM_IGNORETEAM);
	}

	if (!target)
	{
		ctf_SafePrint(ent, PRINT_HIGH, "Couldn't find that target number.\n");
		return;
	}

	// Can't kick a referee unless you are an rcon
	if (target->client->ctf.extra_flags & CTF_EXTRAFLAGS_REFEREE &&
		!(ent->client->ctf.extra_flags & CTF_EXTRAFLAGS_RCON))
	{
		sprintf(message, "%s is a referee.  You cannot kick them.\n", target->client->pers.netname);
		ctf_SafePrint(ent, PRINT_HIGH, message);
	}

	// Can't kick an rcon under any circumstances
	if (target->client->ctf.extra_flags & CTF_EXTRAFLAGS_RCON)
	{
		sprintf(message, "%s is an rcon.  You cannot kick them.\n", target->client->pers.netname);
		ctf_SafePrint(ent, PRINT_HIGH, message);
	}

	sprintf(message, "%s was kicked by %s.\n",
		target->client->pers.netname, ent->client->pers.netname);
	ctf_BSafePrint(PRINT_HIGH, message);
	// clear the kicked player's stats
	stats_clear(target);
	ForceCommand(target, "disconnect\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
andq $0x0, 0x8(%rsp)
movq %rdi, %rbx
movq 0x58(%rdi), %rax
testb $0x2, 0x1108(%rax)
jne 0x27544
leaq 0x29823(%rip), %rdx     # 0x50d4f
pushq $0x2
popq %rsi
movq %rbx, %rdi
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x18ec0
movq 0x3f0b5(%rip), %rax     # 0x66600
callq *0x148(%rax)
leaq 0x27867(%rip), %rsi     # 0x4edbf
leaq 0x8(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x19110
testl %eax, %eax
je 0x27670
xorl %r14d, %r14d
pushq $-0x4
popq %rbp
xorl %edi, %edi
xorl %esi, %esi
movl %ebp, %edx
callq 0x192e0
testq %rax, %rax
je 0x2759e
movq 0x58(%rax), %rcx
movq 0x9120(%rcx), %rcx
cmpq 0x8(%rsp), %rcx
cmoveq %rax, %r14
movq %rax, %rdi
jmp 0x27577
testq %r14, %r14
je 0x27679
movq 0x58(%r14), %rdx
movl 0x1108(%rdx), %eax
testb $0x2, %al
je 0x275f7
movq 0x58(%rbx), %rcx
testb $0x4, 0x1108(%rcx)
jne 0x275f7
addq $0x2c0, %rdx            # imm = 0x2C0
leaq 0x29ddd(%rip), %rsi     # 0x513ad
leaq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x198c0
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x18ec0
movq 0x58(%r14), %rdx
movl 0x1108(%rdx), %eax
testb $0x4, %al
je 0x2762a
addq $0x2c0, %rdx            # imm = 0x2C0
leaq 0x29dcd(%rip), %rsi     # 0x513d6
leaq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x198c0
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x18ec0
movq 0x58(%r14), %rdx
movl $0x2c0, %ecx            # imm = 0x2C0
addq %rcx, %rdx
addq 0x58(%rbx), %rcx
leaq 0x29dc0(%rip), %rsi     # 0x513fd
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x198c0
pushq $0x2
popq %rdi
movq %rbx, %rsi
callq 0x193f0
movq %r14, %rdi
callq 0x193e0
leaq 0x29dad(%rip), %rsi     # 0x51413
movq %r14, %rdi
callq 0x18d20
jmp 0x2768b
leaq 0x29cf9(%rip), %rdx     # 0x51370
jmp 0x27680
leaq 0x29be9(%rip), %rdx     # 0x51269
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x18ec0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r14
popq %r15
popq %rbp
retq