// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/m_move.c
// Function: SV_NewChaseDir
void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
{
	float	deltax,deltay;
	float	d[3];
	float	tdir, olddir, turnaround;
	
	//FIXME: how did we get here with no enemy
	if (!enemy)
		return;
	
	olddir = anglemod( (actor->ideal_yaw/45)*45.0f );
	turnaround = anglemod(olddir - 180);
	
	deltax = enemy->s.origin[0] - actor->s.origin[0];
	deltay = enemy->s.origin[1] - actor->s.origin[1];
	if (deltax>10)
		d[1]= 0;
	else if (deltax<-10)
		d[1]= 180;
	else
		d[1]= DI_NODIR;
	if (deltay<-10)
		d[2]= 270;
	else if (deltay>10)
		d[2]= 90;
	else
		d[2]= DI_NODIR;
	
	// try direct route
	if (d[1] != DI_NODIR && d[2] != DI_NODIR)
	{
		if (d[1] == 0)
			tdir = d[2] == 90 ? 45 : 315;
		else
			tdir = d[2] == 90 ? 135 : 215;
		
		if (tdir != turnaround && SV_StepDirection(actor, tdir, dist))
			return;
	}
	
	// try other directions
	if ( ((rand()&3) & 1) ||  fabsf(deltay) > fabsf(deltax))
	{
		tdir=d[1];
		d[1]=d[2];
		d[2]=tdir;
	}
	
	if (d[1]!=DI_NODIR && d[1]!=turnaround 
		&& SV_StepDirection(actor, d[1], dist))
		return;
	
	if (d[2]!=DI_NODIR && d[2]!=turnaround
		&& SV_StepDirection(actor, d[2], dist))
		return;
	
	/* there is no direct path to the player, so pick another direction */
	
	if (olddir!=DI_NODIR && SV_StepDirection(actor, olddir, dist))
		return;
	
	if (rand()&1) 	/*randomly determine direction of search*/
	{
		for (tdir=0 ; tdir<=315 ; tdir += 45)
			if (tdir!=turnaround && SV_StepDirection(actor, tdir, dist) )
				return;
	}
	else
	{
		for (tdir=315 ; tdir >=0 ; tdir -= 45)
			if (tdir!=turnaround && SV_StepDirection(actor, tdir, dist) )
				return;
	}
	
	if (turnaround != DI_NODIR && SV_StepDirection(actor, turnaround, dist) )
		return;
	
	actor->ideal_yaw = olddir;		// can't move
	
	// if a bridge was pulled out from underneath a monster, it may not have
	// a valid standing position at all
	
	if (!M_CheckBottom (actor))
		SV_FixCheckBottom (actor);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x55b21
jmp 0x55f26
movq -0x8(%rbp), %rax
movss 0x1fc(%rax), %xmm0
movss 0x208b3(%rip), %xmm1    # 0x763e8
divss %xmm1, %xmm0
movss 0x208a7(%rip), %xmm1    # 0x763e8
mulss %xmm1, %xmm0
callq 0x18b20
movss %xmm0, -0x30(%rbp)
movss -0x30(%rbp), %xmm0
movss 0x20888(%rip), %xmm1    # 0x763e4
subss %xmm1, %xmm0
callq 0x18b20
movss %xmm0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0x1c(%rbp)
movss -0x18(%rbp), %xmm0
movss 0x1a34b(%rip), %xmm1    # 0x6fef0
ucomiss %xmm1, %xmm0
jbe 0x55bb4
xorps %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
jmp 0x55be0
movss 0x2068c(%rip), %xmm0    # 0x76248
ucomiss -0x18(%rbp), %xmm0
jbe 0x55bd1
movss 0x2081a(%rip), %xmm0    # 0x763e4
movss %xmm0, -0x24(%rbp)
jmp 0x55bde
movss 0x1cfaf(%rip), %xmm0    # 0x72b88
movss %xmm0, -0x24(%rbp)
jmp 0x55be0
movss 0x20660(%rip), %xmm0    # 0x76248
ucomiss -0x1c(%rbp), %xmm0
jbe 0x55bfd
movss 0x2051a(%rip), %xmm0    # 0x76110
movss %xmm0, -0x20(%rbp)
jmp 0x55c2d
movss -0x1c(%rbp), %xmm0
movss 0x1a2e6(%rip), %xmm1    # 0x6fef0
ucomiss %xmm1, %xmm0
jbe 0x55c1e
movss 0x1b80d(%rip), %xmm0    # 0x71424
movss %xmm0, -0x20(%rbp)
jmp 0x55c2b
movss 0x1cf62(%rip), %xmm0    # 0x72b88
movss %xmm0, -0x20(%rbp)
jmp 0x55c2d
movss -0x24(%rbp), %xmm0
movss 0x1cf4e(%rip), %xmm1    # 0x72b88
ucomiss %xmm1, %xmm0
jne 0x55c46
jp 0x55c46
jmp 0x55cfe
movss -0x20(%rbp), %xmm0
movss 0x1cf35(%rip), %xmm1    # 0x72b88
ucomiss %xmm1, %xmm0
jne 0x55c5f
jp 0x55c5f
jmp 0x55cfe
movss -0x24(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x55ca0
jp 0x55ca0
movss -0x20(%rbp), %xmm0
movss 0x1b7a9(%rip), %xmm1    # 0x71424
movl $0x13b, %eax            # imm = 0x13B
movl $0x2d, %ecx
ucomiss %xmm1, %xmm0
setnp %sil
sete %dl
testb %sil, %dl
cmovnel %ecx, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0x55cd0
movss -0x20(%rbp), %xmm0
movss 0x1b777(%rip), %xmm1    # 0x71424
movl $0xd7, %eax
movl $0x87, %ecx
ucomiss %xmm1, %xmm0
setnp %sil
sete %dl
testb %sil, %dl
cmovnel %ecx, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x2c(%rbp)
movss -0x2c(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jne 0x55cdf
jp 0x55cdf
jmp 0x55cfc
movq -0x8(%rbp), %rdi
movss -0x2c(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0x18220
cmpl $0x0, %eax
je 0x55cfc
jmp 0x55f26
jmp 0x55cfe
callq 0x19c80
andl $0x3, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x55d33
movss -0x1c(%rbp), %xmm0
movaps 0x1a216(%rip), %xmm1    # 0x6ff30
pand %xmm1, %xmm0
movss -0x18(%rbp), %xmm1
movaps 0x1a206(%rip), %xmm2    # 0x6ff30
pand %xmm2, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x55d51
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x2c(%rbp), %xmm0
movss %xmm0, -0x20(%rbp)
movss -0x24(%rbp), %xmm0
movss 0x1ce2a(%rip), %xmm1    # 0x72b88
ucomiss %xmm1, %xmm0
jne 0x55d67
jp 0x55d67
jmp 0x55d93
movss -0x24(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jne 0x55d76
jp 0x55d76
jmp 0x55d93
movq -0x8(%rbp), %rdi
movss -0x24(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0x18220
cmpl $0x0, %eax
je 0x55d93
jmp 0x55f26
movss -0x20(%rbp), %xmm0
movss 0x1cde8(%rip), %xmm1    # 0x72b88
ucomiss %xmm1, %xmm0
jne 0x55da9
jp 0x55da9
jmp 0x55dd5
movss -0x20(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jne 0x55db8
jp 0x55db8
jmp 0x55dd5
movq -0x8(%rbp), %rdi
movss -0x20(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0x18220
cmpl $0x0, %eax
je 0x55dd5
jmp 0x55f26
movss -0x30(%rbp), %xmm0
movss 0x1cda6(%rip), %xmm1    # 0x72b88
ucomiss %xmm1, %xmm0
jne 0x55deb
jp 0x55deb
jmp 0x55e08
movq -0x8(%rbp), %rdi
movss -0x30(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0x18220
cmpl $0x0, %eax
je 0x55e08
jmp 0x55f26
callq 0x19c80
andl $0x1, %eax
cmpl $0x0, %eax
je 0x55e6f
xorps %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
movss 0x205c7(%rip), %xmm0    # 0x763ec
ucomiss -0x2c(%rbp), %xmm0
jb 0x55e6d
movss -0x2c(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jne 0x55e3a
jp 0x55e3a
jmp 0x55e57
movq -0x8(%rbp), %rdi
movss -0x2c(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0x18220
cmpl $0x0, %eax
je 0x55e57
jmp 0x55f26
jmp 0x55e59
movss 0x20587(%rip), %xmm0    # 0x763e8
addss -0x2c(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0x55e1d
jmp 0x55ece
movss 0x20575(%rip), %xmm0    # 0x763ec
movss %xmm0, -0x2c(%rbp)
movss -0x2c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x55ecc
movss -0x2c(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jne 0x55e98
jp 0x55e98
jmp 0x55eb2
movq -0x8(%rbp), %rdi
movss -0x2c(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0x18220
cmpl $0x0, %eax
je 0x55eb2
jmp 0x55f26
jmp 0x55eb4
movss -0x2c(%rbp), %xmm0
movss 0x20527(%rip), %xmm1    # 0x763e8
subss %xmm1, %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0x55e7c
jmp 0x55ece
movss -0x34(%rbp), %xmm0
movss 0x1ccad(%rip), %xmm1    # 0x72b88
ucomiss %xmm1, %xmm0
jne 0x55ee4
jp 0x55ee4
jmp 0x55efe
movq -0x8(%rbp), %rdi
movss -0x34(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0x18220
cmpl $0x0, %eax
je 0x55efe
jmp 0x55f26
movss -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1fc(%rax)
movq -0x8(%rbp), %rdi
callq 0x19300
cmpl $0x0, %eax
jne 0x55f26
movq -0x8(%rbp), %rdi
callq 0x193b0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)