// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_trigger.c
// Function: trigger_key_use
void trigger_key_use (edict_t *self, edict_t *other, edict_t *activator)
{
	int			index;

	if (!self->item)
		return;
	if (!activator->client)
		return;

	index = ITEM_INDEX(self->item);
	if (!activator->client->pers.inventory[index])
	{
		if (level.time < self->touch_debounce_time)
			return;
		self->touch_debounce_time = level.time + 5.0;
		gi.centerprintf (activator, "You need the %s", self->item->pickup_name);
		gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/keytry.wav"), 1, ATTN_NORM, 0);
		return;
	}

	gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/keyuse.wav"), 1, ATTN_NORM, 0);
	if (coop->value)
	{
		int		player;
		edict_t	*ent;

		if (strcmp(self->item->classname, "key_power_cube") == 0)
		{
			int	cube;

			for (cube = 0; cube < 8; cube++)
				if (activator->client->pers.power_cubes & (1 << cube))
					break;
			for (player = 1; player <= game.maxclients; player++)
			{
				ent = &g_edicts[player];
				if (!ent->inuse)
					continue;
				if (!ent->client)
					continue;
				if (ent->client->pers.power_cubes & (1 << cube))
				{
					ent->client->pers.inventory[index]--;
					ent->client->pers.power_cubes &= ~(1 << cube);
				}
			}
		}
		else
		{
			for (player = 1; player <= game.maxclients; player++)
			{
				ent = &g_edicts[player];
				if (!ent->inuse)
					continue;
				if (!ent->client)
					continue;
				ent->client->pers.inventory[index] = 0;
			}
		}
	}
	else
	{
		activator->client->pers.inventory[index]--;
	}

	G_UseTargets (self, activator);

	self->use = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x330(%rdi), %rcx
testq %rcx, %rcx
je 0x3a578
movq %rdx, %rbx
movq 0x58(%rdx), %rsi
testq %rsi, %rsi
je 0x3a578
movq %rdi, %r14
movq %rcx, %rax
subq 0x2ca3a(%rip), %rax     # 0x66e40
movl $0x88, %edi
cqto
idivq %rdi
movslq %eax, %r15
cmpl $0x0, 0x318(%rsi,%r15,4)
je 0x3a4df
movq 0x2c1d7(%rip), %rax     # 0x66600
movq 0x20(%rax), %r12
leaq 0x1aedc(%rip), %rdi     # 0x55310
callq *0x48(%rax)
movss 0x14ae9(%rip), %xmm0    # 0x4ef28
xorps %xmm2, %xmm2
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r12
movq 0x2cb0a(%rip), %rax     # 0x66f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss 0x1552b(%rip), %xmm0    # 0x4f990
jne 0x3a46d
jnp 0x3a559
movq 0x330(%r14), %rax
movq (%rax), %rdi
leaq 0x17b7b(%rip), %rsi     # 0x51ff9
callq 0x18bc0
testl %eax, %eax
je 0x3a584
movq 0x2c0c6(%rip), %rsi     # 0x66558
movq 0x2c8a7(%rip), %rax     # 0x66d40
movl 0x610(%rax), %edx
movl $0x508, %ecx            # imm = 0x508
addq (%rsi), %rcx
pushq $0x1
popq %rsi
movslq %edx, %rdi
cmpq %rdi, %rsi
jg 0x3a565
cmpl $0x0, (%rcx)
je 0x3a4d3
movq -0x8(%rcx), %rdi
testq %rdi, %rdi
je 0x3a4d3
andl $0x0, 0x318(%rdi,%r15,4)
movl 0x610(%rax), %edx
incq %rsi
addq $0x4a8, %rcx            # imm = 0x4A8
jmp 0x3a4aa
movq 0x2c8ba(%rip), %rax     # 0x66da0
movss 0x4(%rax), %xmm0
movss 0x240(%r14), %xmm1
ucomiss %xmm0, %xmm1
ja 0x3a578
addss 0x14a03(%rip), %xmm0    # 0x4ef04
movss %xmm0, 0x240(%r14)
movq 0x2c0ef(%rip), %r14     # 0x66600
movq 0x50(%rcx), %rdx
leaq 0x1add4(%rip), %rsi     # 0x552f0
movq %rbx, %rdi
xorl %eax, %eax
callq *0x18(%r14)
movq 0x20(%r14), %r15
leaq 0x1add0(%rip), %rdi     # 0x55300
callq *0x48(%r14)
movss 0x149ec(%rip), %xmm0    # 0x4ef28
xorps %xmm2, %xmm2
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
movq 0x58(%rbx), %rax
decl 0x318(%rax,%r15,4)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x19ac0
andq $0x0, 0x228(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorl %ecx, %ecx
cmpl $0x8, %ecx
je 0x3a59e
movq 0x58(%rbx), %rax
movl 0x740(%rax), %eax
btl %ecx, %eax
jb 0x3a59e
incl %ecx
jmp 0x3a586
pushq $0x1
popq %rax
shll %cl, %eax
pushq $-0x2
popq %rdx
roll %cl, %edx
movq 0x2bfa9(%rip), %r8      # 0x66558
movq 0x2c78a(%rip), %rcx     # 0x66d40
movl 0x610(%rcx), %edi
movl $0x508, %esi            # imm = 0x508
addq (%r8), %rsi
pushq $0x1
popq %r8
movslq %edi, %r9
cmpq %r9, %r8
jg 0x3a565
cmpl $0x0, (%rsi)
je 0x3a5fc
movq -0x8(%rsi), %r9
testq %r9, %r9
je 0x3a5fc
testl %eax, 0x740(%r9)
je 0x3a5fc
decl 0x318(%r9,%r15,4)
andl %edx, 0x740(%r9)
movl 0x610(%rcx), %edi
incq %r8
addq $0x4a8, %rsi            # imm = 0x4A8
jmp 0x3a5c8