// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_cmds.c
// Function: Cmd_Give_f
void Cmd_Give_f (edict_t *ent)
{
	char		*name;
	gitem_t		*it;
	int			index;
	int			i;
	qboolean	give_all;
	edict_t		*it_ent;

	it = 0;

	if (deathmatch->value && !sv_cheats->value)
	{
		ctf_SafePrint(ent, PRINT_HIGH, "Server does not have '+set cheats 1'.\n");
		return;
	}

	name = gi.args();

	if (Q_stricmp(name, "all") == 0)
		give_all = true;
	else
		give_all = false;

	if (give_all || Q_stricmp(gi.argv(1), "health") == 0)
	{
		if (gi.argc() == 3)
			ent->health = atoi(gi.argv(2));
		else
			ent->health = ent->max_health;
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "weapons") == 0)
	{
		for (i=0 ; i<game.num_items ; i++)
		{
			it = itemlist + i;
			if (!it->pickup)
				continue;
			if (!(it->flags & IT_WEAPON))
				continue;
			ent->client->pers.inventory[i] += 1;
		}
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "ammo") == 0)
	{
		for (i=0 ; i<game.num_items ; i++)
		{
			it = itemlist + i;
			if (!it->pickup)
				continue;
			if (!(it->flags & IT_AMMO))
				continue;
			Add_Ammo (ent, it, 1000);
		}
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "armor") == 0)
	{
		gitem_armor_t	*info;

		it = FindItem("Jacket Armor");
		ent->client->pers.inventory[ITEM_INDEX(it)] = 0;

		it = FindItem("Combat Armor");
		ent->client->pers.inventory[ITEM_INDEX(it)] = 0;

		it = FindItem("Body Armor");
		info = (gitem_armor_t *)it->info;
		ent->client->pers.inventory[ITEM_INDEX(it)] = info->max_count;

		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "Power Shield") == 0)
	{
		it = FindItem("Power Shield");
		it_ent = G_Spawn();
		it_ent->classname = it->classname;
		SpawnItem (it_ent, it);
		Touch_Item (it_ent, ent, NULL, NULL);
		if (it_ent->inuse)
			G_FreeEdict(it_ent);

		if (!give_all)
			return;
	}

	if (give_all)
	{
		for (i=0 ; i<game.num_items ; i++)
		{
			it = itemlist + i;
			if (!it->pickup)
				continue;
			if (it->flags & (IT_ARMOR|IT_WEAPON|IT_AMMO))
				continue;
			ent->client->pers.inventory[i] = 1;
		}
		return;
	}

	it = FindItem (name);
	if (!it)
	{
		name = gi.argv(1);
		it = FindItem (name);
		if (!it)
		{
			gi.cprintf (ent, PRINT_HIGH, "unknown item\n");
			return;
		}
	}

	if (!it->pickup)
	{
		gi.cprintf (ent, PRINT_HIGH, "non-pickup item\n");
		return;
	}

	index = ITEM_INDEX(it);

	if (it->flags & IT_AMMO)
	{
		if (gi.argc() == 3)
			ent->client->pers.inventory[index] = atoi(gi.argv(2));
		else
			ent->client->pers.inventory[index] += it->quantity;
	}
	else
	{
		it_ent = G_Spawn();
		it_ent->classname = it->classname;
		SpawnItem (it_ent, it);
		Touch_Item (it_ent, ent, NULL, NULL);
		if (it_ent->inuse)
			G_FreeEdict(it_ent);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x18(%rbp)
movq 0x56a05(%rip), %rax     # 0x82ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2c4cf
jp 0x2c4cf
jmp 0x2c502
movq 0x56522(%rip), %rax     # 0x829f8
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2c502
jp 0x2c502
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x45106(%rip), %rdx     # 0x715fe
callq 0x18f20
jmp 0x2ca83
movq 0x560f7(%rip), %rax     # 0x82600
callq *0x148(%rax)
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x4a644(%rip), %rsi     # 0x76b62
callq 0x186f0
cmpl $0x0, %eax
jne 0x2c531
movl $0x1, -0x24(%rbp)
jmp 0x2c538
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x2c564
movl $0x1, %edi
movq 0x560b6(%rip), %rax     # 0x82600
callq *0x140(%rax)
movq %rax, %rdi
leaq 0x43c2a(%rip), %rsi     # 0x70184
callq 0x186f0
cmpl $0x0, %eax
jne 0x2c5bf
movq 0x56095(%rip), %rax     # 0x82600
callq *0x138(%rax)
cmpl $0x3, %eax
jne 0x2c59e
movl $0x2, %edi
movq 0x5607e(%rip), %rax     # 0x82600
callq *0x140(%rax)
movq %rax, %rdi
callq 0x19820
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x254(%rax)
jmp 0x2c5b2
movq -0x8(%rbp), %rax
movl 0x258(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x254(%rax)
cmpl $0x0, -0x24(%rbp)
jne 0x2c5bd
jmp 0x2ca83
jmp 0x2c5bf
cmpl $0x0, -0x24(%rbp)
jne 0x2c5de
movq -0x10(%rbp), %rdi
leaq 0x45055(%rip), %rsi     # 0x71625
callq 0x186f0
cmpl $0x0, %eax
jne 0x2c663
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq 0x56751(%rip), %rcx     # 0x82d40
cmpl 0x61c(%rcx), %eax
jge 0x2c656
movslq -0x20(%rbp), %rcx
movq 0x5683e(%rip), %rax     # 0x82e40
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2c61d
jmp 0x2c64b
movq -0x18(%rbp), %rax
movl 0x68(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2c62e
jmp 0x2c64b
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x20(%rbp), %rcx
movl 0x318(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x318(%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2c5e5
cmpl $0x0, -0x24(%rbp)
jne 0x2c661
jmp 0x2ca83
jmp 0x2c663
cmpl $0x0, -0x24(%rbp)
jne 0x2c67e
movq -0x10(%rbp), %rdi
leaq 0x44fb9(%rip), %rsi     # 0x7162d
callq 0x186f0
cmpl $0x0, %eax
jne 0x2c6f8
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq 0x566b1(%rip), %rcx     # 0x82d40
cmpl 0x61c(%rcx), %eax
jge 0x2c6eb
movslq -0x20(%rbp), %rcx
movq 0x5679e(%rip), %rax     # 0x82e40
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2c6bd
jmp 0x2c6e0
movq -0x18(%rbp), %rax
movl 0x68(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x2c6ce
jmp 0x2c6e0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x19430
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2c685
cmpl $0x0, -0x24(%rbp)
jne 0x2c6f6
jmp 0x2ca83
jmp 0x2c6f8
cmpl $0x0, -0x24(%rbp)
jne 0x2c717
movq -0x10(%rbp), %rdi
leaq 0x43a6d(%rip), %rsi     # 0x70176
callq 0x186f0
cmpl $0x0, %eax
jne 0x2c80b
leaq 0x43d17(%rip), %rdi     # 0x70435
callq 0x18a90
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x56702(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x58(%rbp), %rax
movl $0x0, 0x318(%rax,%rcx,4)
leaq 0x44ece(%rip), %rdi     # 0x71632
callq 0x18a90
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x566bc(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x50(%rbp), %rax
movl $0x0, 0x318(%rax,%rcx,4)
leaq 0x44e95(%rip), %rdi     # 0x7163f
callq 0x18a90
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq 0x56660(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movl -0x44(%rbp), %edx
movq %rax, %rcx
movq -0x40(%rbp), %rax
movl %edx, 0x318(%rax,%rcx,4)
cmpl $0x0, -0x24(%rbp)
jne 0x2c809
jmp 0x2ca83
jmp 0x2c80b
cmpl $0x0, -0x24(%rbp)
jne 0x2c826
movq -0x10(%rbp), %rdi
leaq 0x44e2e(%rip), %rsi     # 0x7164a
callq 0x186f0
cmpl $0x0, %eax
jne 0x2c892
leaq 0x44e1d(%rip), %rdi     # 0x7164a
callq 0x18a90
movq %rax, -0x18(%rbp)
callq 0x19950
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x19040
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x19d48
movq -0x30(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x2c885
movq -0x30(%rbp), %rdi
callq 0x19cd0
cmpl $0x0, -0x24(%rbp)
jne 0x2c890
jmp 0x2ca83
jmp 0x2c892
cmpl $0x0, -0x24(%rbp)
je 0x2c90f
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq 0x56497(%rip), %rcx     # 0x82d40
cmpl 0x61c(%rcx), %eax
jge 0x2c90a
movslq -0x20(%rbp), %rcx
movq 0x56584(%rip), %rax     # 0x82e40
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2c8d7
jmp 0x2c8ff
movq -0x18(%rbp), %rax
movl 0x68(%rax), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x2c8e8
jmp 0x2c8ff
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x20(%rbp), %rcx
movl $0x1, 0x318(%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2c89f
jmp 0x2ca83
movq -0x10(%rbp), %rdi
callq 0x18a90
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x2c973
movl $0x1, %edi
movq 0x55cd1(%rip), %rax     # 0x82600
callq *0x140(%rax)
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x18a90
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x2c971
movq 0x55cac(%rip), %rax     # 0x82600
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x44cef(%rip), %rdx     # 0x71657
movb $0x0, %al
callq *%rcx
jmp 0x2ca83
jmp 0x2c973
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2c9a2
movq 0x55c7b(%rip), %rax     # 0x82600
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x44ccc(%rip), %rdx     # 0x71665
movb $0x0, %al
callq *%rcx
jmp 0x2ca83
movq -0x18(%rbp), %rax
movq 0x56493(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl 0x68(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2ca32
movq 0x55c2d(%rip), %rax     # 0x82600
callq *0x138(%rax)
cmpl $0x3, %eax
jne 0x2ca0f
movl $0x2, %edi
movq 0x55c16(%rip), %rax     # 0x82600
callq *0x140(%rax)
movq %rax, %rdi
callq 0x19820
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x318(%rax,%rcx,4)
jmp 0x2ca30
movq -0x18(%rbp), %rax
movl 0x5c(%rax), %edx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x1c(%rbp), %rcx
addl 0x318(%rax,%rcx,4), %edx
movl %edx, 0x318(%rax,%rcx,4)
jmp 0x2ca83
callq 0x19950
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x19040
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x19d48
movq -0x30(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x2ca81
movq -0x30(%rbp), %rdi
callq 0x19cd0
jmp 0x2ca83
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)