// File: /workspace/github_c_makefile_star2_O1/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 0x19710
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 0x19a20
movl $0x7fff, %ebx           # imm = 0x7FFF
andl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x137e9(%rip), %xmm0    # 0x54288
cvtss2sd %xmm0, %xmm0
addsd 0x16105(%rip), %xmm0    # 0x56bb0
addsd %xmm0, %xmm0
mulsd 0x198b1(%rip), %xmm0    # 0x5a368
addsd 0x17791(%rip), %xmm0    # 0x58250
cvtsd2ss %xmm0, %xmm0
movq %r13, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x19770
callq 0x19a20
andl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x137a1(%rip), %xmm0    # 0x54288
cvtss2sd %xmm0, %xmm0
addsd 0x160bd(%rip), %xmm0    # 0x56bb0
addsd %xmm0, %xmm0
mulsd 0x19869(%rip), %xmm0    # 0x5a368
cvtsd2ss %xmm0, %xmm0
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
callq 0x19770
movabsq $0x4396000043960000, %rax # imm = 0x4396000043960000
movq %rax, 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 0x28a93(%rip), %rbx     # 0x69600
leaq 0x19847(%rip), %rdi     # 0x5a3bb
callq *0x40(%rbx)
movl %eax, 0x28(%r14)
movq %r12, 0x110(%r14)
leaq -0x4af(%rip), %rax      # 0x406da
movq %rax, 0x220(%r14)
movq 0x29209(%rip), %rax     # 0x69da0
movss 0x4(%rax), %xmm0
addss 0x8(%rsp), %xmm0
movss %xmm0, 0x200(%r14)
leaq -0x403(%rip), %rax      # 0x407af
movq %rax, 0x210(%r14)
movl 0xc(%rsp), %eax
movl %eax, 0x280(%r14)
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x288(%r14)
leaq 0x19802(%rip), %rax     # 0x5a3dc
movq %rax, 0x138(%r14)
xorl %eax, %eax
cmpl $0x0, 0x14(%rsp)
setne %al
leal 0x1(,%rax,2), %eax
movl %eax, 0x140(%r14)
leaq 0x197e5(%rip), %rdi     # 0x5a3e5
callq *0x48(%rbx)
movl %eax, 0x4c(%r14)
xorps %xmm0, %xmm0
ucomiss 0x8(%rsp), %xmm0
jae 0x40c45
movq 0x20(%rbx), %r15
leaq 0x197de(%rip), %rdi     # 0x5a3fa
callq *0x48(%rbx)
movss 0x13301(%rip), %xmm0    # 0x53f28
xorps %xmm2, %xmm2
movq %r12, %rdi
movl $0x1, %esi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movq %r14, %rdi
callq *0x90(%rbx)
jmp 0x40c4d
movq %r14, %rdi
callq 0x407af
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq