// File: /workspace/github_c_makefile_star2_O1/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 0xa500(%rip), %rdi      # 0x57a7f
callq 0x189e0
subq 0x1c8b5(%rip), %rax     # 0x69e40
sarq $0x3, %rax
movabsq $-0x3c3c3c3c3c3c3c3c, %r15 # imm = 0xC3C3C3C3C3C3C3C4
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4d5d9
movq 0x58(%rbx), %r12
leaq 0xd8fa(%rip), %r14      # 0x5aead
movq %r14, %rdi
callq 0x189e0
subq 0x1c87e(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4d79f
movq 0x58(%rbx), %r14
leaq 0xa41f(%rip), %rdi      # 0x57a03
callq 0x189e0
subq 0x1c850(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4d634
movq 0x58(%rbx), %r12
leaq 0xd881(%rip), %r14      # 0x5ae8f
movq %r14, %rdi
callq 0x189e0
subq 0x1c823(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4d79f
movq 0x58(%rbx), %r14
leaq 0xa387(%rip), %rdi      # 0x579c6
callq 0x189e0
subq 0x1c7f5(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4d68f
movq 0x58(%rbx), %r12
leaq 0xd7bf(%rip), %r14      # 0x5ae28
movq %r14, %rdi
callq 0x189e0
subq 0x1c7c8(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4d79f
movq 0x58(%rbx), %r14
leaq 0xa32c(%rip), %rdi      # 0x579c6
callq 0x189e0
subq 0x1c79a(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4d6ea
movq 0x58(%rbx), %r12
leaq 0xd743(%rip), %r14      # 0x5ae07
movq %r14, %rdi
callq 0x189e0
subq 0x1c76d(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4d79f
movq 0x58(%rbx), %r14
leaq 0xa291(%rip), %rdi      # 0x57986
callq 0x189e0
subq 0x1c73f(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x2, 0x318(%r14,%rax)
jl 0x4d741
movq 0x58(%rbx), %r12
leaq 0xd6c2(%rip), %r14      # 0x5ade1
movq %r14, %rdi
callq 0x189e0
subq 0x1c712(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4d79f
movq 0x58(%rbx), %r14
leaq 0xa23a(%rip), %rdi      # 0x57986
callq 0x189e0
subq 0x1c6e8(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4d798
movq 0x58(%rbx), %r12
leaq 0xd671(%rip), %r14      # 0x5ade7
movq %r14, %rdi
callq 0x189e0
subq 0x1c6bb(%rip), %rax     # 0x69e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4d79f
leaq 0xd607(%rip), %r14      # 0x5ada6
movq %r14, %rdi
callq 0x189e0
movq 0x58(%rbx), %rcx
movq %rax, 0xe50(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq