// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_cmds.c
// Function: Cmd_Drop_f
void Cmd_Drop_f (edict_t *ent)
{
	int			index;
	gitem_t		*it;
	char		*s;

	char message[MAX_INFO_STRING];

	s = gi.args();
	it = 0;

	//assert(false);

	if (!s || s[0] == 0)
	{
		ctf_SafePrint(ent, PRINT_HIGH, "Drop what?\n");
		return;
	}

	// CTF CODE -- LM_JORM
	if (Q_stricmp(s, "hook") == 0)
		s = "grappling hook";
	if (Q_stricmp(s, "flag") == 0)
		s = "Enemy Flag";

	if ((Q_stricmp(s, "rune") == 0) ||
		(Q_stricmp(s, "artifact") == 0) ||
		(Q_stricmp(s, "tech") == 0))
	{
		if (ent->client->rune)
		{
			it = ent->client->rune->item;
			if (it)  // We are carrying a rune
			{
				index = ITEM_INDEX(it);
				if (it->drop)
					it->drop (ent, it);
				else
				{
					sprintf(message, "Can't drop %s\n", s);
					ctf_SafePrint(ent, PRINT_HIGH, message);
				}
			}
		}
		return;
	}

	if (Q_stricmp(s, "ammo") == 0)
	{
		if (ent->client->pers.weapon->ammo)
			it =  FindItem (ent->client->pers.weapon->ammo);
	}

	// END CTF CODE -- LM_JORM

	if (!it)
		it = FindItem (s);
	if (!it)
	{
		sprintf(message, "unknown item: %s\n", s);
		ctf_SafePrint(ent, PRINT_HIGH, message);
		return;
	}
	if (!it->drop)
	{
		ctf_SafePrint(ent, PRINT_HIGH, "Item is not dropable.\n");
		return;
	}
	index = ITEM_INDEX(it);
	if (!ent->client->pers.inventory[index])
	{
		sprintf(message, "Out of item: %s\n", s);
		ctf_SafePrint(ent, PRINT_HIGH, message);
		return;
	}

	it->drop (ent, it);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rdi, %rbx
movq 0x40fa2(%rip), %rax     # 0x66600
callq *0x148(%rax)
testq %rax, %rax
je 0x2571e
movq %rax, %r15
cmpb $0x0, (%rax)
je 0x2571e
leaq 0x30be5(%rip), %rsi     # 0x56265
movq %r15, %rdi
callq 0x186d0
testl %eax, %eax
leaq 0x30bca(%rip), %rax     # 0x5625b
cmoveq %rax, %r15
leaq 0x3185f(%rip), %rsi     # 0x56efb
movq %r15, %rdi
callq 0x186d0
testl %eax, %eax
leaq 0x2b078(%rip), %r14     # 0x50725
cmovneq %r15, %r14
leaq 0x29c5f(%rip), %rsi     # 0x4f317
movq %r14, %rdi
callq 0x186d0
testl %eax, %eax
je 0x2573c
leaq 0x29b2c(%rip), %rsi     # 0x4f1f7
movq %r14, %rdi
callq 0x186d0
testl %eax, %eax
je 0x2573c
leaq 0x2b096(%rip), %rsi     # 0x50774
movq %r14, %rdi
callq 0x186d0
testl %eax, %eax
je 0x2573c
leaq 0x2af98(%rip), %rsi     # 0x50689
movq %r14, %rdi
callq 0x186d0
testl %eax, %eax
je 0x25783
movq %r14, %rdi
callq 0x18a80
testq %rax, %rax
jne 0x257a9
leaq 0x2b017(%rip), %rsi     # 0x50730
jmp 0x257fd
leaq 0x2b043(%rip), %rdx     # 0x50768
pushq $0x2
popq %rsi
movq %rbx, %rdi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
jmp 0x18ec0
movq 0x58(%rbx), %rax
movq 0xf68(%rax), %rax
testq %rax, %rax
je 0x2581b
movq 0x330(%rax), %rsi
testq %rsi, %rsi
je 0x2581b
movq 0x18(%rsi), %rax
testq %rax, %rax
je 0x2577a
movq %rbx, %rdi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
jmpq *%rax
leaq 0x2aff8(%rip), %rsi     # 0x50779
jmp 0x257fd
movq 0x58(%rbx), %rax
movq 0x730(%rax), %rax
movq 0x60(%rax), %rdi
testq %rdi, %rdi
je 0x25701
callq 0x18a80
testq %rax, %rax
je 0x25701
movq %rax, %rsi
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x257ea
movq %rsi, %rax
subq 0x41681(%rip), %rax     # 0x66e40
movl $0x88, %edi
cqto
idivq %rdi
movq 0x58(%rbx), %rdx
cltq
cmpl $0x0, 0x318(%rdx,%rax,4)
je 0x257f6
movq %rbx, %rdi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
jmpq *%rcx
leaq 0x2af97(%rip), %rdx     # 0x50788
jmp 0x25725
leaq 0x2af5a(%rip), %rsi     # 0x50757
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x198c0
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x18ec0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq