// File: /workspace/github_c_makefile_star2_O3/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), %rax
testq %rax, %rax
je 0x3d987
movq %rdx, %rbx
movq 0x58(%rdx), %rcx
testq %rcx, %rcx
je 0x3d987
movq %rdi, %r14
movq %rax, %rdx
subq 0x2b6cc(%rip), %rdx     # 0x68e40
shrq $0x3, %rdx
imull $0xf0f0f0f1, %edx, %edx # imm = 0xF0F0F0F1
movslq %edx, %r15
cmpl $0x0, 0x318(%rcx,%r15,4)
je 0x3d856
movq 0x2ae69(%rip), %rax     # 0x68600
movq 0x20(%rax), %r12
leaq 0x1bb8e(%rip), %rdi     # 0x59330
callq *0x48(%rax)
movss 0x1577b(%rip), %xmm0    # 0x52f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r12
movq 0x2b79c(%rip), %rax     # 0x68f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss 0x161bd(%rip), %xmm0    # 0x53990
jne 0x3d7db
jnp 0x3d8d4
movq 0x330(%r14), %rax
movq (%rax), %rdi
leaq 0x1882d(%rip), %rsi     # 0x56019
callq 0x18b20
testl %eax, %eax
je 0x3d8e5
movq 0x2b540(%rip), %rax     # 0x68d40
movl 0x610(%rax), %ecx
testl %ecx, %ecx
jle 0x3d971
movq 0x2ad43(%rip), %rsi     # 0x68558
movl $0x508, %edx            # imm = 0x508
addq (%rsi), %rdx
xorl %esi, %esi
cmpl $0x0, (%rdx)
je 0x3d83f
movq -0x8(%rdx), %rdi
testq %rdi, %rdi
je 0x3d83f
movl $0x0, 0x318(%rdi,%r15,4)
movl 0x610(%rax), %ecx
movslq %ecx, %rdi
incq %rsi
addq $0x4a8, %rdx            # imm = 0x4A8
cmpq %rdi, %rsi
jl 0x3d81f
jmp 0x3d971
movq 0x2b543(%rip), %rcx     # 0x68da0
movss 0x4(%rcx), %xmm0
movss 0x240(%r14), %xmm1
ucomiss %xmm0, %xmm1
ja 0x3d987
addss 0x1568c(%rip), %xmm0    # 0x52f08
movss %xmm0, 0x240(%r14)
movq 0x2ad74(%rip), %r14     # 0x68600
movq 0x50(%rax), %rdx
leaq 0x1ba79(%rip), %rsi     # 0x59310
movq %rbx, %rdi
xorl %eax, %eax
callq *0x18(%r14)
movq 0x20(%r14), %r15
leaq 0x1ba75(%rip), %rdi     # 0x59320
callq *0x48(%r14)
movss 0x15671(%rip), %xmm0    # 0x52f28
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)
jmp 0x3d971
movq 0x58(%rbx), %rax
movl 0x740(%rax), %eax
xorl %ecx, %ecx
btl %ecx, %eax
jb 0x3d902
incl %ecx
cmpl $0x8, %ecx
jne 0x3d8f1
movl $0x8, %ecx
movq 0x2b437(%rip), %rax     # 0x68d40
movl 0x610(%rax), %edx
testl %edx, %edx
jle 0x3d971
movq 0x2ac3e(%rip), %r8      # 0x68558
movl $0x1, %esi
shll %cl, %esi
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
roll %cl, %edi
movl $0x508, %ecx            # imm = 0x508
addq (%r8), %rcx
xorl %r8d, %r8d
cmpl $0x0, (%rcx)
je 0x3d95f
movq -0x8(%rcx), %r9
testq %r9, %r9
je 0x3d95f
testl %esi, 0x740(%r9)
je 0x3d95f
decl 0x318(%r9,%r15,4)
andl %edi, 0x740(%r9)
movl 0x610(%rax), %edx
movslq %edx, %r9
incq %r8
addq $0x4a8, %rcx            # imm = 0x4A8
cmpq %r9, %r8
jl 0x3d933
movq %r14, %rdi
movq %rbx, %rsi
callq 0x198e0
movq $0x0, 0x228(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq