// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/m_move.c
// Function: M_CheckBottom
qboolean M_CheckBottom (edict_t *ent)
{
	vec3_t	mins, maxs, start, stop;
	trace_t	trace;
	int		x, y;
	float	mid, bottom;
	
	VectorAdd (ent->s.origin, ent->mins, mins);
	VectorAdd (ent->s.origin, ent->maxs, maxs);

// if all of the points under the corners are solid world, don't bother
// with the tougher checks
// the corners must be within 16 of the midpoint
	start[2] = mins[2] - 1;
	for	(x=0 ; x<=1 ; x++)
		for	(y=0 ; y<=1 ; y++)
		{
			start[0] = x ? maxs[0] : mins[0];
			start[1] = y ? maxs[1] : mins[1];
			if (gi.pointcontents (start) != CONTENTS_SOLID)
				goto realcheck;
		}

	c_yes++;
	return true;		// we got out easy

realcheck:
	c_no++;
//
// check it for real...
//
	start[2] = mins[2];
	
// the midpoint must be within 16 of the bottom
	start[0] = stop[0] = (mins[0] + maxs[0])*0.5f;
	start[1] = stop[1] = (mins[1] + maxs[1])*0.5f;
	stop[2] = start[2] - 2*STEPSIZE;
	trace = gi.trace (start, vec3_origin, vec3_origin, stop, ent, MASK_MONSTERSOLID);

	if (trace.fraction == 1.0)
		return false;
	mid = bottom = trace.endpos[2];
	
// the corners must be within 16 of the midpoint	
	for	(x=0 ; x<=1 ; x++)
		for	(y=0 ; y<=1 ; y++)
		{
			start[0] = stop[0] = x ? maxs[0] : mins[0];
			start[1] = stop[1] = y ? maxs[1] : mins[1];
			
			trace = gi.trace (start, vec3_origin, vec3_origin, stop, ent, MASK_MONSTERSOLID);
			
			if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
				bottom = trace.endpos[2];
			if (trace.fraction == 1.0 || mid - trace.endpos[2] > STEPSIZE)
				return false;
		}

	c_yes++;
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
movss 0x4(%rdi), %xmm0
movss 0x8(%rdi), %xmm1
movss 0xcc(%rdi), %xmm2
addss %xmm0, %xmm2
movss 0xd0(%rdi), %xmm3
addss %xmm1, %xmm3
movss %xmm3, 0x1c(%rsp)
movss 0xc(%rdi), %xmm3
addss 0xd4(%rdi), %xmm3
addss 0xd8(%rdi), %xmm0
movss %xmm0, 0x10(%rsp)
addss 0xdc(%rdi), %xmm1
movss %xmm1, 0x18(%rsp)
movss 0x14f43(%rip), %xmm0    # 0x56c00
movss %xmm3, 0x14(%rsp)
addss %xmm3, %xmm0
leaq 0x20(%rsp), %r14
movss %xmm0, 0x8(%r14)
xorl %r15d, %r15d
movq 0x27924(%rip), %rbp     # 0x69600
movss %xmm2, 0xc(%rsp)
movss %xmm2, 0x8(%rsp)
testl %r15d, %r15d
je 0x41cf9
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x8(%rsp)
movl $0x1, %r12d
movss 0x8(%rsp), %xmm0
movss %xmm0, 0x20(%rsp)
movss 0x1c(%rsp), %xmm0
cmpl $0x1, %r12d
je 0x41d1d
movss 0x18(%rsp), %xmm0
movss %xmm0, 0x24(%rsp)
movq %r14, %rdi
callq *0x68(%rbp)
cmpl $0x1, %eax
jne 0x41d4a
decl %r12d
movss 0xc(%rsp), %xmm2
je 0x41cff
leal 0x1(%r15), %eax
testl %r15d, %r15d
movl %eax, %r15d
je 0x41ce2
jmp 0x41edd
movq 0x2773f(%rip), %rax     # 0x69490
incl (%rax)
leaq 0x20(%rsp), %rsi
movss 0x14(%rsp), %xmm2
movss %xmm2, 0x8(%rsi)
movss 0xc(%rsp), %xmm0
addss 0x10(%rsp), %xmm0
movss 0x1368d(%rip), %xmm1    # 0x55404
mulss %xmm1, %xmm0
leaq 0x2c(%rsp), %r8
movss %xmm0, (%r8)
movss %xmm0, (%rsi)
movss 0x1c(%rsp), %xmm0
addss 0x18(%rsp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x4(%r8)
movss %xmm0, 0x4(%rsi)
addss 0x18744(%rip), %xmm2    # 0x5a4f0
movss %xmm2, 0x8(%r8)
movl $0x2020003, (%rsp)      # imm = 0x2020003
movq 0x279a8(%rip), %rcx     # 0x69768
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rcx, %rdx
movq %rbx, %r9
callq *0x60(%rbp)
movss 0xc(%rsp), %xmm1
movss 0x8(%r14), %xmm0
xorl %eax, %eax
ucomiss 0x12142(%rip), %xmm0    # 0x53f28
jne 0x41dfc
jp 0x41dfc
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x40(%rsp), %rax
movss 0x14(%rax), %xmm0
movss %xmm0, 0x14(%rsp)
xorl %eax, %eax
movq 0x27953(%rip), %r15     # 0x69768
leaq 0x20(%rsp), %r12
leaq 0x2c(%rsp), %r13
movss %xmm1, 0x8(%rsp)
movq %rax, 0x38(%rsp)
testl %eax, %eax
je 0x41e3a
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x8(%rsp)
movl $0x1, %r14d
movss 0x8(%rsp), %xmm0
movss %xmm0, 0x2c(%rsp)
movss %xmm0, 0x20(%rsp)
movss 0x1c(%rsp), %xmm0
cmpl $0x1, %r14d
je 0x41e64
movss 0x18(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
movss %xmm0, 0x24(%rsp)
movl $0x2020003, (%rsp)      # imm = 0x2020003
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r15, %rcx
movq %r13, %r8
movq %rbx, %r9
callq *0x60(%rbp)
movss 0x48(%rsp), %xmm0
xorl %eax, %eax
ucomiss 0x1208b(%rip), %xmm0    # 0x53f28
jne 0x41ea5
jnp 0x41dea
movss 0x14(%rsp), %xmm0
subss 0x54(%rsp), %xmm0
ucomiss 0x1863c(%rip), %xmm0    # 0x5a4f4
movss 0xc(%rsp), %xmm1
ja 0x41dea
decl %r14d
je 0x41e40
movq 0x38(%rsp), %rcx
leal 0x1(%rcx), %eax
testl %ecx, %ecx
je 0x41e1f
movq 0x277ac(%rip), %rax     # 0x69690
incl (%rax)
movl $0x1, %eax
jmp 0x41dea