// File: /workspace/github_c_makefile_star2_O1/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 0x1c731(%rip), %rax     # 0x697d8
xorl %ebp, %ebp
cmpl $0x6, (%rax)
je 0x4d23b
movq %rsi, %rbx
movq %rdi, %r14
movq 0x330(%rdi), %rax
movq %rax, %rdx
subq 0x1cd77(%rip), %rdx     # 0x69e40
sarq $0x3, %rdx
movabsq $-0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F1
imulq %rdx, %rcx
movq 0x1c536(%rip), %r12     # 0x69618
movq (%r12), %rdx
cvttss2si 0x20(%rdx), %edx
testb $0x4, %dl
jne 0x4d109
movq 0x1ce69(%rip), %rdx     # 0x69f60
movq (%rdx), %rdx
movss 0x20(%rdx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4d109
jnp 0x4d128
movq 0x58(%rbx), %rdx
movslq %ecx, %rsi
cmpl $0x0, 0x318(%rdx,%rsi,4)
je 0x4d128
testb $0x3, 0x142(%r14)
je 0x4d23b
movq 0x58(%rbx), %rdx
movslq %ecx, %r15
incl 0x318(%rdx,%r15,4)
testb $0x1, 0x142(%r14)
jne 0x4d1db
movq 0x60(%rax), %rdi
callq 0x189e0
movq (%r12), %rcx
cvttss2si 0x20(%rcx), %ecx
movl $0x3e8, %edx            # imm = 0x3E8
btl $0xd, %ecx
jb 0x4d165
movl 0x5c(%rax), %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x19230
testb $0x2, 0x142(%r14)
jne 0x4d1db
movq 0x1cd3f(%rip), %rax     # 0x69ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4d193
jnp 0x4d1bd
movq (%r12), %rax
cvttss2si 0x20(%rax), %eax
testb $0x4, %al
jne 0x4d1b5
movss 0x70ec(%rip), %xmm0     # 0x54294
movq %r14, %rdi
callq 0x19520
xorps %xmm1, %xmm1
jmp 0x4d1bd
orb $-0x80, 0x11f(%r14)
movq 0x1cd9c(%rip), %rax     # 0x69f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jne 0x4d1d3
jnp 0x4d1db
orb $-0x80, 0x11f(%r14)
movq 0x58(%rbx), %rax
movq 0x730(%rax), %r12
movl $0x1, %ebp
cmpq 0x330(%r14), %r12
je 0x4d23b
cmpl $0x1, 0x318(%rax,%r15,4)
jne 0x4d23b
movq 0x1ccba(%rip), %rax     # 0x69ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4d218
jnp 0x4d229
leaq 0xdb87(%rip), %rdi      # 0x5ada6
callq 0x189e0
cmpq %rax, %r12
jne 0x4d23b
movq 0x330(%r14), %rax
movq 0x58(%rbx), %rcx
movq %rax, 0xe50(%rcx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq