// File: /workspace/github_c_makefile_star2_O1/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 0x41beb(%rip), %rax     # 0x69600
callq *0x148(%rax)
testq %rax, %rax
je 0x27abb
movq %rax, %r15
cmpb $0x0, (%rax)
je 0x27abb
leaq 0x3357e(%rip), %rsi     # 0x5afb5
movq %r15, %rdi
callq 0x18690
testl %eax, %eax
leaq 0x33563(%rip), %rax     # 0x5afab
cmoveq %rax, %r15
leaq 0x34198(%rip), %rsi     # 0x5bbeb
movq %r15, %rdi
callq 0x18690
testl %eax, %eax
leaq 0x2dcc1(%rip), %r14     # 0x55725
cmovneq %r15, %r14
leaq 0x2c898(%rip), %rsi     # 0x54307
movq %r14, %rdi
callq 0x18690
testl %eax, %eax
je 0x27adb
leaq 0x2c775(%rip), %rsi     # 0x541f7
movq %r14, %rdi
callq 0x18690
testl %eax, %eax
je 0x27adb
leaq 0x2dcdf(%rip), %rsi     # 0x55774
movq %r14, %rdi
callq 0x18690
testl %eax, %eax
je 0x27adb
leaq 0x2dbe1(%rip), %rsi     # 0x55689
movq %r14, %rdi
callq 0x18690
testl %eax, %eax
je 0x27b25
xorl %eax, %eax
jmp 0x27b42
leaq 0x2dca6(%rip), %rdx     # 0x55768
movl $0x2, %esi
movq %rbx, %rdi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
jmp 0x18da0
movq 0x58(%rbx), %rax
movq 0xf68(%rax), %rax
testq %rax, %rax
je 0x27bd2
movq 0x330(%rax), %rsi
testq %rsi, %rsi
je 0x27bd2
movq 0x18(%rsi), %rax
testq %rax, %rax
je 0x27b19
movq %rbx, %rdi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
jmpq *%rax
leaq 0x2dc59(%rip), %rsi     # 0x55779
jmp 0x27bb2
movq 0x58(%rbx), %rax
movq 0x730(%rax), %rax
movq 0x60(%rax), %rdi
testq %rdi, %rdi
je 0x27ab4
callq 0x189e0
testq %rax, %rax
jne 0x27b4f
movq %r14, %rdi
callq 0x189e0
testq %rax, %rax
je 0x27b96
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x27b9f
movq %rax, %rdx
subq 0x422d9(%rip), %rdx     # 0x69e40
shrq $0x3, %rdx
imull $0xf0f0f0f1, %edx, %edx # imm = 0xF0F0F0F1
movq 0x58(%rbx), %rsi
movslq %edx, %rdx
cmpl $0x0, 0x318(%rsi,%rdx,4)
je 0x27bab
movq %rbx, %rdi
movq %rax, %rsi
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
jmpq *%rcx
leaq 0x2db93(%rip), %rsi     # 0x55730
jmp 0x27bb2
leaq 0x2dbe2(%rip), %rdx     # 0x55788
jmp 0x27ac2
leaq 0x2dba5(%rip), %rsi     # 0x55757
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x19700
movl $0x2, %esi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x18da0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq