// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_items.c
// Function: Touch_Item
void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{
	qboolean	taken;

	if (Match_InCountdown())
		return;

	if (!other->client)
		return;
	if (other->health < 1)
		return;		// dead people can't pickup
	if (!ent->item->pickup)
		return;		// not a grabbable item?

	taken = ent->item->pickup(ent, other);

	if (taken)
	{
		// flash the screen
		other->client->bonus_alpha = 0.25;	

		// show icon and name on status bar
		other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
		other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
		other->client->pickup_msg_time = level.time + 3.0;

		// change selected item
		if (ent->item->use)
			other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);

		if (ent->item->pickup == Pickup_Health)
		{
			if (ent->count == 2)
				gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
			else if (ent->count == 10)
				gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
			else if (ent->count == 25)
				gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
			else // (ent->count == 100)
				gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
		}
		else if (ent->item->pickup_sound)
		{
			gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
		}
	}

	if (!(ent->spawnflags & ITEM_TARGETS_USED))
	{
		G_UseTargets (ent, other);
		ent->spawnflags |= ITEM_TARGETS_USED;
	}

	if (!taken)
		return;

	if (!((coop->value) &&  (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)))
	{
		if (ent->flags & FL_RESPAWN)
			ent->flags &= ~FL_RESPAWN;
		else
			G_FreeEdict (ent);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
callq 0x19510
testl %eax, %eax
je 0x2e67b
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x58(%r14)
je 0x2e672
cmpl $0x0, 0x254(%r14)
jle 0x2e672
movq 0x330(%rbx), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x2e672
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
movl %eax, %ebp
testl %eax, %eax
je 0x2e7b5
movq 0x58(%r14), %rax
movl $0x3e800000, 0xeac(%rax) # imm = 0x3E800000
movq 0x37f3d(%rip), %r12     # 0x66600
movq 0x330(%rbx), %rax
movq 0x48(%rax), %rdi
callq *0x50(%r12)
movq 0x58(%r14), %rsi
movw %ax, 0x86(%rsi)
movq 0x330(%rbx), %rcx
movq %rcx, %rax
subq 0x38751(%rip), %rax     # 0x66e40
movl $0x88, %edi
cqto
idivq %rdi
leal 0x420(%rax), %edx
movw %dx, 0x88(%rsi)
movq 0x38693(%rip), %rdx     # 0x66da0
movss 0x4(%rdx), %xmm0
addss 0x207f2(%rip), %xmm0    # 0x4ef0c
movss %xmm0, 0xf24(%rsi)
cmpq $0x0, 0x10(%rcx)
je 0x2e737
movw %ax, 0x90(%rsi)
cwtl
movl %eax, 0x314(%rsi)
movq 0x8(%rcx), %rax
cmpq 0x38736(%rip), %rax     # 0x66e78
je 0x2e759
movq 0x28(%rcx), %rdi
testq %rdi, %rdi
je 0x2e7b5
movq 0x20(%r12), %r15
callq *0x48(%r12)
jmp 0x2e79c
movl 0x290(%rbx), %ecx
movq 0x20(%r12), %r15
movq 0x48(%r12), %rax
cmpl $0x19, %ecx
je 0x2e78a
cmpl $0xa, %ecx
je 0x2e781
cmpl $0x2, %ecx
jne 0x2e793
leaq 0x238bf(%rip), %rdi     # 0x5203e
jmp 0x2e79a
leaq 0x238c9(%rip), %rdi     # 0x52051
jmp 0x2e79a
leaq 0x238d3(%rip), %rdi     # 0x52064
jmp 0x2e79a
leaq 0x248c5(%rip), %rdi     # 0x5305f
callq *%rax
pushq $0x3
popq %rsi
movss 0x20781(%rip), %xmm0    # 0x4ef28
xorps %xmm2, %xmm2
movq %r14, %rdi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movl 0x140(%rbx), %eax
btl $0x12, %eax
jb 0x2e7dd
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19ac0
movl $0x40000, %eax          # imm = 0x40000
orl 0x140(%rbx), %eax
movl %eax, 0x140(%rbx)
testl %ebp, %ebp
je 0x2e672
movq 0x38774(%rip), %rcx     # 0x66f60
movq (%rcx), %rcx
movss 0x20(%rcx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2e7fe
jnp 0x2e816
movq 0x330(%rbx), %rcx
testb $0x8, 0x68(%rcx)
je 0x2e816
andl $0x30000, %eax          # imm = 0x30000
je 0x2e672
movl 0x11c(%rbx), %eax
testl %eax, %eax
js 0x2e830
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x19c50
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, 0x11c(%rbx)
jmp 0x2e672