// File: /workspace/github_c_makefile_star2_O1/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 0x26de5
testb $0x30, 0x1108(%rax)
je 0x26dee
movq %rsi, %r14
movq %rbx, %rdi
callq 0x195b0
testl %eax, %eax
je 0x26f34
movl $0xc0, %edi
addq 0x58(%rbx), %rdi
leaq 0x2c5d8(%rip), %rsi     # 0x53340
callq 0x18bb0
cmpb $0x5f, (%r14)
movq %r14, 0x8(%rsp)
je 0x26e13
movq %rax, %r15
leaq 0x2e843(%rip), %rsi     # 0x555c9
movl $0x5, %edx
movq %r14, %rdi
callq 0x181e0
testl %eax, %eax
je 0x26e13
leaq 0x2e831(%rip), %rsi     # 0x555cf
movl $0x4, %edx
movq %r14, %rdi
callq 0x181e0
testl %eax, %eax
je 0x26e13
movb (%r15), %al
addb $-0x46, %al
testb $-0x21, %al
leaq 0x2e826(%rip), %rax     # 0x555e3
leaq 0x2c2bc(%rip), %rcx     # 0x53080
cmoveq %rax, %rcx
leaq 0x2e818(%rip), %rdx     # 0x555e7
leaq 0x10(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
movq %r14, %r8
xorl %eax, %eax
callq 0x18e10
jmp 0x26e2e
leaq 0x2e7af(%rip), %rdx     # 0x5559b
jmp 0x26df5
leaq 0x2e7c0(%rip), %rdx     # 0x555b5
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 0x2e7ba(%rip), %rdx     # 0x555d4
leaq 0x10(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
movq %r14, %rcx
xorl %eax, %eax
callq 0x18e10
movq 0x42f0b(%rip), %rax     # 0x69d40
cmpl $0x0, 0x610(%rax)
jle 0x26f04
movl $0x4a8, %r13d           # imm = 0x4A8
xorl %r14d, %r14d
movq 0x42706(%rip), %rax     # 0x69558
movq (%rax), %r15
cmpl $0x0, 0x60(%r15,%r13)
je 0x26ee3
movq 0x58(%r15,%r13), %r12
testq %r12, %r12
je 0x26ee3
leaq (%r15,%r13), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x18700
testl %eax, %eax
je 0x26ee3
movl 0x1108(%r12), %eax
testb $0x30, %al
je 0x26ee3
testb $0x20, %al
je 0x26e9b
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x18c40
movq 0x58(%r15,%r13), %rax
testb $0x10, 0x1108(%rax)
je 0x26ee3
movq 0x58(%rbx), %rdx
movl $0x2c0, %eax            # imm = 0x2C0
addq %rax, %rdx
leaq 0x210(%rsp), %r15
movq %r15, %rdi
leaq 0x2e732(%rip), %rsi     # 0x555f9
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x19700
movl $0x2, %esi
movq %rbp, %rdi
movq %r15, %rdx
callq 0x18da0
movq 0x42e56(%rip), %rax     # 0x69d40
movslq 0x610(%rax), %rax
incq %r14
addq $0x4a8, %r13            # imm = 0x4A8
cmpq %rax, %r14
jl 0x26e4b
movq 0x426f5(%rip), %rcx     # 0x69600
movl $0x2c0, %esi            # imm = 0x2C0
addq 0x58(%rbx), %rsi
leaq 0x2e6de(%rip), %rdi     # 0x555f9
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