// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_cmds.c
// Function: Cmd_Hook_f
void Cmd_Hook_f (edict_t *ent)
{
	gitem_t		*it;

	// Observers can't hook
	if (ent->movetype == MOVETYPE_NOCLIP)
		return;

	if ((int)ctfflags->value & CTF_OFFHAND_HOOK)
	{
		if (!ent->client->hook)
		{

			it = FindItem("Grappling Hook");

			// Can't offhand your hook if it is your current weapon
			if (ent->client->pers.weapon == it)
			{
				ForceCommand(ent, "+attack\n");
				return;
			}

			if (it && (ent->client->pers.inventory[ITEM_INDEX(it)]))  // We are carrying a rune
			{
 				if (ent->client->quad_framenum > level.framenum)
 					gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage3.wav"), 1, ATTN_NORM, 0);

 				Weapon_Hook_Fire(ent);
			}
			else
				ctf_SafePrint(ent, PRINT_HIGH, "You have no hook.\n");
		}
	}
	else // Use the hook
	{
		it = FindItem ("grappling hook");
		if (!ent->client->pers.inventory[ITEM_INDEX(it)])
		{
			ctf_SafePrint(ent, PRINT_HIGH, "Out of item: grappling hook\n");
			return;
		}
		if (it->use)
			it->use (ent, it);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x118(%rax)
jne 0x2e3ce
jmp 0x2e57f
movq 0x54783(%rip), %rax     # 0x82b58
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x2e504
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpq $0x0, 0xf60(%rax)
jne 0x2e502
leaq 0x423d1(%rip), %rdi     # 0x707d7
callq 0x18a90
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x730(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x2e439
movq -0x8(%rbp), %rdi
leaq 0x43882(%rip), %rsi     # 0x71cb1
callq 0x18d80
jmp 0x2e57f
cmpq $0x0, -0x10(%rbp)
je 0x2e4eb
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x549e5(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x18(%rbp), %rax
cmpl $0x0, 0x318(%rax,%rcx,4)
je 0x2e4eb
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf04(%rax), %xmm0
movq 0x54910(%rip), %rax     # 0x82da0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x2e4e0
movq 0x54160(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq 0x455ae(%rip), %rdi     # 0x73a65
movq 0x54142(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x28(%rbp), %rdi
movl %eax, %edx
movq -0x20(%rbp), %rax
movl $0x3, %esi
movss 0x41a14(%rip), %xmm1    # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x19d90
jmp 0x2e500
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x437bf(%rip), %rdx     # 0x71cba
callq 0x18f20
jmp 0x2e502
jmp 0x2e57f
leaq 0x48a28(%rip), %rdi     # 0x76f33
callq 0x18a90
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x54915(%rip), %rcx     # 0x82e40
subq %rcx, %rax
movl $0x88, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpl $0x0, 0x318(%rax,%rcx,4)
jne 0x2e560
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x43774(%rip), %rdx     # 0x71ccd
callq 0x18f20
jmp 0x2e57f
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2e57d
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq *%rax
jmp 0x2e57f
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)