// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_utils.c
// Function: G_UseTargets
void G_UseTargets (edict_t *ent, edict_t *activator)
{
	edict_t		*t;

//
// check for a delay
//
	if (ent->delay)
	{
	// create a temp object to fire at a later time
		t = G_Spawn();
		t->classname = "DelayedUse";
		t->nextthink = level.time + ent->delay;
		t->think = Think_Delay;
		t->activator = activator;
		if (!activator)
			gi.dprintf ("Think_Delay with no activator\n");
		t->message = ent->message;
		t->target = ent->target;
		t->killtarget = ent->killtarget;
		return;
	}
	
	
//
// print the message
//
	if ((ent->message) && !(activator->svflags & SVF_MONSTER))
	{
		gi.centerprintf (activator, "%s", ent->message);
		if (ent->noise_index)
			gi.sound (activator, CHAN_AUTO, ent->noise_index, 1, ATTN_NORM, 0);
		else
			gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0);
	}

//
// kill killtargets
//
	if (ent->killtarget)
	{
		t = NULL;
		while ((t = G_Find (t, FOFS(targetname), ent->killtarget)) != NULL)
		{
			G_FreeEdict (t);
			if (!ent->inuse)
			{
				gi.dprintf("entity was removed while using killtargets\n");
				return;
			}
		}
	}

//
// fire targets
//
	if (ent->target)
	{
		t = NULL;
		while ((t = G_Find (t, FOFS(targetname), ent->target)) != NULL)
		{
			// doors fire area portals in a specific way
			if (!Q_stricmp(t->classname, "func_areaportal") &&
				(!Q_stricmp(ent->classname, "func_door") || !Q_stricmp(ent->classname, "func_door_rotating")))
				continue;

			if (t == ent)
			{
				gi.dprintf ("WARNING: Entity used itself.\n");
			}
			else
			{
				if (t->use)
					t->use (t, ent, activator);
			}
			if (!ent->inuse)
			{
				gi.dprintf("entity was removed while using targets\n");
				return;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movss 0x2fc(%rdi), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3ed01
jnp 0x3ed9a
callq 0x19710
movq %rax, %r15
leaq 0x1b57d(%rip), %rax     # 0x5a28d
movq %rax, 0x138(%r15)
movq 0x2b082(%rip), %rax     # 0x69da0
movss 0x4(%rax), %xmm0
addss 0x2fc(%rbx), %xmm0
movss %xmm0, 0x200(%r15)
movq 0x2acb5(%rip), %rax     # 0x699f0
movq %rax, 0x210(%r15)
movq %r14, 0x2b0(%r15)
testq %r14, %r14
jne 0x3ed61
movq 0x2a8ab(%rip), %rcx     # 0x69600
leaq 0x1b53c(%rip), %rdi     # 0x5a298
xorl %eax, %eax
callq *0x8(%rcx)
movq 0x130(%rbx), %rax
movq %rax, 0x130(%r15)
movq 0x150(%rbx), %rax
movq %rax, 0x150(%r15)
movq 0x160(%rbx), %rax
movq %rax, 0x160(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x130(%rbx), %rdx
testq %rdx, %rdx
je 0x3edfb
testb $0x4, 0xc8(%r14)
jne 0x3edfb
movq 0x2a849(%rip), %r12     # 0x69600
leaq 0x14bef(%rip), %rsi     # 0x539ad
movq %r14, %rdi
xorl %eax, %eax
callq *0x18(%r12)
movl 0x2e8(%rbx), %edx
movq 0x20(%r12), %r15
testl %edx, %edx
jne 0x3ede5
leaq 0x17eb9(%rip), %rdi     # 0x56c97
callq *0x48(%r12)
movl %eax, %edx
movss 0x1513b(%rip), %xmm0    # 0x53f28
xorps %xmm2, %xmm2
movq %r14, %rdi
xorl %esi, %esi
movaps %xmm0, %xmm1
callq *%r15
cmpq $0x0, 0x160(%rbx)
je 0x3ee49
xorl %r15d, %r15d
movq 0x160(%rbx), %rdx
movq %r15, %rdi
movl $0x158, %esi            # imm = 0x158
callq 0x19430
testq %rax, %rax
je 0x3ee49
movq %rax, %r15
movq %rax, %rdi
callq 0x19a60
cmpl $0x0, 0x60(%rbx)
jne 0x3ee08
movq 0x2a7c7(%rip), %rax     # 0x69600
movq 0x8(%rax), %rcx
leaq 0x1b473(%rip), %rdi     # 0x5a2b7
jmp 0x3ef2a
cmpq $0x0, 0x150(%rbx)
je 0x3ed8b
movq 0x150(%rbx), %rdx
xorl %edi, %edi
movl $0x158, %esi            # imm = 0x158
callq 0x19430
testq %rax, %rax
je 0x3ed8b
movq %rax, %r15
leaq 0x17ded(%rip), %r12     # 0x56c6a
leaq 0x17df6(%rip), %r13     # 0x56c7a
movq 0x2a775(%rip), %rbp     # 0x69600
movq 0x138(%r15), %rdi
movq %r12, %rsi
callq 0x18690
testl %eax, %eax
je 0x3eebc
cmpq %rbx, %r15
je 0x3eee8
movq 0x228(%r15), %rax
testq %rax, %rax
je 0x3eef4
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *%rax
jmp 0x3eef4
movq 0x138(%rbx), %rdi
movq %r13, %rsi
callq 0x18690
testl %eax, %eax
je 0x3eefa
movq 0x138(%rbx), %rdi
leaq 0x17da7(%rip), %rsi     # 0x56c84
callq 0x18690
testl %eax, %eax
jne 0x3ee9e
jmp 0x3eefa
leaq 0x1b3f4(%rip), %rdi     # 0x5a2e3
xorl %eax, %eax
callq *0x8(%rbp)
cmpl $0x0, 0x60(%rbx)
je 0x3ef1f
movq 0x150(%rbx), %rdx
movq %r15, %rdi
movl $0x158, %esi            # imm = 0x158
callq 0x19430
movq %rax, %r15
testq %rax, %rax
jne 0x3ee8b
jmp 0x3ed8b
movq 0x8(%rbp), %rcx
leaq 0x1b3d7(%rip), %rdi     # 0x5a301
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx