// File: /workspace/github_c_makefile_star2_O2/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 0x4c607
movss 0xc(%rdx), %xmm0
movss (%rdi,%rcx,4), %xmm1
ucomiss %xmm0, %xmm1
jae 0x4c633
xorl %eax, %eax
ucomiss (%rsi,%rcx,4), %xmm0
adcl $0x2, %eax
jmp 0x4c70d
movzbl 0x11(%rdx), %eax
cmpq $0x7, %rax
ja 0x4c72e
leaq 0xaa24(%rip), %rcx      # 0x57040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rsi, %rax
movq %rsi, %r9
movq %rsi, %rcx
movq %rdi, %r8
jmp 0x4c682
pushq $0x1
popq %rax
jmp 0x4c70d
movq %rsi, %rax
movq %rsi, %r9
movq %rdi, %rcx
movq %rdi, %r8
jmp 0x4c693
movq %rsi, %rax
movq %rdi, %r9
movq %rsi, %rcx
movq %rdi, %r8
jmp 0x4c663
movq %rdi, %rax
movq %rdi, %r9
movq %rsi, %rcx
movq %rsi, %r8
movq %rsi, %r10
jmp 0x4c6aa
movq %rdi, %rax
movq %rdi, %r9
movq %rdi, %rcx
movq %rsi, %r8
jmp 0x4c6a4
movq %rdi, %rax
movq %rsi, %r9
movq %rsi, %rcx
movq %rsi, %r8
movq %rdi, %r10
jmp 0x4c6aa
movq %rdi, %rax
movq %rsi, %r9
movq %rdi, %rcx
movq %rsi, %r8
movq %rdi, %r10
jmp 0x4c6a7
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 0x4c70f
popq %rcx
retq
leaq 0xa98d(%rip), %rdi      # 0x570a3
leaq 0xa943(%rip), %rsi      # 0x57060
leaq 0xa947(%rip), %rcx      # 0x5706b
movl $0x16d, %edx            # imm = 0x16D
callq 0x18830
leaq 0xa977(%rip), %rdi      # 0x570ac
leaq 0xa924(%rip), %rsi      # 0x57060
leaq 0xa928(%rip), %rcx      # 0x5706b
movl $0x163, %edx            # imm = 0x163
callq 0x18830