// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/m_move.c
// Function: SV_movestep
qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
{
	float		dz;
	vec3_t		oldorg, neworg, end;
	trace_t		trace;
	int			i;
	float		stepsize;
	vec3_t		test;
	int			contents;

// try the move	
	VectorCopy (ent->s.origin, oldorg);
	VectorAdd (ent->s.origin, move, neworg);

// flying monsters don't step up
	if ( ent->flags & (FL_SWIM | FL_FLY) )
	{
	// try one move with vertical motion, then one without
		for (i=0 ; i<2 ; i++)
		{
			VectorAdd (ent->s.origin, move, neworg);
			if (i == 0 && ent->enemy)
			{
				if (!ent->goalentity)
					ent->goalentity = ent->enemy;
				dz = ent->s.origin[2] - ent->goalentity->s.origin[2];
				if (ent->goalentity->client)
				{
					if (dz > 40)
						neworg[2] -= 8;
					if (!((ent->flags & FL_SWIM) && (ent->waterlevel < 2)))
						if (dz < 30)
							neworg[2] += 8;
				}
				else
				{
					if (dz > 8)
						neworg[2] -= 8;
					else if (dz > 0)
						neworg[2] -= dz;
					else if (dz < -8)
						neworg[2] += 8;
					else
						neworg[2] += dz;
				}
			}
			trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, neworg, ent, MASK_MONSTERSOLID);
	
			// fly monsters don't enter water voluntarily
			if (ent->flags & FL_FLY)
			{
				if (!ent->waterlevel)
				{
					test[0] = trace.endpos[0];
					test[1] = trace.endpos[1];
					test[2] = trace.endpos[2] + ent->mins[2] + 1;
					contents = gi.pointcontents(test);
					if (contents & MASK_WATER)
						return false;
				}
			}

			// swim monsters don't exit water voluntarily
			if (ent->flags & FL_SWIM)
			{
				if (ent->waterlevel < 2)
				{
					test[0] = trace.endpos[0];
					test[1] = trace.endpos[1];
					test[2] = trace.endpos[2] + ent->mins[2] + 1;
					contents = gi.pointcontents(test);
					if (!(contents & MASK_WATER))
						return false;
				}
			}

			if (trace.fraction == 1)
			{
				VectorCopy (trace.endpos, ent->s.origin);
				if (relink)
				{
					gi.linkentity (ent);
					G_TouchTriggers (ent);
				}
				return true;
			}
			
			if (!ent->enemy)
				break;
		}
		
		return false;
	}

// push down from a step height above the wished position
	if (!(ent->monsterinfo.aiflags & AI_NOSTEP))
		stepsize = STEPSIZE;
	else
		stepsize = 1;

	neworg[2] += stepsize;
	VectorCopy (neworg, end);
	end[2] -= stepsize*2;

	trace = gi.trace (neworg, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID);

	if (trace.allsolid)
		return false;

	if (trace.startsolid)
	{
		neworg[2] -= stepsize;
		trace = gi.trace (neworg, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID);
		if (trace.allsolid || trace.startsolid)
			return false;
	}


	// don't go in to water
	if (ent->waterlevel == 0)
	{
		test[0] = trace.endpos[0];
		test[1] = trace.endpos[1];
		test[2] = trace.endpos[2] + ent->mins[2] + 1;	
		contents = gi.pointcontents(test);

		if (contents & MASK_WATER)
			return false;
	}

	if (trace.fraction == 1)
	{
	// if monster had the ground pulled out, go ahead and fall
		if ( ent->flags & FL_PARTIALGROUND )
		{
			VectorAdd (ent->s.origin, move, ent->s.origin);
			if (relink)
			{
				gi.linkentity (ent);
				G_TouchTriggers (ent);
			}
			ent->groundentity = NULL;
			return true;
		}
	
		return false;		// walked off an edge
	}

// check point traces down for dangling corners
	VectorCopy (trace.endpos, ent->s.origin);
	
	if (!M_CheckBottom (ent))
	{
		if ( ent->flags & FL_PARTIALGROUND )
		{	// entity had floor mostly pulled out from underneath it
			// and is trying to correct
			if (relink)
			{
				gi.linkentity (ent);
				G_TouchTriggers (ent);
			}
			return true;
		}
		VectorCopy (oldorg, ent->s.origin);
		return false;
	}

	if ( ent->flags & FL_PARTIALGROUND )
	{
		ent->flags &= ~FL_PARTIALGROUND;
	}
	ent->groundentity = trace.ent;
	ent->groundentity_linkcount = trace.ent->linkcount;

// the move is ok
	if (relink)
	{
		gi.linkentity (ent);
		G_TouchTriggers (ent);
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %edx, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movss 0x4(%rdi), %xmm3
movss 0x8(%rdi), %xmm4
movss 0xc(%rdi), %xmm5
movss (%rsi), %xmm0
addss %xmm3, %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x4(%rsi), %xmm2
addss %xmm4, %xmm2
movss %xmm2, 0x20(%rsp)
movss 0x8(%rsi), %xmm1
addss %xmm5, %xmm1
movss %xmm1, 0x24(%rsp)
testb $0x3, 0x11c(%rdi)
je 0x421d9
leaq 0x4(%rbx), %rax
movq %rax, 0x28(%rsp)
leaq 0xcc(%rbx), %rax
movq %rax, 0x40(%rsp)
leaq 0xd8(%rbx), %r13
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
movss 0x4(%rbx), %xmm0
addss (%r14), %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x8(%rbx), %xmm0
addss 0x4(%r14), %xmm0
movss %xmm0, 0x20(%rsp)
movss 0xc(%rbx), %xmm1
movss 0x8(%r14), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x24(%rsp)
subl $0x1, %r12d
jae 0x4206a
movq 0x2a0(%rbx), %rax
testq %rax, %rax
je 0x4206a
cmpq $0x0, 0x1e8(%rbx)
jne 0x41fd8
movq %rax, 0x1e8(%rbx)
movq 0x1e8(%rbx), %rax
subss 0xc(%rax), %xmm1
cmpq $0x0, 0x58(%rax)
je 0x42031
ucomiss 0x18506(%rip), %xmm1    # 0x5a4f8
jbe 0x42002
addss 0x13410(%rip), %xmm0    # 0x5540c
movss %xmm0, 0x24(%rsp)
testb $0x2, 0x11c(%rbx)
je 0x42014
cmpl $0x2, 0x30c(%rbx)
jl 0x4206a
movss 0x12278(%rip), %xmm0    # 0x54294
ucomiss %xmm1, %xmm0
jbe 0x4206a
movss 0x24(%rsp), %xmm0
addss 0x11ec9(%rip), %xmm0    # 0x53ef8
jmp 0x42064
ucomiss 0x11ec0(%rip), %xmm1    # 0x53ef8
jbe 0x42044
addss 0x133ca(%rip), %xmm0    # 0x5540c
jmp 0x42064
ucomiss 0x12915(%rip), %xmm1    # 0x54960
jbe 0x42053
subss %xmm1, %xmm0
jmp 0x42064
movss 0x133b1(%rip), %xmm2    # 0x5540c
ucomiss %xmm1, %xmm2
ja 0x42027
addss %xmm1, %xmm0
movss %xmm0, 0x24(%rsp)
movl $0x2020003, (%rsp)      # imm = 0x2020003
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r13, %rcx
leaq 0x1c(%rsp), %r8
movq %rbx, %r9
movq 0x2756e(%rip), %rax     # 0x69600
callq *0x60(%rax)
movss 0x58(%rsp), %xmm3
movss 0x5c(%rsp), %xmm0
movss 0x60(%rsp), %xmm1
movss 0x64(%rsp), %xmm2
testb $0x1, 0x11c(%rbx)
je 0x4212c
cmpl $0x0, 0x30c(%rbx)
jne 0x4212c
movss %xmm0, 0x34(%rsp)
movss %xmm1, 0x38(%rsp)
movss %xmm0, 0x14(%rsp)
movss 0xd4(%rbx), %xmm0
addss %xmm2, %xmm0
addss 0x11e43(%rip), %xmm0    # 0x53f28
movss %xmm0, 0x3c(%rsp)
leaq 0x34(%rsp), %rdi
movq 0x27509(%rip), %rax     # 0x69600
movss %xmm1, 0x10(%rsp)
movss %xmm2, 0xc(%rsp)
movss %xmm3, 0x8(%rsp)
callq *0x68(%rax)
movss 0x8(%rsp), %xmm3
movss 0xc(%rsp), %xmm2
movss 0x10(%rsp), %xmm1
movss 0x14(%rsp), %xmm0
testb $0x38, %al
jne 0x4232b
testb $0x2, 0x11c(%rbx)
je 0x421ab
cmpl $0x1, 0x30c(%rbx)
jg 0x421ab
movss %xmm0, 0x34(%rsp)
movss %xmm1, 0x38(%rsp)
movss %xmm0, 0x14(%rsp)
movss 0xd4(%rbx), %xmm0
addss %xmm2, %xmm0
addss 0x11dc4(%rip), %xmm0    # 0x53f28
movss %xmm0, 0x3c(%rsp)
leaq 0x34(%rsp), %rdi
movq 0x2748a(%rip), %rax     # 0x69600
movss %xmm1, 0x10(%rsp)
movss %xmm2, 0xc(%rsp)
movss %xmm3, 0x8(%rsp)
callq *0x68(%rax)
movss 0x8(%rsp), %xmm3
movss 0xc(%rsp), %xmm2
movss 0x10(%rsp), %xmm1
movss 0x14(%rsp), %xmm0
testb $0x38, %al
je 0x4232b
ucomiss 0x11d76(%rip), %xmm3    # 0x53f28
jne 0x421ba
jnp 0x422f6
cmpq $0x0, 0x2a0(%rbx)
je 0x4232d
testl %r15d, %r15d
movl %r12d, %r15d
je 0x41f77
jmp 0x4232d
movss %xmm5, 0x10(%rsp)
movss %xmm4, 0x14(%rsp)
movss %xmm3, 0x40(%rsp)
xorl %eax, %eax
btl $0xa, 0x3c0(%rbx)
setae %al
leaq 0x18319(%rip), %rcx     # 0x5a518
movss (%rcx,%rax,4), %xmm3
addss %xmm3, %xmm1
leaq 0x1c(%rsp), %rsi
movss %xmm1, 0x8(%rsi)
leaq 0x9c(%rsp), %r8
movss %xmm0, (%r8)
movss %xmm2, 0x4(%r8)
movss %xmm3, 0x28(%rsp)
movaps %xmm3, %xmm0
addss %xmm3, %xmm0
subss %xmm0, %xmm1
movss %xmm1, 0x8(%r8)
movq 0x273bd(%rip), %rax     # 0x69600
leaq 0xcc(%rbx), %r15
leaq 0xd8(%rbx), %r12
movl $0x2020003, (%rsp)      # imm = 0x2020003
leaq 0x50(%rsp), %r13
movq %r13, %rdi
movq %r15, %rdx
movq %r12, %rcx
movq %rbx, %r9
callq *0x60(%rax)
xorl %ebp, %ebp
cmpl $0x0, (%r13)
jne 0x4232d
movss 0x28(%rsp), %xmm1
movq 0x2737a(%rip), %rax     # 0x69600
cmpl $0x0, 0x54(%rsp)
je 0x42341
leaq 0x1c(%rsp), %rsi
movss 0x8(%rsi), %xmm0
subss %xmm1, %xmm0
movss %xmm0, 0x8(%rsi)
movl $0x2020003, (%rsp)      # imm = 0x2020003
leaq 0x50(%rsp), %r13
leaq 0x9c(%rsp), %r8
movq %r13, %rdi
movq %r15, %rdx
movq %r12, %rcx
movq %rbx, %r9
movq %rax, %r12
callq *0x60(%rax)
movl 0x4(%r13), %eax
orl (%r13), %eax
jne 0x4232d
movss 0x58(%rsp), %xmm3
movss 0x5c(%rsp), %xmm0
movss 0x60(%rsp), %xmm1
movss 0x64(%rsp), %xmm2
movq 0x90(%rsp), %r15
jmp 0x42364
movss %xmm0, 0x4(%rbx)
movss %xmm1, 0x8(%rbx)
movss %xmm2, 0xc(%rbx)
movl $0x1, %ebp
cmpl $0x0, 0x18(%rsp)
je 0x4232d
movq %rbx, %rdi
movq 0x272e5(%rip), %rax     # 0x69600
callq *0x90(%rax)
movq %rbx, %rdi
callq 0x19200
jmp 0x4232d
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movss 0x58(%rsp), %xmm3
movss 0x5c(%rsp), %xmm0
movss 0x60(%rsp), %xmm1
movss 0x64(%rsp), %xmm2
movq 0x90(%rsp), %r15
movq %rax, %r12
cmpl $0x0, 0x30c(%rbx)
je 0x423e7
ucomiss 0x11bb4(%rip), %xmm3    # 0x53f28
jne 0x42450
jp 0x42450
testb $0x1, 0x11d(%rbx)
je 0x4232d
movss 0x4(%rbx), %xmm0
movss 0x8(%rbx), %xmm1
addss (%r14), %xmm0
movss %xmm0, 0x4(%rbx)
addss 0x4(%r14), %xmm1
movss %xmm1, 0x8(%rbx)
movss 0xc(%rbx), %xmm0
addss 0x8(%r14), %xmm0
movss %xmm0, 0xc(%rbx)
cmpl $0x0, 0x18(%rsp)
je 0x423d2
movq %rbx, %rdi
callq *0x90(%r12)
movq %rbx, %rdi
callq 0x19200
movq $0x0, 0x2b8(%rbx)
movl $0x1, %ebp
jmp 0x4232d
leaq 0x34(%rsp), %rdi
movss %xmm0, (%rdi)
movss %xmm1, 0x4(%rdi)
movss %xmm0, 0x28(%rsp)
movss 0xd4(%rbx), %xmm0
addss %xmm2, %xmm0
addss 0x11b19(%rip), %xmm0    # 0x53f28
movss %xmm0, 0x8(%rdi)
movss %xmm1, 0xc(%rsp)
movss %xmm2, 0x8(%rsp)
movss %xmm3, 0x4c(%rsp)
callq *0x68(%r12)
movss 0x4c(%rsp), %xmm3
movss 0x8(%rsp), %xmm2
movss 0xc(%rsp), %xmm1
movss 0x28(%rsp), %xmm0
testb $0x38, %al
jne 0x4232d
jmp 0x4236d
movss %xmm0, 0x4(%rbx)
movss %xmm1, 0x8(%rbx)
movss %xmm2, 0xc(%rbx)
movq %rbx, %rdi
callq 0x19130
movl 0x11c(%rbx), %ecx
testl %eax, %eax
je 0x42496
btl $0x8, %ecx
jae 0x42483
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
movl %ecx, 0x11c(%rbx)
movq %r15, 0x2b8(%rbx)
movl 0x64(%r15), %eax
movl %eax, 0x2c0(%rbx)
jmp 0x424c2
btl $0x8, %ecx
jb 0x424c2
movss 0x40(%rsp), %xmm0
movss %xmm0, 0x4(%rbx)
movss 0x14(%rsp), %xmm0
movss %xmm0, 0x8(%rbx)
movss 0x10(%rsp), %xmm0
movss %xmm0, 0xc(%rbx)
jmp 0x4232d
movl $0x1, %ebp
cmpl $0x0, 0x18(%rsp)
je 0x4232d
movq %rbx, %rdi
callq *0x90(%r12)
jmp 0x42321