// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: Pickup_Weapon
qboolean Pickup_Weapon (edict_t *ent, edict_t *other)
{
	int			index;
	gitem_t		*ammo;


	if(matchstate == MATCH_RAILGUN_INPLAY)
		return(false);

	index = ITEM_INDEX(ent->item);

	if ( ( ((int)(dmflags->value) & DF_WEAPONS_STAY) || coop->value) 
		&& other->client->pers.inventory[index])
	{
		if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM) ) )
			return false;	// leave the weapon for others to pickup
	}

	other->client->pers.inventory[index]++;

	if (!(ent->spawnflags & DROPPED_ITEM) )
	{
		// give them some ammo with it
		ammo = FindItem (ent->item->ammo);
		if ( (int)dmflags->value & DF_INFINITE_AMMO )
			Add_Ammo (other, ammo, 1000);
		else
			Add_Ammo (other, ammo, ammo->quantity);

		if (! (ent->spawnflags & DROPPED_PLAYER_ITEM) )
		{
			if (deathmatch->value)
			{
				if ((int)(dmflags->value) & DF_WEAPONS_STAY)
					ent->flags |= FL_RESPAWN;
				else
					SetRespawn (ent, 30);
			}
			if (coop->value)
				ent->flags |= FL_RESPAWN;
		}
	}

	if (other->client->pers.weapon != ent->item && 
		(other->client->pers.inventory[index] == 1) &&
		( !deathmatch->value || other->client->pers.weapon == FindItem("blaster") ) )
		other->client->newweapon = ent->item;

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x1c448(%rip), %rax     # 0x687d8
xorl %ebp, %ebp
cmpl $0x6, (%rax)
je 0x4c529
movq %rsi, %rbx
movq %rdi, %r14
movq 0x330(%rdi), %rax
movq %rax, %rdx
subq 0x1ca8e(%rip), %rdx     # 0x68e40
sarq $0x3, %rdx
movabsq $-0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F1
imulq %rdx, %rcx
movq 0x1c24d(%rip), %r12     # 0x68618
movq (%r12), %rdx
cvttss2si 0x20(%rdx), %edx
testb $0x4, %dl
jne 0x4c3f2
movq 0x1cb80(%rip), %rdx     # 0x68f60
movq (%rdx), %rdx
movss 0x20(%rdx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4c3f2
jnp 0x4c413
movq 0x58(%rbx), %rdx
movslq %ecx, %r15
cmpl $0x0, 0x318(%rdx,%r15,4)
je 0x4c41a
testb $0x3, 0x142(%r14)
jne 0x4c41a
jmp 0x4c529
movq 0x58(%rbx), %rdx
movslq %ecx, %r15
incl 0x318(%rdx,%r15,4)
testb $0x1, 0x142(%r14)
jne 0x4c4c6
movq 0x60(%rax), %rdi
callq 0x189e0
movq (%r12), %rcx
cvttss2si 0x20(%rcx), %ecx
movl $0x3e8, %edx            # imm = 0x3E8
btl $0xd, %ecx
jb 0x4c450
movl 0x5c(%rax), %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x19230
testb $0x2, 0x142(%r14)
jne 0x4c4c6
movq 0x1ca54(%rip), %rax     # 0x68ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4c47e
jnp 0x4c4a8
movq (%r12), %rax
cvttss2si 0x20(%rax), %eax
testb $0x4, %al
jne 0x4c4a0
movss 0x6e01(%rip), %xmm0     # 0x53294
movq %r14, %rdi
callq 0x19520
xorps %xmm1, %xmm1
jmp 0x4c4a8
orb $-0x80, 0x11f(%r14)
movq 0x1cab1(%rip), %rax     # 0x68f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jne 0x4c4be
jnp 0x4c4c6
orb $-0x80, 0x11f(%r14)
movq 0x58(%rbx), %rax
movq 0x730(%rax), %r12
movq 0x330(%r14), %rcx
movl $0x1, %ebp
cmpq %rcx, %r12
je 0x4c529
cmpl $0x1, 0x318(%rax,%r15,4)
jne 0x4c529
movq 0x1c9cc(%rip), %rdx     # 0x68ec0
movq (%rdx), %rdx
movss 0x20(%rdx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4c506
jnp 0x4c522
leaq 0xdb59(%rip), %rdi      # 0x5a066
callq 0x189e0
cmpq %rax, %r12
jne 0x4c529
movq 0x330(%r14), %rcx
movq 0x58(%rbx), %rax
movq %rcx, 0xe50(%rax)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq