// File: /workspace/github_c_makefile_star2_O3/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 0xa2ff(%rip), %rdi      # 0x56b73
callq 0x189e0
subq 0x1c5c0(%rip), %rax     # 0x68e40
sarq $0x3, %rax
movabsq $-0x3c3c3c3c3c3c3c3c, %r15 # imm = 0xC3C3C3C3C3C3C3C4
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4c8ce
movq 0x58(%rbx), %r12
leaq 0xd8c5(%rip), %r14      # 0x5a16d
movq %r14, %rdi
callq 0x189e0
subq 0x1c589(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4ca94
movq 0x58(%rbx), %r14
leaq 0xa21e(%rip), %rdi      # 0x56af7
callq 0x189e0
subq 0x1c55b(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4c929
movq 0x58(%rbx), %r12
leaq 0xd84c(%rip), %r14      # 0x5a14f
movq %r14, %rdi
callq 0x189e0
subq 0x1c52e(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4ca94
movq 0x58(%rbx), %r14
leaq 0xa186(%rip), %rdi      # 0x56aba
callq 0x189e0
subq 0x1c500(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4c984
movq 0x58(%rbx), %r12
leaq 0xd78a(%rip), %r14      # 0x5a0e8
movq %r14, %rdi
callq 0x189e0
subq 0x1c4d3(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4ca94
movq 0x58(%rbx), %r14
leaq 0xa12b(%rip), %rdi      # 0x56aba
callq 0x189e0
subq 0x1c4a5(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4c9df
movq 0x58(%rbx), %r12
leaq 0xd70e(%rip), %r14      # 0x5a0c7
movq %r14, %rdi
callq 0x189e0
subq 0x1c478(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4ca94
movq 0x58(%rbx), %r14
leaq 0xa090(%rip), %rdi      # 0x56a7a
callq 0x189e0
subq 0x1c44a(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x2, 0x318(%r14,%rax)
jl 0x4ca36
movq 0x58(%rbx), %r12
leaq 0xd68d(%rip), %r14      # 0x5a0a1
movq %r14, %rdi
callq 0x189e0
subq 0x1c41d(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4ca94
movq 0x58(%rbx), %r14
leaq 0xa039(%rip), %rdi      # 0x56a7a
callq 0x189e0
subq 0x1c3f3(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r14,%rax)
je 0x4ca8d
movq 0x58(%rbx), %r12
leaq 0xd63c(%rip), %r14      # 0x5a0a7
movq %r14, %rdi
callq 0x189e0
subq 0x1c3c6(%rip), %rax     # 0x68e40
sarq $0x3, %rax
imulq %r15, %rax
cmpl $0x0, 0x318(%r12,%rax)
jne 0x4ca94
leaq 0xd5d2(%rip), %r14      # 0x5a066
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