// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/plasma.c
// Function: Use_PLASMA
void
Use_PLASMA
(edict_t *ent, gitem_t *item)
{
	int		ammo_index;
	gitem_t		*ammo_item;
///////// FIXME /////////
	// if we're already using it, switch modes
	if(item == ent->client->pers.weapon) {
		// see if you have the other weapon
			// if yes, switch
			// else return
// simple hack for demo
		ent->client->plasma_mode = (!ent->client->plasma_mode);

		if(ent->client->plasma_mode)
			gi.cprintf(ent, PRINT_HIGH, "bounce plasma\n");
		else
			gi.cprintf(ent, PRINT_HIGH, "spread plasma\n");

		return;
	}
/////////////////////////

	if (item->ammo && !g_select_empty->value && !(item->flags & IT_AMMO))
	{
		ammo_item = FindItem(item->ammo);
		ammo_index = ITEM_INDEX(ammo_item);

		if (!ent->client->pers.inventory[ammo_index])
		{
			gi.cprintf (ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}

		if (ent->client->pers.inventory[ammo_index] < item->quantity)
		{
			gi.cprintf (ent, PRINT_HIGH, "Not enough %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}
	}

	// change to this weapon when down
	ent->client->newweapon = item;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
cmpq 0x730(%rcx), %rax
jne 0x28102
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0xf3c(%rax)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl %ecx, 0xf3c(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0xf3c(%rax)
je 0x280de
movq 0x5a53c(%rip), %rax     # 0x82600
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x48bd3(%rip), %rdx     # 0x70cab
movb $0x0, %al
callq *%rcx
jmp 0x280fd
movq 0x5a51b(%rip), %rax     # 0x82600
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x48bc1(%rip), %rdx     # 0x70cba
movb $0x0, %al
callq *%rcx
jmp 0x2821c
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x28209
movq 0x5a430(%rip), %rax     # 0x82548
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x28209
jp 0x28209
movq -0x10(%rbp), %rax
movl 0x68(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x28209
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x18a90
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x5acdf(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpl $0x0, 0x318(%rax,%rcx,4)
jne 0x281b9
movq 0x5a472(%rip), %rax     # 0x82600
movq 0x10(%rax), %r9
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %r8
movl $0x2, %esi
leaq 0x48b17(%rip), %rdx     # 0x70cc9
movb $0x0, %al
callq *%r9
jmp 0x2821c
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x14(%rbp), %rcx
movl 0x318(%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
cmpl 0x5c(%rcx), %eax
jge 0x28207
movq 0x5a424(%rip), %rax     # 0x82600
movq 0x10(%rax), %r9
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %r8
movl $0x2, %esi
leaq 0x48ad8(%rip), %rdx     # 0x70cd8
movb $0x0, %al
callq *%r9
jmp 0x2821c
jmp 0x28209
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0xe50(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)