// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_weapon.c
// Function: Grenade_Explode
static void Grenade_Explode (edict_t *ent)
{
	vec3_t		origin;
	int			mod;

	if (ent->owner->client)
		PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT);

	//FIXME: if we are onground then raise our Z just a bit since we are a point?
	if (ent->enemy)
	{
		float	points;
		vec3_t	v;
		vec3_t	dir;

		VectorAdd (ent->enemy->mins, ent->enemy->maxs, v);
		VectorMA (ent->enemy->s.origin, 0.5, v, v);
		VectorSubtract (ent->s.origin, v, v);
		points = ent->dmg - 0.5 * VectorLength (v);
		VectorSubtract (ent->enemy->s.origin, ent->s.origin, dir);
		if (ent->spawnflags & 1)
			mod = MOD_HANDGRENADE;
		else
			mod = MOD_GRENADE;
		T_Damage (ent->enemy, ent, ent->owner, dir, ent->s.origin, vec3_origin, (int)points, (int)points, DAMAGE_RADIUS, mod);
	}

	if (ent->spawnflags & 2)
		mod = MOD_HELD_GRENADE;
	else if (ent->spawnflags & 1)
		mod = MOD_HG_SPLASH;
	else
		mod = MOD_G_SPLASH;
	T_RadiusDamage(ent, ent->owner, ent->dmg, ent->enemy, ent->dmg_radius, mod);

	VectorMA (ent->s.origin, -0.02f, ent->velocity, origin);
	gi.WriteByte (svc_temp_entity);
	if (ent->waterlevel)
	{
		if (ent->groundentity)
			gi.WriteByte (TE_GRENADE_EXPLOSION_WATER);
		else
			gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
	}
	else
	{
		if (ent->groundentity)
			gi.WriteByte (TE_GRENADE_EXPLOSION);
		else
			gi.WriteByte (TE_ROCKET_EXPLOSION);
	}
	gi.WritePosition (origin);
	gi.multicast (ent->s.origin, MULTICAST_PHS);

	G_FreeEdict (ent);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rax
cmpq $0x0, 0x58(%rax)
je 0x52d6b
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdi
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
movl $0x2, %edx
callq 0x19080
movq -0x8(%rbp), %rax
cmpq $0x0, 0x2a0(%rax)
je 0x52f69
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xcc(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
addss 0xd8(%rax), %xmm0
movss %xmm0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xd0(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
addss 0xdc(%rax), %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xd4(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
addss 0xe0(%rax), %xmm0
movss %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rdi
addq $0x4, %rdi
leaq -0x28(%rbp), %rsi
leaq -0x28(%rbp), %rdx
movss 0x1fd33(%rip), %xmm0    # 0x72b50
callq 0x199c0
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
subss -0x28(%rbp), %xmm0
movss %xmm0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
subss -0x24(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
subss -0x20(%rbp), %xmm0
movss %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rax
cvtsi2sdl 0x280(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x194e0
movsd -0x40(%rbp), %xmm1
cvtss2sd %xmm0, %xmm0
movsd 0x1fcc2(%rip), %xmm2    # 0x72b48
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0xc(%rax), %xmm0
movss %xmm0, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x52f0c
movl $0xf, -0x18(%rbp)
jmp 0x52f13
movl $0x6, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdx
leaq -0x34(%rbp), %rcx
movq -0x8(%rbp), %r8
addq $0x4, %r8
cvttss2si -0x1c(%rbp), %r11d
cvttss2si -0x1c(%rbp), %r10d
movl -0x18(%rbp), %eax
movq 0x2f819(%rip), %r9      # 0x82768
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movl %eax, 0x18(%rsp)
callq 0x192c0
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x52f84
movl $0x18, -0x18(%rbp)
jmp 0x52fa8
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x52f9f
movl $0x10, -0x18(%rbp)
jmp 0x52fa6
movl $0x7, -0x18(%rbp)
jmp 0x52fa8
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rsi
movq -0x8(%rbp), %rax
cvtsi2ssl 0x280(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rdx
movq -0x8(%rbp), %rax
movss 0x288(%rax), %xmm1
movl -0x18(%rbp), %ecx
callq 0x180c0
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movq -0x8(%rbp), %rsi
addq $0x1c0, %rsi            # imm = 0x1C0
leaq -0x14(%rbp), %rdx
movss 0x2324b(%rip), %xmm0    # 0x7624c
callq 0x199c0
movl $0x3, %edi
movq 0x2f5ee(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30c(%rax)
je 0x5305b
movq -0x8(%rbp), %rax
cmpq $0x0, 0x2b8(%rax)
je 0x53047
movl $0x12, %edi
movq 0x2f5c1(%rip), %rax     # 0x82600
callq *0xc8(%rax)
jmp 0x53059
movl $0x11, %edi
movq 0x2f5ad(%rip), %rax     # 0x82600
callq *0xc8(%rax)
jmp 0x53091
movq -0x8(%rbp), %rax
cmpq $0x0, 0x2b8(%rax)
je 0x5307d
movl $0x8, %edi
movq 0x2f58b(%rip), %rax     # 0x82600
callq *0xc8(%rax)
jmp 0x5308f
movl $0x7, %edi
movq 0x2f577(%rip), %rax     # 0x82600
callq *0xc8(%rax)
jmp 0x53091
movq 0x2f568(%rip), %rax     # 0x82600
movq 0xf0(%rax), %rax
leaq -0x14(%rbp), %rdi
callq *%rax
movq 0x2f554(%rip), %rax     # 0x82600
movq 0xb0(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movl $0x1, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x19cd0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)