// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq 0x1c861(%rip), %rax     # 0x827d8
cmpl $0x6, (%rax)
jne 0x65f88
movl $0x0, -0x4(%rbp)
jmp 0x661e5
movq -0x10(%rbp), %rax
movq 0x330(%rax), %rax
movq 0x1cea6(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movl %eax, -0x1c(%rbp)
movq 0x1c667(%rip), %rax     # 0x82618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x65fdc
movq 0x1cf98(%rip), %rax     # 0x82f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x65fdc
jp 0x65fdc
jmp 0x66014
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x1c(%rbp), %rcx
cmpl $0x0, 0x318(%rax,%rcx,4)
je 0x66014
movq -0x10(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x30000, %eax          # imm = 0x30000
cmpl $0x0, %eax
jne 0x66012
movl $0x0, -0x4(%rbp)
jmp 0x661e5
jmp 0x66014
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl 0x318(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x318(%rax,%rcx,4)
movq -0x10(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
jne 0x6614c
movq -0x10(%rbp), %rax
movq 0x330(%rax), %rax
movq 0x60(%rax), %rdi
callq 0x18a90
movq %rax, -0x28(%rbp)
movq 0x1c5b0(%rip), %rax     # 0x82618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x6608e
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x19430
jmp 0x660a2
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x5c(%rax), %edx
callq 0x19430
movq -0x10(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
jne 0x6614a
movq 0x1cdff(%rip), %rax     # 0x82ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x660d5
jp 0x660d5
jmp 0x66117
movq 0x1c53c(%rip), %rax     # 0x82618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x66104
movq -0x10(%rbp), %rax
movl 0x11c(%rax), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x11c(%rax)
jmp 0x66115
movq -0x10(%rbp), %rdi
movss 0xa180(%rip), %xmm0     # 0x70290
callq 0x19750
jmp 0x66117
movq 0x1ce42(%rip), %rax     # 0x82f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x66132
jp 0x66132
jmp 0x66148
movq -0x10(%rbp), %rax
movl 0x11c(%rax), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x11c(%rax)
jmp 0x6614a
jmp 0x6614c
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x730(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x330(%rcx), %rax
je 0x661de
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x1c(%rbp), %rcx
cmpl $0x1, 0x318(%rax,%rcx,4)
jne 0x661de
movq 0x1cd3b(%rip), %rax     # 0x82ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x66199
jp 0x66199
jmp 0x661c4
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x730(%rax), %rax
movq %rax, -0x30(%rbp)
leaq 0x10b7b(%rip), %rdi     # 0x76d2e
callq 0x18a90
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jne 0x661de
movq -0x10(%rbp), %rax
movq 0x330(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0xe50(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop