// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/q_shared.c
// Function: BoxOnPlaneSide
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
	float	dist1, dist2;
	int		sides;

// fast axial cases
	if (p->type < 3)
	{
		if (p->dist <= emins[p->type])
			return 1;
		if (p->dist >= emaxs[p->type])
			return 2;
		return 3;
	}
	
// general case
	switch (p->signbits)
	{
	case 0:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
		break;
	case 1:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
		break;
	case 2:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
		break;
	case 3:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
		break;
	case 4:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
		break;
	case 5:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
		break;
	case 6:
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
		break;
	case 7:
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
		break;
	default:
		dist1 = dist2 = 0;		// shut up compiler
		assert( 0 );
		break;
	}

	sides = 0;
	if (dist1 >= p->dist)
		sides = 1;
	if (dist2 < p->dist)
		sides |= 2;

	assert( sides != 0 );

	return sides;
}

// Assembly:
pushq %rax
movzbl 0x10(%rdx), %ecx
cmpq $0x2, %rcx
ja 0x50ac9
movss 0xc(%rdx), %xmm0
movss (%rdi,%rcx,4), %xmm1
movl $0x1, %eax
ucomiss %xmm0, %xmm1
jae 0x50bc7
xorl %eax, %eax
ucomiss (%rsi,%rcx,4), %xmm0
adcl $0x2, %eax
jmp 0x50bc7
movzbl 0x11(%rdx), %eax
cmpq $0x7, %rax
ja 0x50be8
leaq 0xa5a2(%rip), %rcx      # 0x5b080
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rsi, %rax
movq %rsi, %r9
movq %rsi, %rcx
movq %rdi, %r8
jmp 0x50b3c
movq %rsi, %rax
movq %rsi, %r9
movq %rdi, %rcx
movq %rdi, %r8
jmp 0x50b4d
movq %rsi, %rax
movq %rdi, %r9
movq %rsi, %rcx
movq %rdi, %r8
jmp 0x50b1d
movq %rdi, %rax
movq %rdi, %r9
movq %rsi, %rcx
movq %rsi, %r8
movq %rsi, %r10
jmp 0x50b64
movq %rdi, %rax
movq %rdi, %r9
movq %rdi, %rcx
movq %rsi, %r8
jmp 0x50b5e
movq %rdi, %rax
movq %rsi, %r9
movq %rsi, %rcx
movq %rsi, %r8
movq %rdi, %r10
jmp 0x50b64
movq %rdi, %rax
movq %rsi, %r9
movq %rdi, %rcx
movq %rsi, %r8
movq %rdi, %r10
jmp 0x50b61
movq %rsi, %rax
movq %rdi, %r9
movq %rdi, %rcx
movq %rdi, %r8
movq %rsi, %r10
movq %rsi, %rdi
movss (%rdx), %xmm0
movss 0x4(%rdx), %xmm1
movss 0x4(%r9), %xmm2
mulss %xmm1, %xmm2
movss (%rax), %xmm3
mulss %xmm0, %xmm3
addss %xmm2, %xmm3
movss 0x8(%rdx), %xmm2
movss 0x8(%rcx), %xmm4
mulss %xmm2, %xmm4
addss %xmm3, %xmm4
mulss 0x4(%r10), %xmm1
mulss (%r8), %xmm0
addss %xmm1, %xmm0
mulss 0x8(%rdi), %xmm2
addss %xmm0, %xmm2
movss 0xc(%rdx), %xmm0
xorl %ecx, %ecx
ucomiss %xmm0, %xmm4
setae %cl
leal 0x2(%rcx), %eax
ucomiss %xmm2, %xmm0
cmovbel %ecx, %eax
testl %eax, %eax
je 0x50bc9
popq %rcx
retq
leaq 0xa513(%rip), %rdi      # 0x5b0e3
leaq 0xa4c9(%rip), %rsi      # 0x5b0a0
leaq 0xa4cd(%rip), %rcx      # 0x5b0ab
movl $0x16d, %edx            # imm = 0x16D
callq 0x187d0
leaq 0xa4fd(%rip), %rdi      # 0x5b0ec
leaq 0xa4aa(%rip), %rsi      # 0x5b0a0
leaq 0xa4ae(%rip), %rcx      # 0x5b0ab
movl $0x163, %edx            # imm = 0x163
callq 0x187d0