// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_cmds.c
// Function: PlayTeamSound
void PlayTeamSound(edict_t *ent, char *sound)
{
	char	command [MAX_INFO_STRING];
	int j;
	edict_t	*other;
	char	*s, *gender;
	char message[MAX_INFO_STRING];

	//bat
	//if (ent->client->ctf.teamnum == CTF_TEAM_OBSERVER)
	if (ent->client->ctf.teamnum <= CTF_TEAM_OBSERVER)
	{
		ctf_SafePrint(ent, PRINT_HIGH, "Observers have no radio.\n");
		return;
	}

	if ( ! (ent->client->ctf.extra_flags &
			(CTF_EXTRAFLAGS_RADIO_TEXT | CTF_EXTRAFLAGS_RADIO_SOUND) )  )
	{
		ctf_SafePrint(ent, PRINT_HIGH, "Your radio is off!\n");
		return;
	}

	if (!ctf_SpamCheck(ent))
		return;

	s = Info_ValueForKey (ent->client->pers.userinfo, "skin");

	// decide gender

	if (sound[0] == '_' || !strncmp(sound, "male_", 5)	|| !strncmp(sound, "fem_", 4))
	{
		Com_sprintf (command, sizeof(command), "play radio/%s\n", sound);
	}
	else // Append gender
	{
		if (s[0] == 'f' || s[0] == 'F') // Female
		{
			gender = "fem";
		}
		else
		{
			gender = "male";
		}

		Com_sprintf (command, sizeof(command), "play radio/%s_%s\n", gender, sound);
	}

	for (j = 1; j <= game.maxclients; j++)
	{
		other = &g_edicts[j];
		if (!other->inuse)
			continue;
		if (!other->client)
			continue;
		if (!OnSameTeam(ent, other))
			continue;

		// Check if player has radio turned off
		if ( ! (other->client->ctf.extra_flags &
				(CTF_EXTRAFLAGS_RADIO_TEXT | CTF_EXTRAFLAGS_RADIO_SOUND) )  )
			continue;

		if (other->client->ctf.extra_flags & CTF_EXTRAFLAGS_RADIO_SOUND)
			ForceCommand (other, command);

		if (other->client->ctf.extra_flags & CTF_EXTRAFLAGS_RADIO_TEXT)
		{
			sprintf(message, "%s (radiotext): %s\n",
				ent->client->pers.netname, sound);
			ctf_SafePrint(other, PRINT_HIGH, message);
		}
	}
	gi.dprintf("%s (radiotext): %s\n",
			ent->client->pers.netname, sound);

	ent->client->spam_band_count -= CTF_SPAM_BAND_RADIO; //units of spam control for the radio
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rdi, %rbx
movq 0x58(%rdi), %rax
cmpl $0x0, 0x1100(%rax)
js 0x26bf5
testb $0x30, 0x1108(%rax)
je 0x26bfe
movq %rsi, %r14
movq %rbx, %rdi
callq 0x195b0
testl %eax, %eax
je 0x26d45
movl $0xc0, %edi
addq 0x58(%rbx), %rdi
leaq 0x2b7c8(%rip), %rsi     # 0x52340
callq 0x18bb0
cmpb $0x5f, (%r14)
movq %r14, 0x8(%rsp)
je 0x26c23
movq %rax, %r15
leaq 0x2da53(%rip), %rsi     # 0x545e9
movl $0x5, %edx
movq %r14, %rdi
callq 0x181e0
testl %eax, %eax
je 0x26c23
leaq 0x2da41(%rip), %rsi     # 0x545ef
movl $0x4, %edx
movq %r14, %rdi
callq 0x181e0
testl %eax, %eax
je 0x26c23
movb (%r15), %al
addb $-0x46, %al
testb $-0x21, %al
leaq 0x2da36(%rip), %rax     # 0x54603
leaq 0x2b4ac(%rip), %rcx     # 0x52080
cmoveq %rax, %rcx
leaq 0x2da28(%rip), %rdx     # 0x54607
leaq 0x10(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
movq %r14, %r8
xorl %eax, %eax
callq 0x18e10
jmp 0x26c3e
leaq 0x2d9bf(%rip), %rdx     # 0x545bb
jmp 0x26c05
leaq 0x2d9d0(%rip), %rdx     # 0x545d5
movl $0x2, %esi
movq %rbx, %rdi
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18da0
leaq 0x2d9ca(%rip), %rdx     # 0x545f4
leaq 0x10(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
movq %r14, %rcx
xorl %eax, %eax
callq 0x18e10
movq 0x420fb(%rip), %rax     # 0x68d40
cmpl $0x0, 0x610(%rax)
jle 0x26d15
movl $0x4a8, %r13d           # imm = 0x4A8
xorl %r14d, %r14d
movq 0x418f6(%rip), %rax     # 0x68558
movq (%rax), %r15
cmpl $0x0, 0x60(%r15,%r13)
je 0x26cf4
movq 0x58(%r15,%r13), %r12
testq %r12, %r12
je 0x26cf4
leaq (%r15,%r13), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x18700
testl %eax, %eax
je 0x26cf4
movl 0x1108(%r12), %eax
testb $0x30, %al
je 0x26cf4
testb $0x20, %al
je 0x26cb6
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x18c40
movq 0x58(%r15,%r13), %rax
movl 0x1108(%rax), %eax
testb $0x10, %al
je 0x26cf4
movq 0x58(%rbx), %rdx
movl $0x2c0, %eax            # imm = 0x2C0
addq %rax, %rdx
leaq 0x210(%rsp), %r15
movq %r15, %rdi
leaq 0x2d941(%rip), %rsi     # 0x54619
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x196f0
movl $0x2, %esi
movq %rbp, %rdi
movq %r15, %rdx
callq 0x18da0
movq 0x42045(%rip), %rax     # 0x68d40
movslq 0x610(%rax), %rax
incq %r14
addq $0x4a8, %r13            # imm = 0x4A8
cmpq %rax, %r14
jl 0x26c5b
movq 0x418e4(%rip), %rcx     # 0x68600
movl $0x2c0, %esi            # imm = 0x2C0
addq 0x58(%rbx), %rsi
leaq 0x2d8ed(%rip), %rdi     # 0x54619
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq *0x8(%rcx)
movq 0x58(%rbx), %rax
addq $-0x96, 0x10e0(%rax)
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq