// File: /workspace/github_cpp_makefile_star2_O3/jingdao[P]PointCloudApp/pcd.cpp
// Function: PCD::euclideanClusteringKDTree(std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>*, float, unsigned long, unsigned long, unsigned long)
void PCD::euclideanClusteringKDTree(std::vector<std::vector<int>> *indices,float distance,size_t minSize,size_t maxSize,size_t maxClusters) {
	if (!kdtree) kdtree = new KdTree(this);
	bool* visited = new bool[numPoints]();
	for (int i=0;i<numPoints;i++) {
		if (visited[i]) continue;
//		printf("%d %lu\n",i,indices->size());
		std::vector<int> P,Q,neighbors;
		Q.push_back(i);
		visited[i] = true;
		while (Q.size() > 0) {
			int p = Q[Q.size()-1];
			Q.pop_back();
			P.push_back(p);
			kdtree->search(&neighbors,float_data[p*4],float_data[p*4+1],float_data[p*4+2],distance);
			for (size_t j=0;j<neighbors.size();j++) {
				if (!visited[neighbors[j]]) {
					Q.push_back(neighbors[j]);
					visited[neighbors[j]] = true;
				}
			}
			neighbors.clear();
		}
		if (P.size() >= minSize && P.size() <= maxSize)
			indices->push_back(P);
		if (indices->size() >= maxClusters)
			break;
	}
	delete[] visited;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r8, 0x80(%rsp)
movq %rcx, 0x90(%rsp)
movq %rdx, 0x88(%rsp)
movss %xmm0, 0x74(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdi, %r13
cmpq $0x0, 0x70(%rdi)
jne 0x7000
movl $0x40, %edi
callq 0x2200
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
callq 0x83d4
movq %r14, 0x70(%r13)
movslq 0x60(%r13), %r15
movq %r15, %rdi
callq 0x2040
movq %rax, %rbp
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x2100
movl $0x0, 0x8(%rsp)
testq %r15, %r15
jle 0x724d
leaq 0x10(%rsp), %rbx
leaq 0x50(%rsp), %r14
leaq 0x30(%rsp), %r12
xorl %eax, %eax
movslq %eax, %rcx
cmpb $0x0, (%rbp,%rcx)
jne 0x723e
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movq %rax, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
leaq 0x8(%rsp), %rdx
callq 0x8112
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
movslq 0x8(%rsp), %rdx
movb $0x1, (%rbp,%rdx)
cmpq %rcx, %rax
je 0x7194
movl -0x4(%rax), %ecx
movl %ecx, 0xc(%rsp)
addq $-0x4, %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x70c4
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rsp)
jmp 0x70d1
movq %r14, %rdi
leaq 0xc(%rsp), %rdx
callq 0x8112
movq 0x58(%r13), %rax
movq 0x70(%r13), %rdi
movslq 0xc(%rsp), %rcx
leaq (,%rcx,4), %rdx
shlq $0x4, %rcx
movss (%rax,%rcx), %xmm0
leal 0x1(%rdx), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
orl $0x2, %edx
movslq %edx, %rcx
movss (%rax,%rcx,4), %xmm2
movq %r12, %rsi
movss 0x74(%rsp), %xmm3
callq 0x878c
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpq %rax, %rcx
je 0x717a
xorl %r15d, %r15d
movslq (%rax,%r15,4), %rdx
cmpb $0x0, (%rbp,%rdx)
jne 0x7168
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x7149
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x715f
leaq (%rax,%r15,4), %rdx
movq %rbx, %rdi
callq 0x8112
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
movslq (%rax,%r15,4), %rdx
movb $0x1, (%rbp,%rdx)
incq %r15
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rdx, %r15
jb 0x7125
cmpq %rax, %rcx
je 0x7184
movq %rax, 0x38(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
jne 0x709b
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
sarq $0x2, %rax
cmpq 0x88(%rsp), %rax
setb %cl
cmpq 0x90(%rsp), %rax
seta %al
orb %cl, %al
jne 0x71c9
movq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0x7c44
movq 0x78(%rsp), %rax
movq 0x8(%rax), %r15
subq (%rax), %r15
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x71ec
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7203
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x721a
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
sarq $0x3, %r15
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r15
cmpq 0x80(%rsp), %r15
jae 0x724d
movl 0x8(%rsp), %eax
movl 0x60(%r13), %r15d
incl %eax
movl %eax, 0x8(%rsp)
cmpl %r15d, %eax
jl 0x703e
movq %rbp, %rdi
callq 0x2260
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
jmp 0x72bb
jmp 0x7278
jmp 0x7278
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x7292
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x72a9
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x72c0
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x23a0