// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: weapon_grenade_fire
void weapon_grenade_fire (edict_t *ent, qboolean held)
{
	vec3_t	offset;
	vec3_t	forward, right;
	vec3_t	start;
	int		damage = 125;
	float	timer;
	int		speed;
	float	radius;

	radius = damage+40;
	if (is_quad)
		damage *= 4;

	VectorSet(offset, 8, 8, ent->viewheight-8);
	AngleVectors (ent->client->v_angle, forward, right, NULL);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);

	timer = ent->client->grenade_time - level.time;
	speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);

	if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
		ent->client->pers.inventory[ent->client->ammo_index]--;

	ent->client->grenade_time = level.time + 1.0;

	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
	{
		return;
	}

	if (ent->health <= 0)
		return;

	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
	{
		ent->client->anim_priority = ANIM_ATTACK;
		ent->s.frame = FRAME_crattak1-1;
		ent->client->anim_end = FRAME_crattak3;
	}
	else
	{
		ent->client->anim_priority = ANIM_REVERSE;
		ent->s.frame = FRAME_wave08;
		ent->client->anim_end = FRAME_wave01;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x7d, -0x40(%rbp)
movl -0x40(%rbp), %eax
addl $0x28, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x4c(%rbp)
cmpl $0x0, 0x4cd68(%rip)     # 0xb3264
je 0x66507
movl -0x40(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x40(%rbp)
movss 0x99ed(%rip), %xmm0     # 0x6fefc
movss %xmm0, -0x18(%rbp)
movss 0x99e0(%rip), %xmm0     # 0x6fefc
movss %xmm0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x278(%rax), %eax
subl $0x8, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xebc, %rdi            # imm = 0xEBC
leaq -0x24(%rbp), %rsi
leaq -0x30(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x183e0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
leaq -0x18(%rbp), %rdx
leaq -0x24(%rbp), %rcx
leaq -0x30(%rbp), %r8
leaq -0x3c(%rbp), %r9
callq 0x67590
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xf18(%rax), %xmm0
movq 0x1c80d(%rip), %rax     # 0x82da0
subss 0x4(%rax), %xmm0
movss %xmm0, -0x44(%rbp)
movss 0x996b(%rip), %xmm0     # 0x6ff10
subss -0x44(%rbp), %xmm0
movss 0x11496(%rip), %xmm1    # 0x77a48
mulss %xmm1, %xmm0
movss 0xc896(%rip), %xmm1     # 0x72e54
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x24(%rbp), %rdx
movl -0x40(%rbp), %ecx
movl -0x48(%rbp), %r8d
movss -0x44(%rbp), %xmm0
movss -0x4c(%rbp), %xmm1
movl -0xc(%rbp), %r9d
callq 0x182b0
movq 0x1c022(%rip), %rax     # 0x82618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x66630
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
movslq 0xe38(%rcx), %rcx
movl 0x318(%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, 0x318(%rax,%rcx,4)
movq 0x1c769(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x98f8(%rip), %xmm1     # 0x6ff40
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss %xmm0, 0xf18(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x260(%rax)
jne 0x6667a
movq -0x8(%rbp), %rax
cmpl $0xff, 0x28(%rax)
je 0x6667f
jmp 0x66702
movq -0x8(%rbp), %rax
cmpl $0x0, 0x254(%rax)
jg 0x6668e
jmp 0x66702
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movzbl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x666d3
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x4, 0xef8(%rax)
movq -0x8(%rbp), %rax
movl $0x9f, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl $0xa2, 0xef4(%rax)
jmp 0x66702
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x6, 0xef8(%rax)
movq -0x8(%rbp), %rax
movl $0x77, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x70, 0xef4(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)