// File: /workspace/github_c_makefile_star2_O3/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 0x19370
testl %eax, %eax
je 0x31045
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x58(%r14)
je 0x3103c
cmpl $0x0, 0x254(%r14)
jle 0x3103c
movq 0x330(%rbx), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x3103c
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
movl %eax, %ebp
testl %eax, %eax
je 0x31182
movq 0x58(%r14), %rax
movl $0x3e800000, 0xeac(%rax) # imm = 0x3E800000
movq 0x37573(%rip), %r12     # 0x68600
movq 0x330(%rbx), %rax
movq 0x48(%rax), %rdi
callq *0x50(%r12)
movq 0x58(%r14), %rcx
movw %ax, 0x86(%rcx)
movq 0x330(%rbx), %rax
movl 0x37d8b(%rip), %edx     # 0x68e40
movl %eax, %esi
subl %edx, %esi
shrl $0x3, %esi
imull $0xfffff0f1, %esi, %edx # imm = 0xFFFFF0F1
leal 0x420(%rdx), %esi
movw %si, 0x88(%rcx)
movq 0x37cca(%rip), %rsi     # 0x68da0
movss 0x4(%rsi), %xmm0
addss 0x21e2d(%rip), %xmm0    # 0x52f10
movss %xmm0, 0xf24(%rcx)
cmpq $0x0, 0x10(%rax)
je 0x31102
movw %dx, 0x90(%rcx)
movswl %dx, %edx
movl %edx, 0x314(%rcx)
movq 0x8(%rax), %rcx
cmpq 0x37d6b(%rip), %rcx     # 0x68e78
je 0x31124
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x31182
movq 0x20(%r12), %r15
callq *0x48(%r12)
jmp 0x31167
movl 0x290(%rbx), %ecx
movq 0x20(%r12), %r15
movq 0x48(%r12), %rax
cmpl $0x19, %ecx
je 0x31155
cmpl $0xa, %ecx
je 0x3114c
cmpl $0x2, %ecx
jne 0x3115e
leaq 0x24f14(%rip), %rdi     # 0x5605e
jmp 0x31165
leaq 0x24f1e(%rip), %rdi     # 0x56071
jmp 0x31165
leaq 0x24f28(%rip), %rdi     # 0x56084
jmp 0x31165
leaq 0x25f1a(%rip), %rdi     # 0x5707f
callq *%rax
movss 0x21db9(%rip), %xmm0    # 0x52f28
xorps %xmm2, %xmm2
movq %r14, %rdi
movl $0x3, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movl 0x140(%rbx), %eax
btl $0x12, %eax
jb 0x311aa
movq %rbx, %rdi
movq %r14, %rsi
callq 0x198e0
movl $0x40000, %eax          # imm = 0x40000
orl 0x140(%rbx), %eax
movl %eax, 0x140(%rbx)
testl %ebp, %ebp
je 0x3103c
movq 0x37da7(%rip), %rcx     # 0x68f60
movq (%rcx), %rcx
movss 0x20(%rcx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x311cb
jnp 0x311e3
movq 0x330(%rbx), %rcx
testb $0x8, 0x68(%rcx)
je 0x311e3
andl $0x30000, %eax          # imm = 0x30000
je 0x3103c
movl 0x11c(%rbx), %eax
testl %eax, %eax
js 0x311fd
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x19a50
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, 0x11c(%rbx)
jmp 0x3103c