// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_weapon.c
// Function: fire_grenade2
void fire_grenade2 (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held)
{
	edict_t	*grenade;
	vec3_t	dir;
	vec3_t	forward, right, up;

	vectoangles (aimdir, dir);
	AngleVectors (dir, forward, right, up);

	grenade = G_Spawn();
	VectorCopy (start, grenade->s.origin);
	VectorScale (aimdir, speed, grenade->velocity);
	VectorMA (grenade->velocity, 200 + crandom() * 10.0, up, grenade->velocity);
	VectorMA (grenade->velocity, crandom() * 10.0, right, grenade->velocity);
	VectorSet (grenade->avelocity, 300, 300, 300);
	grenade->movetype = MOVETYPE_BOUNCE;
	grenade->clipmask = MASK_SHOT;
	grenade->solid = SOLID_BBOX;
	grenade->s.effects |= EF_GRENADE;
	VectorClear (grenade->mins);
	VectorClear (grenade->maxs);
	grenade->s.modelindex = gi.modelindex ("models/objects/grenade2/tris.md2");
	grenade->owner = self;
	grenade->touch = Grenade_Touch;
	grenade->nextthink = level.time + timer;
	grenade->think = Grenade_Explode;
	grenade->dmg = damage;
	grenade->dmg_radius = damage_radius;
	grenade->classname = "hgrenade";
	if (held)
		grenade->spawnflags = 3;
	else
		grenade->spawnflags = 1;
	grenade->s.sound = gi.soundindex("weapons/hgrenc1b.wav");

	if (timer <= 0.0)
		Grenade_Explode (grenade);
	else
	{
		gi.sound (self, CHAN_WEAPON, gi.soundindex ("weapons/hgrent1a.wav"), 1, ATTN_NORM, 0);
		gi.linkentity (grenade);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x14(%rsp)
movss %xmm1, 0x10(%rsp)
movss %xmm0, 0x8(%rsp)
movl %r8d, %r13d
movl %ecx, 0xc(%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
leaq 0x3c(%rsp), %r14
movq %rdx, %rdi
movq %r14, %rsi
callq 0x190d0
leaq 0x30(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x24(%rsp), %rbp
movq %r14, %rdi
movq %rbp, %rcx
callq 0x183a0
callq 0x19700
movq %rax, %r14
movss (%r15), %xmm0
movss %xmm0, 0x4(%rax)
movss 0x4(%r15), %xmm0
movss %xmm0, 0x8(%rax)
movss 0x8(%r15), %xmm0
movss %xmm0, 0xc(%rax)
xorps %xmm0, %xmm0
cvtsi2ss %r13d, %xmm0
leaq 0x1c0(%rax), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x189d0
callq 0x19a10
movl $0x7fff, %ebx           # imm = 0x7FFF
andl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x130cd(%rip), %xmm0    # 0x53288
cvtss2sd %xmm0, %xmm0
addsd 0x15a51(%rip), %xmm0    # 0x55c18
addsd %xmm0, %xmm0
mulsd 0x193a5(%rip), %xmm0    # 0x59578
addsd 0x1716d(%rip), %xmm0    # 0x57348
cvtsd2ss %xmm0, %xmm0
movq %r13, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x19760
callq 0x19a10
andl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x13085(%rip), %xmm0    # 0x53288
cvtss2sd %xmm0, %xmm0
addsd 0x15a09(%rip), %xmm0    # 0x55c18
addsd %xmm0, %xmm0
mulsd 0x1935d(%rip), %xmm0    # 0x59578
cvtsd2ss %xmm0, %xmm0
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
callq 0x19760
movsd 0x19359(%rip), %xmm0    # 0x59590
movsd %xmm0, 0x1cc(%r14)
movl $0x43960000, 0x1d4(%r14) # imm = 0x43960000
movl $0x9, 0x118(%r14)
movabsq $0x600000300000002, %rax # imm = 0x600000300000002
movq %rax, 0x108(%r14)
orb $0x20, 0x40(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0xcc(%r14)
movq $0x0, 0xdc(%r14)
movq 0x28377(%rip), %rbx     # 0x68600
leaq 0x19353(%rip), %rdi     # 0x595e3
callq *0x40(%rbx)
movl %eax, 0x28(%r14)
movq %r12, 0x110(%r14)
leaq -0x481(%rip), %rax      # 0x3fe24
movq %rax, 0x220(%r14)
movq 0x28aed(%rip), %rax     # 0x68da0
movss 0x4(%rax), %xmm0
addss 0x8(%rsp), %xmm0
movss %xmm0, 0x200(%r14)
leaq -0x3d5(%rip), %rax      # 0x3fef9
movq %rax, 0x210(%r14)
movl 0xc(%rsp), %eax
movl %eax, 0x280(%r14)
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x288(%r14)
leaq 0x1930e(%rip), %rax     # 0x59604
movq %rax, 0x138(%r14)
xorl %eax, %eax
cmpl $0x0, 0x14(%rsp)
setne %al
leal 0x1(,%rax,2), %eax
movl %eax, 0x140(%r14)
leaq 0x192f1(%rip), %rdi     # 0x5960d
callq *0x48(%rbx)
movl %eax, 0x4c(%r14)
xorps %xmm0, %xmm0
ucomiss 0x8(%rsp), %xmm0
jae 0x40361
movq 0x20(%rbx), %r15
leaq 0x192ea(%rip), %rdi     # 0x59622
callq *0x48(%rbx)
movss 0x12be5(%rip), %xmm0    # 0x52f28
xorps %xmm2, %xmm2
movq %r12, %rdi
movl $0x1, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movq %r14, %rdi
callq *0x90(%rbx)
jmp 0x40369
movq %r14, %rdi
callq 0x3fef9
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq