// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_cmds.c
// Function: Cmd_Fobserve_f
void Cmd_Fobserve_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: fobserve <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 force observer on them.\n", target->client->pers.netname);
		ctf_SafePrint(ent, PRINT_HIGH, message);
		return;
	}

	// 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 force observer on them.\n", target->client->pers.netname);
		ctf_SafePrint(ent, PRINT_HIGH, message);
		return;
	}

	sprintf(message, "%s was forced to observe 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, "observe\n");
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
movq $0x0, 0x8(%rsp)
movq 0x58(%rdi), %rax
testb $0x2, 0x1108(%rax)
jne 0x298a6
leaq 0x2c4c0(%rip), %rdx     # 0x55d4f
movl $0x2, %esi
movq %rbx, %rdi
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r14
jmp 0x18da0
movq 0x3fd53(%rip), %rax     # 0x69600
callq *0x148(%rax)
leaq 0x2a505(%rip), %rsi     # 0x53dbf
leaq 0x8(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x18fe0
testl %eax, %eax
je 0x29942
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
movl $0xfffffffc, %edx       # imm = 0xFFFFFFFC
callq 0x19170
testq %rax, %rax
je 0x2990e
xorl %r14d, %r14d
movq 0x58(%rax), %rcx
movq 0x9120(%rcx), %rcx
cmpq 0x8(%rsp), %rcx
cmoveq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movl $0xfffffffc, %edx       # imm = 0xFFFFFFFC
callq 0x19170
testq %rax, %rax
jne 0x298e6
testq %r14, %r14
je 0x2999b
movq 0x58(%r14), %rdx
movl 0x1108(%rdx), %eax
testb $0x2, %al
je 0x2994b
movq 0x58(%rbx), %rcx
testb $0x4, 0x1108(%rcx)
jne 0x2994b
addq $0x2c0, %rdx            # imm = 0x2C0
leaq 0x2c94c(%rip), %rsi     # 0x5628c
jmp 0x299b3
leaq 0x2c8df(%rip), %rdx     # 0x56228
jmp 0x299a2
addq $0x2c0, %rdx            # imm = 0x2C0
testb $0x4, %al
jne 0x299ac
movl $0x2c0, %ecx            # imm = 0x2C0
addq 0x58(%rbx), %rcx
leaq 0x2c990(%rip), %rsi     # 0x562f6
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19700
movl $0x2, %edi
movq %rbx, %rsi
callq 0x19270
movq %r14, %rdi
callq 0x19260
leaq 0x2c986(%rip), %rsi     # 0x56317
movq %r14, %rdi
callq 0x18c40
jmp 0x299d2
leaq 0x2c8c7(%rip), %rdx     # 0x56269
movl $0x2, %esi
movq %rbx, %rdi
jmp 0x299cd
leaq 0x2c90f(%rip), %rsi     # 0x562c2
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x19700
movl $0x2, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x18da0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r14
retq