// File: /workspace/github_c_makefile_star2_O3/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 $0xc8, %rsp
movq %rdi, %rbx
movss 0xc(%rdi), %xmm2
addss 0xd4(%rdi), %xmm2
movsd 0x4(%rdi), %xmm0
movsd 0xcc(%rdi), %xmm3
addps %xmm0, %xmm3
movaps %xmm3, %xmm1
shufps $0x55, %xmm3, %xmm1     # xmm1 = xmm1[1,1],xmm3[1,1]
movaps %xmm1, 0x70(%rsp)
movsd 0xd8(%rdi), %xmm1
addps %xmm0, %xmm1
movaps %xmm1, %xmm0
shufps $0x55, %xmm1, %xmm0     # xmm0 = xmm0[1,1],xmm1[1,1]
movaps %xmm0, 0x60(%rsp)
movss 0x148ac(%rip), %xmm0    # 0x55c54
movss %xmm2, 0x1c(%rsp)
addss %xmm2, %xmm0
leaq 0x20(%rsp), %r14
movss %xmm0, 0x8(%r14)
movaps %xmm3, 0x50(%rsp)
movaps %xmm3, %xmm0
movb $0x1, %r15b
movq 0x27231(%rip), %rbp     # 0x68600
movaps %xmm1, 0x40(%rsp)
movss %xmm3, 0x18(%rsp)
movss %xmm0, 0x14(%rsp)
testb $0x1, %r15b
jne 0x413ec
movss %xmm1, 0x14(%rsp)
movb $0x1, %r12b
movss 0x14(%rsp), %xmm0
movss %xmm0, 0x20(%rsp)
movaps 0x70(%rsp), %xmm0
testb $0x1, %r12b
jne 0x4140b
movaps 0x60(%rsp), %xmm0
movss %xmm0, 0x24(%rsp)
movq %r14, %rdi
callq *0x68(%rbp)
cmpl $0x1, %eax
jne 0x41444
testb $0x1, %r12b
movl $0x0, %r12d
movaps 0x40(%rsp), %xmm1
jne 0x413ef
testb $0x1, %r15b
movl $0x0, %r15d
movss 0x18(%rsp), %xmm0
jne 0x413da
jmp 0x415af
movq 0x27045(%rip), %rax     # 0x68490
incl (%rax)
leaq 0x20(%rsp), %rsi
movss 0x1c(%rsp), %xmm0
movss %xmm0, 0x8(%rsi)
movaps 0x50(%rsp), %xmm1
addps 0x40(%rsp), %xmm1
mulps 0x14802(%rip), %xmm1    # 0x55c70
leaq 0x30(%rsp), %r8
movlps %xmm1, (%r8)
movlps %xmm1, (%rsi)
addss 0x182b6(%rip), %xmm0    # 0x59738
movss %xmm0, 0x8(%r8)
movl $0x2020003, (%rsp)      # imm = 0x2020003
movq 0x272d2(%rip), %rcx     # 0x68768
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %rcx, %rdx
movq %rbx, %r9
callq *0x60(%rbp)
movss 0x8(%r14), %xmm0
xorl %eax, %eax
ucomiss 0x11a6f(%rip), %xmm0    # 0x52f28
jne 0x414c1
jnp 0x415c1
leaq 0x80(%rsp), %rax
movss 0x14(%rax), %xmm0
movss %xmm0, 0x1c(%rsp)
movb $0x1, %al
movq 0x2728b(%rip), %r15     # 0x68768
leaq 0x20(%rsp), %r12
leaq 0x30(%rsp), %r13
movaps 0x40(%rsp), %xmm0
movss 0x18(%rsp), %xmm1
movss %xmm1, 0x14(%rsp)
movl %eax, 0x50(%rsp)
testb $0x1, %al
jne 0x41506
movss %xmm0, 0x14(%rsp)
movb $0x1, %r14b
movss 0x14(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
movss %xmm0, 0x20(%rsp)
movaps 0x70(%rsp), %xmm0
testb $0x1, %r14b
jne 0x4152b
movaps 0x60(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movss %xmm0, 0x24(%rsp)
movl $0x2020003, (%rsp)      # imm = 0x2020003
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r15, %rcx
movq %r13, %r8
movq %rbx, %r9
callq *0x60(%rbp)
movss 0x88(%rsp), %xmm0
ucomiss 0x119c0(%rip), %xmm0    # 0x52f28
jne 0x4156c
jnp 0x415bf
movss 0x1c(%rsp), %xmm0
subss 0x94(%rsp), %xmm0
ucomiss 0x181ba(%rip), %xmm0    # 0x5973c
movaps 0x40(%rsp), %xmm0
ja 0x415bf
testb $0x1, %r14b
movl $0x0, %r14d
jne 0x41509
testb $0x1, 0x50(%rsp)
movl $0x0, %eax
movss 0x18(%rsp), %xmm1
jne 0x414f2
movq 0x270da(%rip), %rax     # 0x68690
incl (%rax)
movl $0x1, %eax
jmp 0x415c1
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq