// File: mitchellsayer[P]FastPointCloudSegmentation/src/./nanoflann.hpp
// Function: nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<float, ScanlinePointCloud, float>, ScanlinePointCloud, 3, unsigned long>::divideTree(unsigned long, unsigned long, nanoflann::CArray<nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<float, ScanlinePointCloud, float>, ScanlinePointCloud, 3, unsigned long>::Interval, 3ul>&)
NodePtr divideTree(const IndexType left, const IndexType right, BoundingBox& bbox)
		{
			NodePtr node = pool.allocate<Node>(); // allocate memory

			/* If too few exemplars remain, then make this a leaf node. */
			if ( (right-left) <= static_cast<IndexType>(m_leaf_max_size) ) {
				node->child1 = node->child2 = NULL;    /* Mark as leaf node. */
				node->node_type.lr.left = left;
				node->node_type.lr.right = right;

				// compute bounding-box of leaf points
				for (int i=0; i<(DIM>0 ? DIM : dim); ++i) {
					bbox[i].low = dataset_get(vind[left],i);
					bbox[i].high = dataset_get(vind[left],i);
				}
				for (IndexType k=left+1; k<right; ++k) {
					for (int i=0; i<(DIM>0 ? DIM : dim); ++i) {
						if (bbox[i].low>dataset_get(vind[k],i)) bbox[i].low=dataset_get(vind[k],i);
						if (bbox[i].high<dataset_get(vind[k],i)) bbox[i].high=dataset_get(vind[k],i);
					}
				}
			}
			else {
				IndexType idx;
				int cutfeat;
				DistanceType cutval;
				middleSplit_(&vind[0]+left, right-left, idx, cutfeat, cutval, bbox);

				node->node_type.sub.divfeat = cutfeat;

				BoundingBox left_bbox(bbox);
				left_bbox[cutfeat].high = cutval;
				node->child1 = divideTree(left, left+idx, left_bbox);

				BoundingBox right_bbox(bbox);
				right_bbox[cutfeat].low = cutval;
				node->child2 = divideTree(left+idx, right, right_bbox);

				node->node_type.sub.divlow = left_bbox[cutfeat].high;
				node->node_type.sub.divhigh = right_bbox[cutfeat].low;

				for (int i=0; i<(DIM>0 ? DIM : dim); ++i) {
					bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low);
					bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high);
				}
			}

			return node;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x90(%rbp)
addq $0x68, %rdi
movl $0x1, %esi
callq 0x106e0
movq -0x90(%rbp), %rcx
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
subq -0x10(%rbp), %rax
cmpq 0x18(%rcx), %rax
ja 0x102e4
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x2c(%rbp)
cmpl $0x3, -0x2c(%rbp)
jge 0x10176
movq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xf500
movq -0x90(%rbp), %rdi
movq (%rax), %rsi
movl -0x2c(%rbp), %edx
callq 0x105e0
movss %xmm0, -0x98(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x10610
movss -0x98(%rbp), %xmm0
movq -0x90(%rbp), %rdi
movss %xmm0, (%rax)
movq -0x10(%rbp), %rsi
callq 0xf500
movq -0x90(%rbp), %rdi
movq (%rax), %rsi
movl -0x2c(%rbp), %edx
callq 0x105e0
movss %xmm0, -0x94(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x10610
movss -0x94(%rbp), %xmm0
movss %xmm0, 0x4(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x100d7
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x102df
movl $0x0, -0x3c(%rbp)
cmpl $0x3, -0x3c(%rbp)
jge 0x102cc
movq -0x20(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
callq 0x10610
movq -0x90(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0x9c(%rbp)
movq -0x38(%rbp), %rsi
callq 0xf500
movq -0x90(%rbp), %rdi
movq (%rax), %rsi
movl -0x3c(%rbp), %edx
callq 0x105e0
movaps %xmm0, %xmm1
movss -0x9c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x1022f
movq -0x90(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xf500
movq -0x90(%rbp), %rdi
movq (%rax), %rsi
movl -0x3c(%rbp), %edx
callq 0x105e0
movss %xmm0, -0xa0(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
callq 0x10610
movss -0xa0(%rbp), %xmm0
movss %xmm0, (%rax)
movq -0x20(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
callq 0x10610
movq -0x90(%rbp), %rdi
movss 0x4(%rax), %xmm0
movss %xmm0, -0xa4(%rbp)
movq -0x38(%rbp), %rsi
callq 0xf500
movq -0x90(%rbp), %rdi
movq (%rax), %rsi
movl -0x3c(%rbp), %edx
callq 0x105e0
movss -0xa4(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x102bc
movq -0x90(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xf500
movq -0x90(%rbp), %rdi
movq (%rax), %rsi
movl -0x3c(%rbp), %edx
callq 0x105e0
movss %xmm0, -0xa8(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
callq 0x10610
movss -0xa8(%rbp), %xmm0
movss %xmm0, 0x4(%rax)
jmp 0x102be
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x10197
jmp 0x102ce
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x10182
jmp 0x1052b
movq -0x90(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xf500
movq -0x90(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdx
subq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rax
leaq -0x48(%rbp), %rcx
leaq -0x4c(%rbp), %r8
leaq -0x50(%rbp), %r9
movq %rax, (%rsp)
callq 0x10710
movl -0x4c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x68(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x60(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
movss -0x50(%rbp), %xmm0
movss %xmm0, -0xb0(%rbp)
movslq -0x4c(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x10610
movss -0xb0(%rbp), %xmm0
movq -0x90(%rbp), %rdi
movss %xmm0, 0x4(%rax)
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq -0x48(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x10050
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x80(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x78(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
movss -0x50(%rbp), %xmm0
movss %xmm0, -0xac(%rbp)
movslq -0x4c(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x10610
movss -0xac(%rbp), %xmm0
movq -0x90(%rbp), %rdi
movss %xmm0, (%rax)
movq -0x10(%rbp), %rsi
addq -0x48(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x80(%rbp), %rcx
callq 0x10050
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movslq -0x4c(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x10610
movss 0x4(%rax), %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, 0x4(%rax)
movslq -0x4c(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x10610
movss (%rax), %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, 0x8(%rax)
movl $0x0, -0x84(%rbp)
cmpl $0x3, -0x84(%rbp)
jge 0x10529
movslq -0x84(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x10610
movq %rax, -0xd0(%rbp)
movslq -0x84(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x10610
movq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x109f0
movss (%rax), %xmm0
movss %xmm0, -0xc4(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x84(%rbp), %rsi
callq 0x10610
movss -0xc4(%rbp), %xmm0
movss %xmm0, (%rax)
movslq -0x84(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x10610
addq $0x4, %rax
movq %rax, -0xc0(%rbp)
movslq -0x84(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x10610
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
addq $0x4, %rsi
callq 0x10a30
movss (%rax), %xmm0
movss %xmm0, -0xb4(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x84(%rbp), %rsi
callq 0x10610
movss -0xb4(%rbp), %xmm0
movss %xmm0, 0x4(%rax)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x10443
jmp 0x1052b
movq -0x28(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax,%rax)