// File: /workspace/github_cpp_makefile_star2_O1/jingdao[P]PointCloudApp/pcd.cpp
// Function: PCD::euclideanClustering(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::euclideanClustering(std::vector<std::vector<int>> *indices,float distance,size_t minSize,size_t maxSize,size_t maxClusters) {
	Ind* byX = new Ind[numPoints];
	Ind* byY = new Ind[numPoints];
	Ind* byZ = new Ind[numPoints];
	for (int i=0;i<numPoints;i++) {
		byX[i] = {float_data[i*4], i};
		byY[i] = {float_data[i*4 + 1], i};
		byZ[i] = {float_data[i*4 + 2], i};
	}
	qsort(byX,numPoints,sizeof(Ind),compare);
	qsort(byY,numPoints,sizeof(Ind),compare);
	qsort(byZ,numPoints,sizeof(Ind),compare);
	bool* visited = new bool[numPoints]();
	for (int i=0;i<numPoints;i++) {
		if (visited[i]) continue;
		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);
			Ind key,*xl,*xh,*yl,*yh,*zl,*zh;
			key.val = float_data[p*4] - distance;
			xl = (Ind*) closestBSearch(&key,byX,numPoints,sizeof(Ind),compare,true);
			key.val = float_data[p*4] + distance;
			xh = (Ind*) closestBSearch(&key,byX,numPoints,sizeof(Ind),compare,false);
			key.val = float_data[p*4+1] - distance;
			yl = (Ind*) closestBSearch(&key,byY,numPoints,sizeof(Ind),compare,true);
			key.val = float_data[p*4+1] + distance;
			yh = (Ind*) closestBSearch(&key,byY,numPoints,sizeof(Ind),compare,false);
			key.val = float_data[p*4+2] - distance;
			zl = (Ind*) closestBSearch(&key,byZ,numPoints,sizeof(Ind),compare,true);
			key.val = float_data[p*4+2] + distance;
			zh = (Ind*) closestBSearch(&key,byZ,numPoints,sizeof(Ind),compare,false);
			HashTable ht;
			int closeX,closeY,closeZ;
			for (Ind* k = xl; k <= xh; k++) ht.insert(k->index,&closeX);
			for (Ind* k = yl; k <= yh; k++) if (ht.remove(k->index)) ht.insert(k->index,&closeY);
			for (Ind* k = zl; k <= zh; k++) if (ht.remove(k->index) == &closeY) ht.insert(k->index,&closeZ);
			for (int k=0; k<ht.size; k++) {
				if (ht.entries[k] == &closeZ) {
					neighbors.push_back(ht.keys[k]);
				}
			}
			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[] byX;
	delete[] byY;
	delete[] byZ;
	delete[] visited;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r8, 0xa0(%rsp)
movq %rcx, 0xb0(%rsp)
movq %rdx, 0xa8(%rsp)
movss %xmm0, 0x8(%rsp)
movq %rsi, 0x90(%rsp)
movq %rdi, 0x58(%rsp)
movslq 0x60(%rdi), %r15
leaq (,%r15,8), %rax
testq %r15, %r15
movq $-0x1, %r14
cmovnsq %rax, %r14
movq %r14, %rdi
callq 0x2040
movq %rax, %rbp
movq %r14, %rdi
callq 0x2040
movq %r14, %rdi
movq %rax, %r14
callq 0x2040
movq %rax, %rbx
testq %r15, %r15
jle 0x7489
movq 0x58(%rsp), %rax
movq 0x58(%rax), %rax
addq $0x8, %rax
xorl %ecx, %ecx
movss -0x8(%rax), %xmm0
movss %xmm0, (%rbp,%rcx,8)
movl %ecx, 0x4(%rbp,%rcx,8)
movss -0x4(%rax), %xmm0
movss %xmm0, (%r14,%rcx,8)
movl %ecx, 0x4(%r14,%rcx,8)
movss (%rax), %xmm0
movss %xmm0, (%rbx,%rcx,8)
movl %ecx, 0x4(%rbx,%rcx,8)
incq %rcx
addq $0x10, %rax
cmpq %rcx, %r15
jne 0x7451
leaq -0x1e5(%rip), %r12      # 0x72ab
movl $0x8, %edx
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x23d0
movq %rbx, %r15
movq 0x58(%rsp), %rbx
movslq 0x60(%rbx), %rsi
movl $0x8, %edx
movq %r14, %rdi
movq %r12, %rcx
callq 0x23d0
movslq 0x60(%rbx), %rsi
movl $0x8, %edx
movq %r15, 0x30(%rsp)
movq %r15, %rdi
movq %r12, %rcx
callq 0x23d0
movslq 0x60(%rbx), %r12
movq %r12, %rdi
callq 0x2040
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x2100
movl $0x0, 0xc(%rsp)
testq %r12, %r12
jle 0x7aed
leaq 0x10(%rsp), %r12
xorl %eax, %eax
movq %rbp, 0x98(%rsp)
movq %r14, 0x80(%rsp)
movq %r15, 0xb8(%rsp)
movslq %eax, %rcx
cmpb $0x0, (%r15,%rcx)
jne 0x7ad5
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x70(%rsp)
movq %rcx, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rcx, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x756c
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x7579
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
callq 0x80de
movslq 0xc(%rsp), %rax
movb $0x1, (%r15,%rax)
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x7a2b
movl -0x4(%rax), %ecx
movl %ecx, 0x3c(%rsp)
addq $-0x4, %rax
movq %rax, 0x18(%rsp)
movq 0x68(%rsp), %rsi
cmpq 0x70(%rsp), %rsi
je 0x75bc
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%rsp)
jmp 0x75cb
leaq 0x60(%rsp), %rdi
leaq 0x3c(%rsp), %rdx
callq 0x80de
movq 0x58(%rsp), %rcx
movq 0x58(%rcx), %rsi
movslq 0x3c(%rsp), %rdi
movq %rdi, %rax
shlq $0x4, %rax
movss (%rsi,%rax), %xmm0
movl 0x60(%rcx), %ecx
leal -0x1(%rcx), %eax
movl %eax, %edx
shrl $0x1f, %edx
leal (%rcx,%rdx), %r12d
decl %r12d
sarl %r12d
movl %r12d, %r13d
cmpl $0x2, %ecx
jl 0x763f
movaps %xmm0, %xmm1
subss 0x8(%rsp), %xmm1
xorl %edx, %edx
movl %r12d, %r13d
movl %eax, %r8d
movslq %r13d, %r9
ucomiss (%rbp,%r9,8), %xmm1
ja 0x7623
movl %r13d, %r8d
jmp 0x7629
incl %r13d
movl %r13d, %edx
leal (%rdx,%r8), %r9d
movl %r9d, %r13d
shrl $0x1f, %r13d
addl %r9d, %r13d
sarl %r13d
cmpl %r8d, %edx
jl 0x7613
addss 0x8(%rsp), %xmm0
leal -0x2(%rcx), %edx
xorl %r8d, %r8d
movl %eax, %r9d
movl %r12d, %r15d
movl %edx, %r10d
cmpl $0x3, %ecx
jl 0x7696
xorl %r8d, %r8d
movl %r12d, %r15d
movl %eax, %r9d
movslq %r15d, %r10
movss (%rbp,%r10,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x7679
decl %r15d
movl %r15d, %r9d
jmp 0x767c
movl %r15d, %r8d
leal (%r8,%r9), %r10d
movl %r10d, %r15d
shrl $0x1f, %r15d
addl %r10d, %r15d
sarl %r15d
leal -0x1(%r9), %r10d
cmpl %r10d, %r8d
jl 0x7662
cmpl %r10d, %r8d
jne 0x76b2
movslq %r9d, %r8
movss (%rbp,%r8,8), %xmm1
xorl %r8d, %r8d
ucomiss %xmm0, %xmm1
setbe %r8b
addl %r8d, %r15d
shlq $0x2, %rdi
movl %edi, %r8d
orl $0x1, %r8d
movslq %r8d, %r8
movss (%rsi,%r8,4), %xmm0
movl %r12d, %ebp
cmpl $0x2, %ecx
jl 0x7708
movaps %xmm0, %xmm1
subss 0x8(%rsp), %xmm1
xorl %r8d, %r8d
movl %r12d, %ebp
movl %eax, %r9d
movslq %ebp, %r10
ucomiss (%r14,%r10,8), %xmm1
ja 0x76ef
movl %ebp, %r9d
jmp 0x76f4
incl %ebp
movl %ebp, %r8d
leal (%r8,%r9), %r10d
movl %r10d, %ebp
shrl $0x1f, %ebp
addl %r10d, %ebp
sarl %ebp
cmpl %r9d, %r8d
jl 0x76e0
xorl %r8d, %r8d
addss 0x8(%rsp), %xmm0
movl %eax, %r9d
movl %r12d, %ebx
movl %edx, %r10d
cmpl $0x3, %ecx
jl 0x7758
xorl %r8d, %r8d
movl %r12d, %ebx
movl %eax, %r9d
movslq %ebx, %r10
movss (%r14,%r10,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x773d
decl %ebx
movl %ebx, %r9d
jmp 0x7740
movl %ebx, %r8d
leal (%r8,%r9), %r10d
movl %r10d, %ebx
shrl $0x1f, %ebx
addl %r10d, %ebx
sarl %ebx
leal -0x1(%r9), %r10d
cmpl %r10d, %r8d
jl 0x7728
cmpl %r10d, %r8d
jne 0x7773
movslq %r9d, %r8
movss (%r14,%r8,8), %xmm1
xorl %r8d, %r8d
ucomiss %xmm0, %xmm1
setbe %r8b
addl %r8d, %ebx
orl $0x2, %edi
movslq %edi, %rdi
movss (%rsi,%rdi,4), %xmm0
movl %r12d, %r14d
cmpl $0x2, %ecx
jl 0x77c5
movaps %xmm0, %xmm1
subss 0x8(%rsp), %xmm1
xorl %esi, %esi
movl %r12d, %r14d
movl %eax, %edi
movslq %r14d, %r8
movq 0x30(%rsp), %r9
ucomiss (%r9,%r8,8), %xmm1
ja 0x77aa
movl %r14d, %edi
jmp 0x77b0
incl %r14d
movl %r14d, %esi
leal (%rsi,%rdi), %r8d
movl %r8d, %r14d
shrl $0x1f, %r14d
addl %r8d, %r14d
sarl %r14d
cmpl %edi, %esi
jl 0x7796
xorl %esi, %esi
addss 0x8(%rsp), %xmm0
cmpl $0x3, %ecx
jl 0x7808
xorl %esi, %esi
movslq %r12d, %rcx
movq 0x30(%rsp), %rdx
movss (%rdx,%rcx,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x77ee
decl %r12d
movl %r12d, %eax
jmp 0x77f1
movl %r12d, %esi
leal (%rsi,%rax), %ecx
movl %ecx, %r12d
shrl $0x1f, %r12d
addl %ecx, %r12d
sarl %r12d
leal -0x1(%rax), %edx
cmpl %edx, %esi
jl 0x77d4
cmpl %edx, %esi
jne 0x7823
cltq
movq 0x30(%rsp), %rcx
movss (%rcx,%rax,8), %xmm1
xorl %eax, %eax
ucomiss %xmm0, %xmm1
setbe %al
addl %eax, %r12d
leaq 0xc0(%rsp), %rdi
callq 0xa25c
shll $0x3, %r13d
shll $0x3, %r15d
cmpl %r15d, %r13d
jg 0x7873
movslq %r13d, %r13
movq 0x98(%rsp), %rax
addq %rax, %r13
movslq %r15d, %r15
addq %rax, %r15
movl 0x4(%r13), %esi
leaq 0xc0(%rsp), %rdi
leaq 0xe4(%rsp), %rdx
callq 0xa312
addq $0x8, %r13
cmpq %r15, %r13
jbe 0x7851
shll $0x3, %ebp
shll $0x3, %ebx
cmpl %ebx, %ebp
leaq 0xc0(%rsp), %r13
jg 0x78c7
movslq %ebp, %r15
movq 0x80(%rsp), %rax
addq %rax, %r15
movslq %ebx, %rbx
addq %rax, %rbx
movl 0x4(%r15), %esi
movq %r13, %rdi
callq 0xa5ba
testq %rax, %rax
je 0x78be
movl 0x4(%r15), %esi
movq %r13, %rdi
leaq 0x8c(%rsp), %rdx
callq 0xa312
addq $0x8, %r15
cmpq %rbx, %r15
jbe 0x7899
shll $0x3, %r14d
shll $0x3, %r12d
cmpl %r12d, %r14d
movq 0x98(%rsp), %rbp
movq 0xb8(%rsp), %r15
jg 0x7929
movslq %r14d, %rbx
movq 0x30(%rsp), %rax
addq %rax, %rbx
movslq %r12d, %r14
addq %rax, %r14
movl 0x4(%rbx), %esi
movq %r13, %rdi
callq 0xa5ba
leaq 0x8c(%rsp), %rcx
cmpq %rcx, %rax
jne 0x7920
movl 0x4(%rbx), %esi
movq %r13, %rdi
leaq 0x88(%rsp), %rdx
callq 0xa312
addq $0x8, %rbx
cmpq %r14, %rbx
jbe 0x78f5
cmpl $0x0, 0xd8(%rsp)
leaq 0x10(%rsp), %r12
jle 0x7997
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0xd0(%rsp), %rax
leaq 0x88(%rsp), %rcx
cmpq %rcx, (%rax,%rbx,2)
jne 0x7983
movq 0xc8(%rsp), %rdx
addq %rbx, %rdx
movq 0x48(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
je 0x7979
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x48(%rsp)
jmp 0x7983
leaq 0x40(%rsp), %rdi
callq 0x80de
incq %r14
movslq 0xd8(%rsp), %rax
addq $0x4, %rbx
cmpq %rax, %r14
jl 0x793d
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq %rax, %rcx
je 0x7a0c
xorl %ebx, %ebx
movq 0x80(%rsp), %r14
movslq (%rax,%rbx,4), %rcx
cmpb $0x0, (%r15,%rcx)
jne 0x79ee
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x79d4
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x79e0
leaq (%rax,%rbx,4), %rdx
movq %r12, %rdi
callq 0x80de
movq 0x40(%rsp), %rax
movslq (%rax,%rbx,4), %rax
movb $0x1, (%r15,%rax)
incq %rbx
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rdx, %rbx
jb 0x79b0
jmp 0x7a14
movq 0x80(%rsp), %r14
cmpq %rax, %rcx
je 0x7a1e
movq %rax, 0x48(%rsp)
movq %r13, %rdi
callq 0xa2f2
jmp 0x7583
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
sarq $0x2, %rax
cmpq 0xa8(%rsp), %rax
setb %cl
cmpq 0xb0(%rsp), %rax
seta %al
orb %cl, %al
jne 0x7a65
movq 0x90(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x7c10
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rbx
subq (%rax), %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x7a8b
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7aa2
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x7ab9
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
sarq $0x3, %rbx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rbx
cmpq 0xa0(%rsp), %rbx
jae 0x7aed
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
movq 0x58(%rsp), %rcx
cmpl 0x60(%rcx), %eax
jl 0x7524
movq %rbp, %rdi
callq 0x2260
movq %r14, %rdi
callq 0x2260
movq 0x30(%rsp), %rdi
callq 0x2260
movq %r15, %rdi
callq 0x2260
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7b25
jmp 0x7b25
movq %rax, %rbx
jmp 0x7b42
jmp 0x7b32
jmp 0x7b32
jmp 0x7b32
jmp 0x7b32
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0xa2f2
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x7b59
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7b70
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x7b87
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x23a0
nop