// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: NoAmmoWeaponChange
void NoAmmoWeaponChange (edict_t *ent)
{
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("slugs"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("railgun"))] )
	{
		ent->client->newweapon = FindItem ("railgun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("hyperblaster"))] )
	{
		ent->client->newweapon = FindItem ("hyperblaster");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("chaingun"))] )
	{
		ent->client->newweapon = FindItem ("chaingun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("machinegun"))] )
	{
		ent->client->newweapon = FindItem ("machinegun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))] > 1
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("super shotgun"))] )
	{
		ent->client->newweapon = FindItem ("super shotgun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("shotgun"))] )
	{
		ent->client->newweapon = FindItem ("shotgun");
		return;
	}
	ent->client->newweapon = FindItem ("blaster");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x58(%rdi), %r14
leaq 0xa44b(%rip), %rdi      # 0x52b53
callq 0x18a80
subq 0x1e72c(%rip), %rax     # 0x66e40
movl $0x88, %r15d
cqto
idivq %r15
cmpl $0x0, 0x318(%r14,%rax,4)
je 0x48758
movq 0x58(%rbx), %r12
leaq 0xda28(%rip), %r14      # 0x5615d
movq %r14, %rdi
callq 0x18a80
subq 0x1e6fc(%rip), %rax     # 0x66e40
cqto
idivq %r15
cmpl $0x0, 0x318(%r12,%rax,4)
jne 0x4891b
movq 0x58(%rbx), %r14
leaq 0xa374(%rip), %rdi      # 0x52ad7
callq 0x18a80
subq 0x1e6d1(%rip), %rax     # 0x66e40
cqto
idivq %r15
cmpl $0x0, 0x318(%r14,%rax,4)
je 0x487b2
movq 0x58(%rbx), %r15
leaq 0xd9b5(%rip), %r14      # 0x5613f
movq %r14, %rdi
callq 0x18a80
subq 0x1e6a7(%rip), %rax     # 0x66e40
movl $0x88, %ecx
cqto
idivq %rcx
cmpl $0x0, 0x318(%r15,%rax,4)
jne 0x4891b
movq 0x58(%rbx), %r14
leaq 0xa2dd(%rip), %rdi      # 0x52a9a
callq 0x18a80
subq 0x1e677(%rip), %rax     # 0x66e40
movl $0x88, %r15d
cqto
idivq %r15
cmpl $0x0, 0x318(%r14,%rax,4)
je 0x4880d
movq 0x58(%rbx), %r12
leaq 0xd8ee(%rip), %r14      # 0x560d8
movq %r14, %rdi
callq 0x18a80
subq 0x1e647(%rip), %rax     # 0x66e40
cqto
idivq %r15
cmpl $0x0, 0x318(%r12,%rax,4)
jne 0x4891b
movq 0x58(%rbx), %r14
leaq 0xa282(%rip), %rdi      # 0x52a9a
callq 0x18a80
subq 0x1e61c(%rip), %rax     # 0x66e40
cqto
idivq %r15
cmpl $0x0, 0x318(%r14,%rax,4)
je 0x48867
movq 0x58(%rbx), %r15
leaq 0xd878(%rip), %r14      # 0x560b7
movq %r14, %rdi
callq 0x18a80
subq 0x1e5f2(%rip), %rax     # 0x66e40
movl $0x88, %ecx
cqto
idivq %rcx
cmpl $0x0, 0x318(%r15,%rax,4)
jne 0x4891b
movq 0x58(%rbx), %r14
leaq 0xa1e8(%rip), %rdi      # 0x52a5a
callq 0x18a80
subq 0x1e5c2(%rip), %rax     # 0x66e40
movl $0x88, %r15d
cqto
idivq %r15
cmpl $0x2, 0x318(%r14,%rax,4)
jl 0x488be
movq 0x58(%rbx), %r12
leaq 0xd7f2(%rip), %r14      # 0x56091
movq %r14, %rdi
callq 0x18a80
subq 0x1e592(%rip), %rax     # 0x66e40
cqto
idivq %r15
cmpl $0x0, 0x318(%r12,%rax,4)
jne 0x4891b
movq 0x58(%rbx), %r14
leaq 0xa191(%rip), %rdi      # 0x52a5a
callq 0x18a80
subq 0x1e56b(%rip), %rax     # 0x66e40
cqto
idivq %r15
cmpl $0x0, 0x318(%r14,%rax,4)
je 0x48914
movq 0x58(%rbx), %r15
leaq 0xd7a7(%rip), %r14      # 0x56097
movq %r14, %rdi
callq 0x18a80
subq 0x1e541(%rip), %rax     # 0x66e40
movl $0x88, %ecx
cqto
idivq %rcx
cmpl $0x0, 0x318(%r15,%rax,4)
jne 0x4891b
leaq 0xd73b(%rip), %r14      # 0x56056
movq %r14, %rdi
callq 0x18a80
movq 0x58(%rbx), %rcx
movq %rax, 0xe50(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq