// File: /workspace/github_cpp_makefile_star2_O1/mitchellsayer[P]FastPointCloudSegmentation/src/./nanoflann.hpp
// Function: nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<float, ScanlinePointCloud, float>, ScanlinePointCloud, 3, unsigned long>::middleSplit_(unsigned long*, unsigned long, unsigned long&, int&, float&, nanoflann::CArray<nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<float, ScanlinePointCloud, float>, ScanlinePointCloud, 3, unsigned long>::Interval, 3ul> const&)
void middleSplit_(IndexType* ind, IndexType count, IndexType& index, int& cutfeat, DistanceType& cutval, const BoundingBox& bbox)
		{
			const DistanceType EPS=static_cast<DistanceType>(0.00001);
			ElementType max_span = bbox[0].high-bbox[0].low;
			for (int i=1; i<(DIM>0 ? DIM : dim); ++i) {
				ElementType span = bbox[i].high-bbox[i].low;
				if (span>max_span) {
					max_span = span;
				}
			}
			ElementType max_spread = -1;
			cutfeat = 0;
			for (int i=0; i<(DIM>0 ? DIM : dim); ++i) {
				ElementType span = bbox[i].high-bbox[i].low;
				if (span>(1-EPS)*max_span) {
					ElementType min_elem, max_elem;
					computeMinMax(ind, count, i, min_elem, max_elem);
					ElementType spread = max_elem-min_elem;;
					if (spread>max_spread) {
						cutfeat = i;
						max_spread = spread;
					}
				}
			}
			// split in the middle
			DistanceType split_val = (bbox[cutfeat].low+bbox[cutfeat].high)/2;
			ElementType min_elem, max_elem;
			computeMinMax(ind, count, cutfeat, min_elem, max_elem);

			if (split_val<min_elem) cutval = min_elem;
			else if (split_val>max_elem) cutval = max_elem;
			else cutval = split_val;

			IndexType lim1, lim2;
			planeSplit(ind, count, cutfeat, cutval, lim1, lim2);

			if (lim1>count/2) index = lim1;
			else if (lim2<count/2) index = lim2;
			else index = count/2;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, -0x58(%rbp)
movq %r8, -0x38(%rbp)
movq %rcx, -0x60(%rbp)
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r13
movq 0x10(%rbp), %rbx
movss 0x4(%rbx), %xmm1
subss (%rbx), %xmm1
xorl %eax, %eax
movaps %xmm1, %xmm0
movss 0xc(%rbx,%rax,8), %xmm1
subss 0x8(%rbx,%rax,8), %xmm1
maxss %xmm0, %xmm1
incq %rax
cmpq $0x2, %rax
jne 0x7231
movq -0x38(%rbp), %rax
movl $0x0, (%rax)
mulss 0xe3d(%rip), %xmm1      # 0x809c
movss 0xe39(%rip), %xmm0      # 0x80a0
movss %xmm0, -0x2c(%rbp)
xorl %r15d, %r15d
movss %xmm1, -0x44(%rbp)
movss 0x4(%rbx,%r15,8), %xmm0
subss (%rbx,%r15,8), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x72c0
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %r15d, %ecx
leaq -0x50(%rbp), %r8
leaq -0x40(%rbp), %r9
callq 0x7402
movss -0x40(%rbp), %xmm0
subss -0x50(%rbp), %xmm0
ucomiss -0x2c(%rbp), %xmm0
jbe 0x72bb
movq -0x38(%rbp), %rax
movl %r15d, (%rax)
movss %xmm0, -0x2c(%rbp)
movss -0x44(%rbp), %xmm1
incq %r15
cmpq $0x3, %r15
jne 0x7274
movq -0x38(%rbp), %rax
movslq (%rax), %rcx
movss (%rbx,%rcx,8), %xmm0
addss 0x4(%rbx,%rcx,8), %xmm0
mulss 0xdc1(%rip), %xmm0      # 0x80a4
movss %xmm0, -0x2c(%rbp)
leaq -0x64(%rbp), %rbx
leaq -0x48(%rbp), %r9
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %r8
callq 0x7402
movss -0x2c(%rbp), %xmm1
movss (%rbx), %xmm0
ucomiss %xmm1, %xmm0
ja 0x7318
movss -0x48(%rbp), %xmm0
minss %xmm1, %xmm0
movq -0x58(%rbp), %r8
movss %xmm0, (%r8)
movq -0x38(%rbp), %rax
movl (%rax), %ecx
leaq -0x40(%rbp), %rax
movq %rax, (%rsp)
leaq -0x50(%rbp), %rbx
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %r9
callq 0x74e2
movq (%rbx), %rax
shrq %r14
movq -0x40(%rbp), %rcx
cmpq %r14, %rcx
cmovaeq %r14, %rcx
cmpq %r14, %rax
cmovaq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq