// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_target.c
// Function: target_laser_think
void target_laser_think (edict_t *self)
{
	edict_t	*ignore;
	vec3_t	start;
	vec3_t	end;
	trace_t	tr;
	vec3_t	point;
	vec3_t	last_movedir;
	int		count;

	if (self->spawnflags & 0x80000000)
		count = 8;
	else
		count = 4;

	if (self->enemy)
	{
		VectorCopy (self->movedir, last_movedir);
		VectorMA (self->enemy->absmin, 0.5, self->enemy->size, point);
		VectorSubtract (point, self->s.origin, self->movedir);
		VectorNormalize (self->movedir);
		if (!VectorCompare(self->movedir, last_movedir))
			self->spawnflags |= 0x80000000;
	}

	ignore = self;
	VectorCopy (self->s.origin, start);
	VectorMA (start, 2048, self->movedir, 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))
			T_Damage (tr.ent, self, self->activator, self->movedir, tr.endpos, vec3_origin, self->dmg, 1, DAMAGE_ENERGY, MOD_TARGET_LASER);

		// if we hit something that's not a monster or player or is immune to lasers, we're done
		if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client))
		{
			if (self->spawnflags & 0x80000000)
			{
				self->spawnflags &= ~0x80000000;
				gi.WriteByte (svc_temp_entity);
				gi.WriteByte (TE_LASER_SPARKS);
				gi.WriteByte (count);
				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);
	}

	VectorCopy (tr.endpos, self->s.old_origin);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x4dbff
movl $0x8, -0x8c(%rbp)
jmp 0x4dc09
movl $0x4, -0x8c(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x2a0(%rax)
je 0x4dd1b
movq -0x8(%rbp), %rax
movss 0x19c(%rax), %xmm0
movss %xmm0, -0x88(%rbp)
movq -0x8(%rbp), %rax
movss 0x1a0(%rax), %xmm0
movss %xmm0, -0x84(%rbp)
movq -0x8(%rbp), %rax
movss 0x1a4(%rax), %xmm0
movss %xmm0, -0x80(%rbp)
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rdi
addq $0xe4, %rdi
movq -0x8(%rbp), %rax
movq 0x2a0(%rax), %rsi
addq $0xfc, %rsi
leaq -0x7c(%rbp), %rdx
movss 0x24ecc(%rip), %xmm0    # 0x72b50
callq 0x199c0
movss -0x7c(%rbp), %xmm0
movq -0x8(%rbp), %rax
subss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x19c(%rax)
movss -0x78(%rbp), %xmm0
movq -0x8(%rbp), %rax
subss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1a0(%rax)
movss -0x74(%rbp), %xmm0
movq -0x8(%rbp), %rax
subss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1a4(%rax)
movq -0x8(%rbp), %rdi
addq $0x19c, %rdi            # imm = 0x19C
callq 0x183d0
movq -0x8(%rbp), %rdi
addq $0x19c, %rdi            # imm = 0x19C
leaq -0x88(%rbp), %rsi
callq 0x18c60
cmpl $0x0, %eax
jne 0x4dd19
movq -0x8(%rbp), %rax
movl 0x140(%rax), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x140(%rax)
jmp 0x4dd1b
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, -0x14(%rbp)
leaq -0x1c(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x19c, %rsi            # imm = 0x19C
leaq -0x28(%rbp), %rdx
movss 0x221b8(%rip), %xmm0    # 0x6ff20
callq 0x199c0
movq 0x3488c(%rip), %rax     # 0x82600
movq 0x60(%rax), %rax
leaq -0x1c(%rbp), %rsi
leaq -0x28(%rbp), %r8
movq -0x10(%rbp), %r9
leaq -0xd8(%rbp), %rdi
xorl %ecx, %ecx
movq %rcx, %rdx
movl $0x6000001, (%rsp)      # imm = 0x6000001
callq *%rax
leaq -0x70(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
cmpq $0x0, -0x30(%rbp)
jne 0x4ddba
jmp 0x4df4e
movq -0x30(%rbp), %rax
cmpl $0x0, 0x27c(%rax)
je 0x4de30
movq -0x30(%rbp), %rax
movl 0x11c(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x4de30
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x2b0(%rax), %rdx
movq -0x8(%rbp), %rcx
addq $0x19c, %rcx            # imm = 0x19C
leaq -0x70(%rbp), %r8
addq $0xc, %r8
movq -0x8(%rbp), %rax
movl 0x280(%rax), %eax
movq 0x34958(%rip), %r9      # 0x82768
movl %eax, (%rsp)
movl $0x1, 0x8(%rsp)
movl $0x4, 0x10(%rsp)
movl $0x1e, 0x18(%rsp)
callq 0x192c0
movq -0x30(%rbp), %rax
movl 0xc8(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x4df23
movq -0x30(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x4df23
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x4df21
movq -0x8(%rbp), %rax
movl 0x140(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, 0x140(%rax)
movl $0x3, %edi
movq 0x34771(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movl $0xf, %edi
movq 0x3475f(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq 0x34752(%rip), %rax     # 0x82600
movq 0xc8(%rax), %rax
movl -0x8c(%rbp), %edi
callq *%rax
movq 0x3473c(%rip), %rax     # 0x82600
movq 0xf0(%rax), %rax
leaq -0x70(%rbp), %rdi
addq $0xc, %rdi
callq *%rax
movq 0x34724(%rip), %rax     # 0x82600
movq 0xf8(%rax), %rax
leaq -0x70(%rbp), %rdi
addq $0x18, %rdi
callq *%rax
movq 0x3470c(%rip), %rax     # 0x82600
movq 0xc8(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x3c(%rcx), %edi
callq *%rax
movq 0x346f5(%rip), %rax     # 0x82600
movq 0xb0(%rax), %rax
leaq -0x70(%rbp), %rdi
addq $0xc, %rdi
movl $0x2, %esi
callq *%rax
jmp 0x4df4e
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
movss -0x64(%rbp), %xmm0
movss %xmm0, -0x1c(%rbp)
movss -0x60(%rbp), %xmm0
movss %xmm0, -0x18(%rbp)
movss -0x5c(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x4dd6d
movss -0x64(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1c(%rax)
movss -0x60(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x20(%rax)
movss -0x5c(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x24(%rax)
movss 0x22314(%rip), %xmm0    # 0x70294
movq 0x34e19(%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)