// File: /workspace/github_c_makefile_star2_O1/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 0x51856
movss 0xc(%rdx), %xmm0
movss (%rdi,%rcx,4), %xmm1
movl $0x1, %eax
ucomiss %xmm0, %xmm1
jae 0x51954
xorl %eax, %eax
ucomiss (%rsi,%rcx,4), %xmm0
adcl $0x2, %eax
jmp 0x51954
movzbl 0x11(%rdx), %eax
cmpq $0x7, %rax
ja 0x51975
leaq 0xa4a5(%rip), %rcx      # 0x5bd10
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rsi, %rax
movq %rsi, %r9
movq %rsi, %rcx
movq %rdi, %r8
jmp 0x518c9
movq %rsi, %rax
movq %rsi, %r9
movq %rdi, %rcx
movq %rdi, %r8
jmp 0x518da
movq %rsi, %rax
movq %rdi, %r9
movq %rsi, %rcx
movq %rdi, %r8
jmp 0x518aa
movq %rdi, %rax
movq %rdi, %r9
movq %rsi, %rcx
movq %rsi, %r8
movq %rsi, %r10
jmp 0x518f1
movq %rdi, %rax
movq %rdi, %r9
movq %rdi, %rcx
movq %rsi, %r8
jmp 0x518eb
movq %rdi, %rax
movq %rsi, %r9
movq %rsi, %rcx
movq %rsi, %r8
movq %rdi, %r10
jmp 0x518f1
movq %rdi, %rax
movq %rsi, %r9
movq %rdi, %rcx
movq %rsi, %r8
movq %rdi, %r10
jmp 0x518ee
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 0x51956
popq %rcx
retq
leaq 0xa416(%rip), %rdi      # 0x5bd73
leaq 0xa3cc(%rip), %rsi      # 0x5bd30
leaq 0xa3d0(%rip), %rcx      # 0x5bd3b
movl $0x16d, %edx            # imm = 0x16D
callq 0x187d0
leaq 0xa400(%rip), %rdi      # 0x5bd7c
leaq 0xa3ad(%rip), %rsi      # 0x5bd30
leaq 0xa3b1(%rip), %rcx      # 0x5bd3b
movl $0x163, %edx            # imm = 0x163
callq 0x187d0