// File: /workspace/github_c_makefile_star2_O2/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
movl 0x38(%rdi), %eax
testl %eax, %eax
jne 0x3d4d7
leaq 0x4(%rbx), %r14
leaq 0x1c0(%rbx), %rax
movq %rax, 0x20(%rsp)
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movq 0x292c2(%rip), %r15     # 0x66600
movss 0x288(%rbx), %xmm0
movq %r13, %rdi
movq %r14, %rsi
callq 0x19a50
testq %rax, %rax
je 0x3d4d4
movq %rax, %r13
cmpl $0x0, 0x27c(%rax)
je 0x3d33e
cmpq 0x110(%rbx), %r13
je 0x3d33e
movq %r13, %rdi
movq %rbx, %rsi
callq 0x189b0
testl %eax, %eax
je 0x3d33e
movq 0x110(%rbx), %rsi
movq %r13, %rdi
callq 0x189b0
testl %eax, %eax
je 0x3d33e
movsd 0xcc(%r13), %xmm0
movsd 0xd8(%r13), %xmm1
addps %xmm0, %xmm1
movlps %xmm1, 0x8(%rsp)
movss 0xd4(%r13), %xmm0
addss 0xe0(%r13), %xmm0
movss %xmm0, 0x10(%rsp)
movq %r13, %rbp
addq $0x4, %rbp
movq %rbp, %rdi
movss 0x1302b(%rip), %xmm0    # 0x50400
movq %r12, %rsi
movq %r12, %rdx
callq 0x19940
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 %r12, %rdi
callq 0x19460
cvtsi2sdl 0x284(%rbx), %xmm2
divss 0x288(%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x18138(%rip), %xmm0    # 0x55560
jb 0x3d430
sqrtsd %xmm0, %xmm0
jmp 0x3d441
movsd %xmm2, 0x18(%rsp)
callq 0x19a10
movsd 0x18(%rsp), %xmm2
movsd 0x148a7(%rip), %xmm1    # 0x51cf0
subsd %xmm0, %xmm1
mulsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm0
movaps %xmm0, %xmm1
mulss 0x12fa0(%rip), %xmm1    # 0x50400
cmpq 0x110(%rbx), %r13
je 0x3d46c
movaps %xmm0, %xmm1
movss %xmm1, 0x18(%rsp)
pushq $0x3
popq %rdi
callq *0xc8(%r15)
pushq $0x14
popq %rdi
callq *0xc8(%r15)
movq %rbp, %rdi
callq *0xf0(%r15)
movq %rbp, %rdi
pushq $0x1
popq %rsi
callq *0xb0(%r15)
movq 0x110(%rbx), %rdx
cvttss2si 0x18(%rsp), %eax
movq %r13, %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rcx
movq %rbp, %r8
movq 0x292a9(%rip), %r9      # 0x66768
pushq $0xe
pushq $0x4
pushq $0x0
pushq %rax
callq 0x19260
addq $0x20, %rsp
jmp 0x3d33e
movl 0x38(%rbx), %eax
movq 0x298c2(%rip), %rcx     # 0x66da0
movss 0x4(%rcx), %xmm0
addss 0x11da5(%rip), %xmm0    # 0x4f290
movss %xmm0, 0x200(%rbx)
incl %eax
movl %eax, 0x38(%rbx)
cmpl $0x5, %eax
jne 0x3d50b
movq 0x28f2c(%rip), %rax     # 0x66430
movq %rax, 0x210(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq