// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_func.c
// Function: train_next
void train_next (edict_t *self)
{
	edict_t		*ent;
	vec3_t		dest;
	qboolean	first;

	first = true;
again:
	if (!self->target)
	{
//		gi.dprintf ("train_next: no next target\n");
		return;
	}

	ent = G_PickTarget (self->target);
	if (!ent)
	{
		gi.dprintf ("train_next: bad target %s\n", self->target);
		return;
	}

	self->target = ent->target;

	// check for a teleport path_corner
	if (ent->spawnflags & 1)
	{
		if (!first)
		{
			gi.dprintf ("connected teleport path_corners, see %s at %s\n", ent->classname, vtos(ent->s.origin));
			return;
		}
		first = false;
		VectorSubtract (ent->s.origin, self->mins, self->s.origin);
		VectorCopy (self->s.origin, self->s.old_origin);
		self->s.event = EV_OTHER_TELEPORT;
		gi.linkentity (self);
		goto again;
	}

	self->moveinfo.wait = ent->wait;
	self->target_ent = ent;

	if (!(self->flags & FL_TEAMSLAVE))
	{
		if (self->moveinfo.sound_start)
			gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
		self->s.sound = self->moveinfo.sound_middle;
	}

	VectorSubtract (ent->s.origin, self->mins, dest);
	self->moveinfo.state = STATE_TOP;
	VectorCopy (self->s.origin, self->moveinfo.start_origin);
	VectorCopy (dest, self->moveinfo.end_origin);
	Move_Calc (self, dest, train_wait);
	self->spawnflags |= TRAIN_START_ON;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x1, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x150(%rax)
jne 0x37ee6
jmp 0x381db
movq -0x8(%rbp), %rax
movq 0x150(%rax), %rdi
callq 0x18390
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x37f27
movq 0x4a6f8(%rip), %rax     # 0x82600
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x150(%rax), %rsi
leaq 0x3ada2(%rip), %rdi     # 0x72cc0
movb $0x0, %al
callq *%rcx
jmp 0x381db
movq -0x10(%rbp), %rax
movq 0x150(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x150(%rax)
movq -0x10(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3805a
cmpl $0x0, -0x20(%rbp)
jne 0x37f9f
movq 0x4a6a0(%rip), %rax     # 0x82600
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x138(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
callq 0x19260
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rcx
movq %rax, %rdx
leaq 0x3ad45(%rip), %rdi     # 0x72cdb
movb $0x0, %al
callq *%rcx
jmp 0x381db
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0xcc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0xd0(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x10(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0xd4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1c(%rax)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x24(%rax)
movq -0x8(%rbp), %rax
movl $0x7, 0x50(%rax)
movq 0x4a5b8(%rip), %rax     # 0x82600
movq 0x90(%rax), %rax
movq -0x8(%rbp), %rdi
callq *%rax
jmp 0x37ed3
movq -0x10(%rbp), %rax
movss 0x2f8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x384(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x188(%rax)
movq -0x8(%rbp), %rax
movl 0x11c(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x380e6
movq -0x8(%rbp), %rax
cmpl $0x0, 0x368(%rax)
je 0x380d5
movq 0x4a557(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl 0x368(%rcx), %edx
movl $0xa, %esi
movss 0x37e24(%rip), %xmm0    # 0x6feec
movss 0x37e40(%rip), %xmm1    # 0x6ff10
xorps %xmm2, %xmm2
callq *%rax
movq -0x8(%rbp), %rax
movl 0x36c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0xcc(%rax), %xmm0
movss %xmm0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0xd0(%rax), %xmm0
movss %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0xd4(%rax), %xmm0
movss %xmm0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x388(%rax)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x338(%rax)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x33c(%rax)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x340(%rax)
movss -0x1c(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x350(%rax)
movss -0x18(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x354(%rax)
movss -0x14(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x358(%rax)
movq -0x8(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
movq 0x4aded(%rip), %rdx     # 0x82fb0
callq 0x18ff0
movq -0x8(%rbp), %rax
movl 0x140(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x140(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)