// File: /workspace/github_c_makefile_star2_O1/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 0x3e2c0
movq %rdx, %rbx
movq 0x58(%rdx), %rcx
testq %rcx, %rcx
je 0x3e2c0
movq %rdi, %r14
movq %rax, %rdx
subq 0x2bd8c(%rip), %rdx     # 0x69e40
shrq $0x3, %rdx
imull $0xf0f0f0f1, %edx, %edx # imm = 0xF0F0F0F1
movslq %edx, %r15
cmpl $0x0, 0x318(%rcx,%r15,4)
je 0x3e193
movq 0x2b529(%rip), %rax     # 0x69600
movq 0x20(%rax), %r12
leaq 0x1c03e(%rip), %rdi     # 0x5a120
callq *0x48(%rax)
movss 0x15e3b(%rip), %xmm0    # 0x53f28
xorps %xmm2, %xmm2
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r12
movq 0x2be5c(%rip), %rax     # 0x69f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss 0x1684d(%rip), %xmm0    # 0x54960
jne 0x3e11b
jnp 0x3e211
movq 0x330(%r14), %rax
movq (%rax), %rdi
leaq 0x18df9(%rip), %rsi     # 0x56f25
callq 0x18b20
testl %eax, %eax
je 0x3e222
movq 0x2bc00(%rip), %rax     # 0x69d40
cmpl $0x0, 0x610(%rax)
jle 0x3e2aa
movq 0x2b404(%rip), %rdx     # 0x69558
movl $0x508, %ecx            # imm = 0x508
addq (%rdx), %rcx
xorl %edx, %edx
cmpl $0x0, (%rcx)
je 0x3e178
movq -0x8(%rcx), %rsi
testq %rsi, %rsi
je 0x3e178
movl $0x0, 0x318(%rsi,%r15,4)
movslq 0x610(%rax), %rsi
incq %rdx
addq $0x4a8, %rcx            # imm = 0x4A8
cmpq %rsi, %rdx
jl 0x3e15e
jmp 0x3e2aa
movq 0x2bc06(%rip), %rcx     # 0x69da0
movss 0x4(%rcx), %xmm0
movss 0x240(%r14), %xmm1
ucomiss %xmm0, %xmm1
ja 0x3e2c0
addss 0x15d4b(%rip), %xmm0    # 0x53f04
movss %xmm0, 0x240(%r14)
movq 0x2b437(%rip), %r14     # 0x69600
movq 0x50(%rax), %rdx
leaq 0x1bf2c(%rip), %rsi     # 0x5a100
movq %rbx, %rdi
xorl %eax, %eax
callq *0x18(%r14)
movq 0x20(%r14), %r15
leaq 0x1bf28(%rip), %rdi     # 0x5a110
callq *0x48(%r14)
movss 0x15d34(%rip), %xmm0    # 0x53f28
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 0x3e2aa
movq 0x58(%rbx), %rax
movl 0x740(%rax), %eax
xorl %ecx, %ecx
btl %ecx, %eax
jb 0x3e23f
incl %ecx
cmpl $0x8, %ecx
jne 0x3e22e
movl $0x8, %ecx
movq 0x2bafa(%rip), %rax     # 0x69d40
cmpl $0x0, 0x610(%rax)
jle 0x3e2aa
movq 0x2b302(%rip), %rdi     # 0x69558
movl $0x1, %edx
shll %cl, %edx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
roll %cl, %esi
movl $0x508, %ecx            # imm = 0x508
addq (%rdi), %rcx
xorl %edi, %edi
cmpl $0x0, (%rcx)
je 0x3e294
movq -0x8(%rcx), %r8
testq %r8, %r8
je 0x3e294
testl %edx, 0x740(%r8)
je 0x3e294
decl 0x318(%r8,%r15,4)
andl %esi, 0x740(%r8)
movslq 0x610(%rax), %r8
incq %rdi
addq $0x4a8, %rcx            # imm = 0x4A8
cmpq %r8, %rdi
jl 0x3e26e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x198f0
movq $0x0, 0x228(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq