// File: /workspace/github_c_makefile_star2_O1/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 0x413f5
leaq 0x4(%rbx), %r14
movss 0x288(%rbx), %xmm0
xorl %edi, %edi
movq %r14, %rsi
callq 0x19880
testq %rax, %rax
je 0x413f5
movq %rax, %r15
leaq 0x1c0(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0xc(%rsp), %r13
movq 0x283dc(%rip), %r12     # 0x69600
cmpl $0x0, 0x27c(%r15)
je 0x413d6
cmpq 0x110(%rbx), %r15
je 0x413d6
movq %r15, %rdi
movq %rbx, %rsi
callq 0x18930
testl %eax, %eax
je 0x413d6
movq 0x110(%rbx), %rsi
movq %r15, %rdi
callq 0x18930
testl %eax, %eax
je 0x413d6
movss 0xcc(%r15), %xmm0
addss 0xd8(%r15), %xmm0
movss %xmm0, 0xc(%rsp)
movss 0xd0(%r15), %xmm0
addss 0xdc(%r15), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0xd4(%r15), %xmm0
addss 0xe0(%r15), %xmm0
movss %xmm0, 0x14(%rsp)
leaq 0x4(%r15), %rbp
movq %rbp, %rdi
movss 0x14144(%rip), %xmm0    # 0x55404
movq %r13, %rsi
movq %r13, %rdx
callq 0x19770
movss 0x4(%rbx), %xmm0
subss 0xc(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
movss 0x8(%rbx), %xmm0
subss 0x10(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0xc(%rbx), %xmm0
subss 0x14(%rsp), %xmm0
movss %xmm0, 0x14(%rsp)
movq %r13, %rdi
callq 0x192e0
cvtsi2sdl 0x284(%rbx), %xmm2
divss 0x288(%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x1904e(%rip), %xmm0    # 0x5a370
jb 0x4132a
sqrtsd %xmm0, %xmm0
jmp 0x4133b
movsd %xmm2, 0x18(%rsp)
callq 0x19840
movsd 0x18(%rsp), %xmm2
movsd 0x158c5(%rip), %xmm1    # 0x56c08
subsd %xmm0, %xmm1
mulsd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movaps %xmm0, %xmm1
mulss 0x140a7(%rip), %xmm1    # 0x55404
cmpq 0x110(%rbx), %r15
je 0x41369
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 0x283a2(%rip), %r9      # 0x69768
pushq $0xe
pushq $0x4
pushq $0x0
pushq %rax
callq 0x190f0
addq $0x20, %rsp
movss 0x288(%rbx), %xmm0
movq %r15, %rdi
movq %r14, %rsi
callq 0x19880
movq %rax, %r15
testq %rax, %rax
jne 0x41224
movq 0x289a4(%rip), %rax     # 0x69da0
movss 0x4(%rax), %xmm0
addss 0x12e87(%rip), %xmm0    # 0x54290
movss %xmm0, 0x200(%rbx)
movl 0x38(%rbx), %eax
incl %eax
movl %eax, 0x38(%rbx)
cmpl $0x5, %eax
jne 0x4142c
movq 0x2800b(%rip), %rax     # 0x69430
movq %rax, 0x210(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq