// File: /workspace/github_c_makefile_star2_O2/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 0x1e586(%rip), %rax     # 0x667d8
xorl %ebp, %ebp
cmpl $0x6, (%rax)
je 0x483e1
movq %rsi, %rbx
movq %rdi, %r14
movq 0x330(%rdi), %rcx
movq %rcx, %rax
subq 0x1ebcc(%rip), %rax     # 0x66e40
movl $0x88, %esi
cqto
idivq %rsi
movq 0x1e393(%rip), %r12     # 0x66618
movq (%r12), %rdx
cvttss2si 0x20(%rdx), %edx
testb $0x4, %dl
jne 0x482ac
movq 0x1ecc6(%rip), %rdx     # 0x66f60
movq (%rdx), %rdx
movss 0x20(%rdx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x482ac
jnp 0x482cd
movq 0x58(%rbx), %rdx
movslq %eax, %r15
cmpl $0x0, 0x318(%rdx,%r15,4)
je 0x482d4
testb $0x3, 0x142(%r14)
jne 0x482d4
jmp 0x483e1
movq 0x58(%rbx), %rdx
movslq %eax, %r15
incl 0x318(%rdx,%r15,4)
testb $0x1, 0x142(%r14)
jne 0x48380
movq 0x60(%rcx), %rdi
callq 0x18a80
movq (%r12), %rcx
cvttss2si 0x20(%rcx), %ecx
movl $0x3e8, %edx            # imm = 0x3E8
btl $0xd, %ecx
jb 0x4830a
movl 0x5c(%rax), %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x193b0
testb $0x2, 0x142(%r14)
jne 0x48380
movq 0x1eb9a(%rip), %rax     # 0x66ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x48338
jnp 0x48362
movq (%r12), %rax
cvttss2si 0x20(%rax), %eax
testb $0x4, %al
jne 0x4835a
movss 0x6f47(%rip), %xmm0     # 0x4f294
movq %r14, %rdi
callq 0x196d0
xorps %xmm1, %xmm1
jmp 0x48362
orb $-0x80, 0x11f(%r14)
movq 0x1ebf7(%rip), %rax     # 0x66f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jne 0x48378
jnp 0x48380
orb $-0x80, 0x11f(%r14)
movq 0x58(%rbx), %rax
movq 0x730(%rax), %r12
movq 0x330(%r14), %rcx
pushq $0x1
popq %rbp
cmpq %rcx, %r12
je 0x483e1
cmpl $0x1, 0x318(%rax,%r15,4)
jne 0x483e1
movq 0x1eb14(%rip), %rdx     # 0x66ec0
movq (%rdx), %rdx
movss 0x20(%rdx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x483be
jnp 0x483da
leaq 0xdc91(%rip), %rdi      # 0x56056
callq 0x18a80
cmpq %rax, %r12
jne 0x483e1
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