// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_weapon.c
// Function: bfg_explode
void bfg_explode (edict_t *self)
{
	edict_t	*ent;
	float	points;
	vec3_t	v;
	float	dist;

	if (self->s.frame == 0)
	{
		// the BFG effect
		ent = NULL;
		while ((ent = findradius(ent, self->s.origin, self->dmg_radius)) != NULL)
		{
			if (!ent->takedamage)
				continue;
			if (ent == self->owner)
				continue;
			if (!CanDamage (ent, self))
				continue;
			if (!CanDamage (ent, self->owner))
				continue;

			VectorAdd (ent->mins, ent->maxs, v);
			VectorMA (ent->s.origin, 0.5, v, v);
			VectorSubtract (self->s.origin, v, v);
			dist = VectorLength(v);
			points = self->radius_dmg * (1.0 - sqrt(dist/self->dmg_radius));
			if (ent == self->owner)
				points = points * 0.5;

			gi.WriteByte (svc_temp_entity);
			gi.WriteByte (TE_BFG_EXPLOSION);
			gi.WritePosition (ent->s.origin);
			gi.multicast (ent->s.origin, MULTICAST_PHS);
			T_Damage (ent, self, self->owner, self->velocity, ent->s.origin, vec3_origin, (int)points, 0, DAMAGE_ENERGY, MOD_BFG_EFFECT);
		}
	}

	self->nextthink = level.time + FRAMETIME;
	self->s.frame++;
	if (self->s.frame == 5)
		self->think = G_FreeEdict;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x38(%rdi)
jne 0x40b03
leaq 0x4(%rbx), %r14
movss 0x288(%rbx), %xmm0
xorl %edi, %edi
movq %r14, %rsi
callq 0x19870
testq %rax, %rax
je 0x40b03
movq %rax, %r15
leaq 0x1c0(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x8(%rsp), %r13
movq 0x27ca9(%rip), %r12     # 0x68600
cmpl $0x0, 0x27c(%r15)
je 0x40ae4
cmpq 0x110(%rbx), %r15
je 0x40ae4
movq %r15, %rdi
movq %rbx, %rsi
callq 0x18930
testl %eax, %eax
je 0x40ae4
movq 0x110(%rbx), %rsi
movq %r15, %rdi
callq 0x18930
testl %eax, %eax
je 0x40ae4
movsd 0xcc(%r15), %xmm0
movsd 0xd8(%r15), %xmm1
addps %xmm0, %xmm1
movlps %xmm1, 0x8(%rsp)
movss 0xd4(%r15), %xmm0
addss 0xe0(%r15), %xmm0
movss %xmm0, 0x10(%rsp)
leaq 0x4(%r15), %rbp
movq %rbp, %rdi
movss 0x13a23(%rip), %xmm0    # 0x54400
movq %r13, %rsi
movq %r13, %rdx
callq 0x19760
movsd 0x4(%rbx), %xmm0
movsd 0x8(%rsp), %xmm1
subps %xmm1, %xmm0
movlps %xmm0, 0x8(%rsp)
movss 0xc(%rbx), %xmm0
subss 0x10(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
movq %r13, %rdi
callq 0x192e0
cvtsi2sdl 0x284(%rbx), %xmm2
divss 0x288(%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x18b50(%rip), %xmm0    # 0x59580
jb 0x40a38
sqrtsd %xmm0, %xmm0
jmp 0x40a49
movsd %xmm2, 0x18(%rsp)
callq 0x19830
movsd 0x18(%rsp), %xmm2
movsd 0x152bf(%rip), %xmm1    # 0x55d10
subsd %xmm0, %xmm1
mulsd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movaps %xmm0, %xmm1
mulss 0x13995(%rip), %xmm1    # 0x54400
cmpq 0x110(%rbx), %r15
je 0x40a77
movaps %xmm0, %xmm1
movss %xmm1, 0x18(%rsp)
movl $0x3, %edi
callq *0xc8(%r12)
movl $0x14, %edi
callq *0xc8(%r12)
movq %rbp, %rdi
callq *0xf0(%r12)
movq %rbp, %rdi
movl $0x1, %esi
callq *0xb0(%r12)
movq 0x110(%rbx), %rdx
cvttss2si 0x18(%rsp), %eax
movq %r15, %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rcx
movq %rbp, %r8
movq 0x27c94(%rip), %r9      # 0x68768
pushq $0xe
pushq $0x4
pushq $0x0
pushq %rax
callq 0x190f0
addq $0x20, %rsp
movss 0x288(%rbx), %xmm0
movq %r15, %rdi
movq %r14, %rsi
callq 0x19870
movq %rax, %r15
testq %rax, %rax
jne 0x40957
movq 0x28296(%rip), %rax     # 0x68da0
movss 0x4(%rax), %xmm0
addss 0x12779(%rip), %xmm0    # 0x53290
movss %xmm0, 0x200(%rbx)
movl 0x38(%rbx), %eax
incl %eax
movl %eax, 0x38(%rbx)
cmpl $0x5, %eax
jne 0x40b3a
movq 0x278fd(%rip), %rax     # 0x68430
movq %rax, 0x210(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq