// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_weapon.c
// Function: bfg_think
void bfg_think (edict_t *self)
{
	edict_t	*ent;
	edict_t	*ignore;
	vec3_t	point;
	vec3_t	dir;
	vec3_t	start;
	vec3_t	end;
	int		dmg;
	trace_t	tr;

	if (deathmatch->value)
		dmg = 5;
	else
		dmg = 10;

#ifdef WEAP_BALANCE_OK	
	if ((int)ctfflags->value & CTF_WEAP_BALANCE)
		dmg = 3; //don't burn the players so hard
#endif

	ent = NULL;
	while ((ent = findradius(ent, self->s.origin, 256)) != NULL)
	{
		if (ent == self)
			continue;

		if (ent == self->owner)
			continue;

		if (!ent->takedamage)
			continue;

		if (!(ent->svflags & SVF_MONSTER) && (!ent->client) && (strcmp(ent->classname, "misc_explobox") != 0))
			continue;

		VectorMA (ent->absmin, 0.5, ent->size, point);

		VectorSubtract (point, self->s.origin, dir);
		VectorNormalize (dir);

		ignore = self;
		VectorCopy (self->s.origin, start);
		VectorMA (start, 2048, dir, end);
		while(1)
		{
			tr = gi.trace (start, NULL, NULL, end, ignore, CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_DEADMONSTER);

			if (!tr.ent)
				break;

			// hurt it if we can
			if ((tr.ent->takedamage) && !(tr.ent->flags & FL_IMMUNE_LASER) && (tr.ent != self->owner))
				T_Damage (tr.ent, self, self->owner, dir, tr.endpos, vec3_origin, dmg, 1, DAMAGE_ENERGY, MOD_BFG_LASER);

			// if we hit something that's not a monster or player we're done
			if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client))
			{
				gi.WriteByte (svc_temp_entity);
				gi.WriteByte (TE_LASER_SPARKS);
				gi.WriteByte (4);
				gi.WritePosition (tr.endpos);
				gi.WriteDir (tr.plane.normal);
				gi.WriteByte (self->s.skinnum);
				gi.multicast (tr.endpos, MULTICAST_PVS);
				break;
			}

			ignore = tr.ent;
			VectorCopy (tr.endpos, start);
		}

		gi.WriteByte (svc_temp_entity);
		gi.WriteByte (TE_BFG_LASER);
		gi.WritePosition (self->s.origin);
		gi.WritePosition (tr.endpos);
		gi.multicast (self->s.origin, MULTICAST_PHS);
	}

	self->nextthink = level.time + FRAMETIME;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq 0x2ecca(%rip), %rax     # 0x82ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x5420a
jp 0x5420a
jmp 0x54213
movl $0x5, -0x4c(%rbp)
jmp 0x5421a
movl $0xa, -0x4c(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
movss 0x1bce6(%rip), %xmm0    # 0x6ff1c
callq 0x19ae0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x545ac
movq -0x10(%rbp), %rax
cmpq -0x8(%rbp), %rax
jne 0x54255
jmp 0x54222
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x110(%rcx), %rax
jne 0x54268
jmp 0x54222
movq -0x10(%rbp), %rax
cmpl $0x0, 0x27c(%rax)
jne 0x54277
jmp 0x54222
movq -0x10(%rbp), %rax
movl 0xc8(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x542b5
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x542b5
movq -0x10(%rbp), %rax
movq 0x138(%rax), %rdi
leaq 0x20e8a(%rip), %rsi     # 0x75130
callq 0x18bf0
cmpl $0x0, %eax
je 0x542b5
jmp 0x54222
movq -0x10(%rbp), %rdi
addq $0xe4, %rdi
movq -0x10(%rbp), %rsi
addq $0xfc, %rsi
leaq -0x24(%rbp), %rdx
movss 0x1e879(%rip), %xmm0    # 0x72b50
callq 0x199c0
movss -0x24(%rbp), %xmm0
movq -0x8(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x30(%rbp)
movss -0x20(%rbp), %xmm0
movq -0x8(%rbp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0x2c(%rbp)
movss -0x1c(%rbp), %xmm0
movq -0x8(%rbp), %rax
subss 0xc(%rax), %xmm0
movss %xmm0, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x183d0
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, -0x34(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdx
movss 0x1bbbc(%rip), %xmm0    # 0x6ff20
callq 0x199c0
movq 0x2e290(%rip), %rax     # 0x82600
movq 0x60(%rax), %rax
leaq -0x3c(%rbp), %rsi
leaq -0x48(%rbp), %r8
movq -0x18(%rbp), %r9
leaq -0xe0(%rbp), %rdi
xorl %ecx, %ecx
movq %rcx, %rdx
movl $0x6000001, (%rsp)      # imm = 0x6000001
callq *%rax
leaq -0x98(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
cmpq $0x0, -0x58(%rbp)
jne 0x543b9
jmp 0x54533
movq -0x58(%rbp), %rax
cmpl $0x0, 0x27c(%rax)
je 0x54435
movq -0x58(%rbp), %rax
movl 0x11c(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x54435
movq -0x58(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x110(%rcx), %rax
je 0x54435
movq -0x58(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x98(%rbp), %r8
addq $0xc, %r8
movl -0x4c(%rbp), %eax
movq 0x2e353(%rip), %r9      # 0x82768
movl %eax, (%rsp)
movl $0x1, 0x8(%rsp)
movl $0x4, 0x10(%rsp)
movl $0xc, 0x18(%rsp)
callq 0x192c0
movq -0x58(%rbp), %rax
movl 0xc8(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x544ff
movq -0x58(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x544ff
movl $0x3, %edi
movq 0x2e19a(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movl $0xf, %edi
movq 0x2e188(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movl $0x4, %edi
movq 0x2e176(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq 0x2e169(%rip), %rax     # 0x82600
movq 0xf0(%rax), %rax
leaq -0x98(%rbp), %rdi
addq $0xc, %rdi
callq *%rax
movq 0x2e14e(%rip), %rax     # 0x82600
movq 0xf8(%rax), %rax
leaq -0x98(%rbp), %rdi
addq $0x18, %rdi
callq *%rax
movq 0x2e133(%rip), %rax     # 0x82600
movq 0xc8(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x3c(%rcx), %edi
callq *%rax
movq 0x2e11c(%rip), %rax     # 0x82600
movq 0xb0(%rax), %rax
leaq -0x98(%rbp), %rdi
addq $0xc, %rdi
movl $0x2, %esi
callq *%rax
jmp 0x54533
movq -0x58(%rbp), %rax
movq %rax, -0x18(%rbp)
movss -0x8c(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x88(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x84(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
jmp 0x54369
movl $0x3, %edi
movq 0x2e0c1(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movl $0x17, %edi
movq 0x2e0af(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq 0x2e0a2(%rip), %rax     # 0x82600
movq 0xf0(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
callq *%rax
movq 0x2e08a(%rip), %rax     # 0x82600
movq 0xf0(%rax), %rax
leaq -0x98(%rbp), %rdi
addq $0xc, %rdi
callq *%rax
movq 0x2e06f(%rip), %rax     # 0x82600
movq 0xb0(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movl $0x1, %esi
callq *%rax
jmp 0x54222
movss 0x1bce0(%rip), %xmm0    # 0x70294
movq 0x2e7e5(%rip), %rax     # 0x82da0
addss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x200(%rax)
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)