// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_func.c
// Function: Think_CalcMoveSpeed
void Think_CalcMoveSpeed (edict_t *self)
{
	edict_t	*ent;
	float	min;
	float	time;
	float	newspeed;
	float	ratio;
	float	dist;

	if (self->flags & FL_TEAMSLAVE)
		return;		// only the team master does this

	// find the smallest distance any member of the team will be moving
	min = fabs(self->moveinfo.distance);
	for (ent = self->teamchain; ent; ent = ent->teamchain)
	{
		dist = fabs(ent->moveinfo.distance);
		if (dist < min)
			min = dist;
	}

	time = min / self->moveinfo.speed;

	// adjust speeds so they will all complete at the same time
	for (ent = self; ent; ent = ent->teamchain)
	{
		newspeed = fabs(ent->moveinfo.distance) / time;
		ratio = newspeed / ent->moveinfo.speed;
		if (ent->moveinfo.accel == ent->moveinfo.speed)
			ent->moveinfo.accel = newspeed;
		else
			ent->moveinfo.accel *= ratio;
		if (ent->moveinfo.decel == ent->moveinfo.speed)
			ent->moveinfo.decel = newspeed;
		else
			ent->moveinfo.decel *= ratio;
		ent->moveinfo.speed = newspeed;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x11c(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x360e1
jmp 0x3628e
movq -0x8(%rbp), %rax
movss 0x380(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x3caa8(%rip), %xmm1    # 0x72ba0
pand %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x2c8(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3616b
movq -0x10(%rbp), %rax
movss 0x380(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x3ca6e(%rip), %xmm1    # 0x72ba0
pand %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x24(%rbp), %xmm1
movss -0x14(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x36158
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x3615a
movq -0x10(%rbp), %rax
movq 0x2c8(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x36114
movss -0x14(%rbp), %xmm0
movq -0x8(%rbp), %rax
divss 0x378(%rax), %xmm0
movss %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3628e
movq -0x10(%rbp), %rax
movss 0x380(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x3c9f5(%rip), %xmm1    # 0x72ba0
pand %xmm1, %xmm0
movss -0x18(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movss -0x1c(%rbp), %xmm0
movq -0x10(%rbp), %rax
divss 0x378(%rax), %xmm0
movss %xmm0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movss 0x374(%rax), %xmm0
movq -0x10(%rbp), %rax
ucomiss 0x378(%rax), %xmm0
jne 0x36209
jp 0x36209
movss -0x1c(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x374(%rax)
jmp 0x36222
movss -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rax
mulss 0x374(%rax), %xmm0
movss %xmm0, 0x374(%rax)
movq -0x10(%rbp), %rax
movss 0x37c(%rax), %xmm0
movq -0x10(%rbp), %rax
ucomiss 0x378(%rax), %xmm0
jne 0x36250
jp 0x36250
movss -0x1c(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x37c(%rax)
jmp 0x36269
movss -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rax
mulss 0x37c(%rax), %xmm0
movss %xmm0, 0x37c(%rax)
movss -0x1c(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x378(%rax)
movq -0x10(%rbp), %rax
movq 0x2c8(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x36189
popq %rbp
retq