// File: /workspace/github_c_makefile_star2_O2/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 0x19240
leaq 0x30(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x24(%rsp), %rbp
movq %r14, %rdi
movq %rbp, %rcx
callq 0x183d0
callq 0x198d0
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)
cvtsi2ss %r13d, %xmm0
leaq 0x1c0(%rax), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x18a70
callq 0x19bf0
movl $0x7fff, %ebx           # imm = 0x7FFF
andl %ebx, %eax
cvtsi2ss %eax, %xmm0
divss 0x1266a(%rip), %xmm0    # 0x4f288
cvtss2sd %xmm0, %xmm0
addsd 0x14fce(%rip), %xmm0    # 0x51bf8
addsd %xmm0, %xmm0
mulsd 0x18922(%rip), %xmm0    # 0x55558
addsd 0x166ea(%rip), %xmm0    # 0x53328
cvtsd2ss %xmm0, %xmm0
movq %r13, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x19940
callq 0x19bf0
andl %ebx, %eax
cvtsi2ss %eax, %xmm0
divss 0x12625(%rip), %xmm0    # 0x4f288
cvtss2sd %xmm0, %xmm0
addsd 0x14f89(%rip), %xmm0    # 0x51bf8
addsd %xmm0, %xmm0
mulsd 0x188dd(%rip), %xmm0    # 0x55558
cvtsd2ss %xmm0, %xmm0
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
callq 0x19940
movsd 0x188d9(%rip), %xmm0    # 0x55570
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)
andq $0x0, 0xdc(%r14)
movq 0x2991a(%rip), %rbx     # 0x66600
leaq 0x188d6(%rip), %rdi     # 0x555c3
callq *0x40(%rbx)
movl %eax, 0x28(%r14)
movq %r12, 0x110(%r14)
leaq -0x461(%rip), %rax      # 0x3c8a1
movq %rax, 0x220(%r14)
movq 0x2a090(%rip), %rax     # 0x66da0
movss 0x4(%rax), %xmm0
addss 0x8(%rsp), %xmm0
movss %xmm0, 0x200(%r14)
leaq -0x3b7(%rip), %rax      # 0x3c974
movq %rax, 0x210(%r14)
movl 0xc(%rsp), %eax
movl %eax, 0x280(%r14)
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x288(%r14)
leaq 0x18891(%rip), %rax     # 0x555e4
movq %rax, 0x138(%r14)
xorl %eax, %eax
cmpl $0x0, 0x14(%rsp)
setne %al
leal 0x1(,%rax,2), %eax
movl %eax, 0x140(%r14)
leaq 0x18874(%rip), %rdi     # 0x555ed
callq *0x48(%rbx)
movl %eax, 0x4c(%r14)
xorps %xmm0, %xmm0
ucomiss 0x8(%rsp), %xmm0
jae 0x3cdbc
movq 0x20(%rbx), %r15
leaq 0x1886d(%rip), %rdi     # 0x55602
callq *0x48(%rbx)
pushq $0x1
popq %rsi
movss 0x12185(%rip), %xmm0    # 0x4ef28
xorps %xmm2, %xmm2
movq %r12, %rdi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%r15
movq %r14, %rdi
callq *0x90(%rbx)
jmp 0x3cdc4
movq %r14, %rdi
callq 0x3c974
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq