// File: mitchellsayer[P]FastPointCloudSegmentation/src/./nanoflann.hpp
// Function: void nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<float, ScanlinePointCloud, float>, ScanlinePointCloud, 3, unsigned long>::searchLevel<nanoflann::KNNResultSet<float, unsigned long, unsigned long>>(nanoflann::KNNResultSet<float, unsigned long, unsigned long>&, float const*, nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<float, ScanlinePointCloud, float>, ScanlinePointCloud, 3, unsigned long>::Node*, float, nanoflann::CArray<float, 3ul>&, float) const
void searchLevel(RESULTSET& result_set, const ElementType* vec, const NodePtr node, DistanceType mindistsq,
						 distance_vector_t& dists, const float epsError) const
		{
			/* If this is a leaf node, then do check and return. */
			if ((node->child1 == NULL)&&(node->child2 == NULL)) {
				//count_leaf += (node->lr.right-node->lr.left);  // Removed since was neither used nor returned to the user.
				DistanceType worst_dist = result_set.worstDist();
				for (IndexType i=node->node_type.lr.left; i<node->node_type.lr.right; ++i) {
					const IndexType index = vind[i];// reorder... : i;
					DistanceType dist = distance(vec, index, (DIM>0 ? DIM : dim));
					if (dist<worst_dist) {
						result_set.addPoint(dist,vind[i]);
					}
				}
				return;
			}

			/* Which child branch should be taken first? */
			int idx = node->node_type.sub.divfeat;
			ElementType val = vec[idx];
			DistanceType diff1 = val - node->node_type.sub.divlow;
			DistanceType diff2 = val - node->node_type.sub.divhigh;

			NodePtr bestChild;
			NodePtr otherChild;
			DistanceType cut_dist;
			if ((diff1+diff2)<0) {
				bestChild = node->child1;
				otherChild = node->child2;
				cut_dist = distance.accum_dist(val, node->node_type.sub.divhigh, idx);
			}
			else {
				bestChild = node->child2;
				otherChild = node->child1;
				cut_dist = distance.accum_dist( val, node->node_type.sub.divlow, idx);
			}

			/* Call recursively to search next level down. */
			searchLevel(result_set, vec, bestChild, mindistsq, dists, epsError);

			DistanceType dst = dists[idx];
			mindistsq = mindistsq + cut_dist - dst;
			dists[idx] = cut_dist;
			if (mindistsq*epsError<=result_set.worstDist()) {
				searchLevel(result_set, vec, otherChild, mindistsq, dists, epsError);
			}
			dists[idx] = dst;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movss %xmm0, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movss %xmm1, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x116b3
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x116b3
movq -0x10(%rbp), %rdi
callq 0x118f0
movss %xmm0, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x116ae
movq -0x80(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x11910
movq -0x80(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x48(%rbp)
addq $0x90, %rdi
movq -0x18(%rbp), %rsi
movq -0x48(%rbp), %rdx
movl $0x3, %ecx
callq 0x11930
movss %xmm0, -0x4c(%rbp)
movss -0x4c(%rbp), %xmm1
movss -0x38(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x1169b
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movss -0x4c(%rbp), %xmm0
movss %xmm0, -0x84(%rbp)
movq -0x40(%rbp), %rsi
callq 0x11910
movq -0x90(%rbp), %rdi
movss -0x84(%rbp), %xmm0
movq (%rax), %rsi
callq 0x11970
jmp 0x1169d
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x11608
jmp 0x11868
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movslq -0x50(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x54(%rbp), %xmm0
movq -0x20(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x58(%rbp)
movss -0x54(%rbp), %xmm0
movq -0x20(%rbp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0x5c(%rbp)
movss -0x58(%rbp), %xmm1
addss -0x5c(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x11746
movq -0x80(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
addq $0x90, %rdi
movss -0x54(%rbp), %xmm0
movq -0x20(%rbp), %rax
movss 0x8(%rax), %xmm1
movl -0x50(%rbp), %esi
callq 0x118a0
movss %xmm0, -0x74(%rbp)
jmp 0x11784
movq -0x80(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
addq $0x90, %rdi
movss -0x54(%rbp), %xmm0
movq -0x20(%rbp), %rax
movss 0x4(%rax), %xmm1
movl -0x50(%rbp), %esi
callq 0x118a0
movss %xmm0, -0x74(%rbp)
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x68(%rbp), %rcx
movss -0x24(%rbp), %xmm0
movq -0x30(%rbp), %r8
movss -0x34(%rbp), %xmm1
callq 0x115a0
movq -0x30(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x118d0
movss (%rax), %xmm0
movss %xmm0, -0x78(%rbp)
movss -0x24(%rbp), %xmm0
addss -0x74(%rbp), %xmm0
subss -0x78(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x74(%rbp), %xmm0
movss %xmm0, -0x98(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x118d0
movss -0x98(%rbp), %xmm0
movss %xmm0, (%rax)
movss -0x24(%rbp), %xmm0
mulss -0x34(%rbp), %xmm0
movss %xmm0, -0x94(%rbp)
movq -0x10(%rbp), %rdi
callq 0x118f0
movss -0x94(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jb 0x11842
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x70(%rbp), %rcx
movss -0x24(%rbp), %xmm0
movq -0x30(%rbp), %r8
movss -0x34(%rbp), %xmm1
callq 0x115a0
movss -0x78(%rbp), %xmm0
movss %xmm0, -0x9c(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x118d0
movss -0x9c(%rbp), %xmm0
movss %xmm0, (%rax)
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)