// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rdi, %rbx
movss 0x2fc(%rdi), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3e460
jnp 0x3e4f9
callq 0x19700
movq %rax, %r15
leaq 0x1b02e(%rip), %rax     # 0x5949d
movq %rax, 0x138(%r15)
movq 0x2a923(%rip), %rax     # 0x68da0
movss 0x4(%rax), %xmm0
addss 0x2fc(%rbx), %xmm0
movss %xmm0, 0x200(%r15)
movq 0x2a556(%rip), %rax     # 0x689f0
movq %rax, 0x210(%r15)
movq %r12, 0x2b0(%r15)
testq %r12, %r12
jne 0x3e4c0
movq 0x2a14c(%rip), %rcx     # 0x68600
leaq 0x1afed(%rip), %rdi     # 0x594a8
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 0x3e558
testb $0x4, 0xc8(%r12)
jne 0x3e558
movq 0x2a0e9(%rip), %r15     # 0x68600
leaq 0x1448f(%rip), %rsi     # 0x529ad
movq %r12, %rdi
xorl %eax, %eax
callq *0x18(%r15)
movl 0x2e8(%rbx), %edx
movq 0x20(%r15), %r14
testl %edx, %edx
jne 0x3e542
leaq 0x17853(%rip), %rdi     # 0x55d8f
callq *0x48(%r15)
movl %eax, %edx
movss 0x149de(%rip), %xmm0    # 0x52f28
xorps %xmm2, %xmm2
movq %r12, %rdi
xorl %esi, %esi
movaps %xmm0, %xmm1
callq *%r14
movq %r12, (%rsp)
cmpq $0x0, 0x160(%rbx)
je 0x3e630
xorl %r15d, %r15d
movq 0x2a08c(%rip), %r12     # 0x68600
movq 0x29fdd(%rip), %r13     # 0x68558
movabsq $-0x20a4f089731d3543, %rbp # imm = 0xDF5B0F768CE2CABD
movq 0x29fa4(%rip), %r14     # 0x68530
movq 0x160(%rbx), %rdx
movq %r15, %rdi
movl $0x158, %esi            # imm = 0x158
callq 0x19430
testq %rax, %rax
je 0x3e630
movq %rax, %r15
movq %rax, %rdi
callq *0x98(%r12)
movq %r15, %rax
subq (%r13), %rax
sarq $0x3, %rax
imulq %rbp, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movq (%r14), %rax
movss 0x20(%rax), %xmm1
addss 0x1491e(%rip), %xmm1    # 0x52efc
ucomiss %xmm0, %xmm1
jae 0x3e615
movl $0x4a8, %edx            # imm = 0x4A8
movq %r15, %rdi
xorl %esi, %esi
callq 0x18880
leaq 0x1af6c(%rip), %rax     # 0x59565
movq %rax, 0x138(%r15)
movq 0x2a799(%rip), %rax     # 0x68da0
movss 0x4(%rax), %xmm0
movss %xmm0, 0x128(%r15)
cmpl $0x0, 0x60(%rbx)
jne 0x3e58c
movq 0x8(%r12), %rcx
leaq 0x1ae9c(%rip), %rdi     # 0x594c7
jmp 0x3e710
movq 0x150(%rbx), %rdx
testq %rdx, %rdx
movq (%rsp), %r14
je 0x3e4ea
xorl %edi, %edi
movl $0x158, %esi            # imm = 0x158
callq 0x19430
testq %rax, %rax
je 0x3e4ea
movq %rax, %r15
leaq 0x176ff(%rip), %r12     # 0x55d62
leaq 0x17708(%rip), %r13     # 0x55d72
movq 0x29f8f(%rip), %rbp     # 0x68600
movq 0x138(%r15), %rdi
movq %r12, %rsi
callq 0x18690
testl %eax, %eax
je 0x3e6a2
cmpq %rbx, %r15
je 0x3e6ce
movq 0x228(%r15), %rax
testq %rax, %rax
je 0x3e6da
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *%rax
jmp 0x3e6da
movq 0x138(%rbx), %rdi
movq %r13, %rsi
callq 0x18690
testl %eax, %eax
je 0x3e6e0
movq 0x138(%rbx), %rdi
leaq 0x176b9(%rip), %rsi     # 0x55d7c
callq 0x18690
testl %eax, %eax
jne 0x3e684
jmp 0x3e6e0
leaq 0x1ae1e(%rip), %rdi     # 0x594f3
xorl %eax, %eax
callq *0x8(%rbp)
cmpl $0x0, 0x60(%rbx)
je 0x3e705
movq 0x150(%rbx), %rdx
movq %r15, %rdi
movl $0x158, %esi            # imm = 0x158
callq 0x19430
movq %rax, %r15
testq %rax, %rax
jne 0x3e671
jmp 0x3e4ea
movq 0x8(%rbp), %rcx
leaq 0x1ae01(%rip), %rdi     # 0x59511
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx