// File: /workspace/github_cpp_makefile_star2_O3/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 $0xd8, %rsp
movq %r8, 0xb8(%rsp)
movq %rcx, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movss %xmm0, 0x4(%rsp)
movq %rsi, 0x80(%rsp)
movq %rdi, 0x48(%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 %rax, %rbx
movq %r14, %rdi
callq 0x2040
movq %rax, %r13
testq %r15, %r15
jle 0x74a8
movq 0x48(%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, (%rbx,%rcx,8)
movl %ecx, 0x4(%rbx,%rcx,8)
movss (%rax), %xmm0
movss %xmm0, (%r13,%rcx,8)
movl %ecx, 0x4(%r13,%rcx,8)
incq %rcx
addq $0x10, %rax
cmpq %rcx, %r15
jne 0x746f
leaq -0x1e7(%rip), %r12      # 0x72c8
movl $0x8, %edx
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x23c0
movq %rbx, %rdi
movq 0x48(%rsp), %rbx
movslq 0x60(%rbx), %rsi
movl $0x8, %edx
movq %rdi, 0x50(%rsp)
movq %r12, %rcx
callq 0x23c0
movslq 0x60(%rbx), %rsi
movl $0x8, %edx
movq %r13, %rdi
movq %r12, %rcx
callq 0x23c0
movslq 0x60(%rbx), %rbx
movq %rbx, %rdi
callq 0x2040
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x2100
movl $0x0, 0x8(%rsp)
testq %rbx, %rbx
jle 0x7b21
leaq 0x10(%rsp), %r15
xorl %eax, %eax
movq %rbp, 0x90(%rsp)
movq %r13, 0x58(%rsp)
movq %r14, 0x88(%rsp)
movslq %eax, %rcx
cmpb $0x0, (%r14,%rcx)
jne 0x7b13
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movq %rax, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %r15, %rdi
xorl %esi, %esi
leaq 0x8(%rsp), %rdx
callq 0x8112
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
movslq 0x8(%rsp), %rdx
movb $0x1, (%r14,%rdx)
cmpq %rcx, %rax
movq 0x50(%rsp), %rbx
je 0x7a5d
movl -0x4(%rax), %ecx
movl %ecx, 0xc(%rsp)
addq $-0x4, %rax
movq %rax, 0x18(%rsp)
movq 0x68(%rsp), %rsi
cmpq 0x70(%rsp), %rsi
je 0x75c8
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%rsp)
jmp 0x75d7
leaq 0x60(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x8112
movq 0x48(%rsp), %rdx
movq 0x58(%rdx), %rcx
movslq 0xc(%rsp), %rsi
movq %rsi, %rax
shlq $0x4, %rax
movss (%rcx,%rax), %xmm0
movl 0x60(%rdx), %edi
leal -0x1(%rdi), %eax
movl %eax, %edx
shrl $0x1f, %edx
leal (%rdi,%rdx), %r14d
decl %r14d
sarl %r14d
cmpl $0x2, %edi
jl 0x7669
movaps %xmm0, %xmm1
subss 0x4(%rsp), %xmm1
xorl %edx, %edx
movl %r14d, %r12d
movl %eax, %r8d
movslq %r12d, %r9
ucomiss (%rbp,%r9,8), %xmm1
ja 0x762c
movl %r12d, %r8d
jmp 0x7632
incl %r12d
movl %r12d, %edx
leal (%rdx,%r8), %r9d
movl %r9d, %r12d
shrl $0x1f, %r12d
addl %r9d, %r12d
sarl %r12d
cmpl %r8d, %edx
jl 0x761c
addss 0x4(%rsp), %xmm0
cmpl $0x2, %edi
jne 0x7686
movl $0x1, %r9d
xorl %r8d, %r8d
xorl %edx, %edx
xorl %r10d, %r10d
xorl %r13d, %r13d
xorl %r11d, %r11d
jmp 0x76c9
addss 0x4(%rsp), %xmm0
leal -0x2(%rdi), %edx
xorl %r8d, %r8d
movl %r14d, %r12d
xorl %r10d, %r10d
movl %eax, %r9d
movl %r14d, %r13d
movl %edx, %r11d
jmp 0x76c9
leal -0x2(%rdi), %edx
xorl %r10d, %r10d
movl %r14d, %r13d
movl %eax, %r9d
movslq %r13d, %r8
movss (%rbp,%r8,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x76a9
decl %r13d
movl %r13d, %r9d
jmp 0x76ac
movl %r13d, %r10d
leal (%r10,%r9), %r8d
movl %r8d, %r13d
shrl $0x1f, %r13d
addl %r8d, %r13d
sarl %r13d
leal -0x1(%r9), %r11d
cmpl %r11d, %r10d
jl 0x7692
movb $0x1, %r8b
cmpl %r11d, %r10d
jne 0x76e5
movslq %r9d, %r9
movss (%rbp,%r9,8), %xmm1
xorl %r9d, %r9d
ucomiss %xmm0, %xmm1
setbe %r9b
addl %r9d, %r13d
shlq $0x2, %rsi
movl %esi, %r9d
orl $0x1, %r9d
movslq %r9d, %r9
movss (%rcx,%r9,4), %xmm0
movl %r14d, %ebp
cmpl $0x2, %edi
jl 0x773b
movaps %xmm0, %xmm1
subss 0x4(%rsp), %xmm1
xorl %r9d, %r9d
movl %r14d, %ebp
movl %eax, %r10d
movslq %ebp, %r11
ucomiss (%rbx,%r11,8), %xmm1
ja 0x7722
movl %ebp, %r10d
jmp 0x7727
incl %ebp
movl %ebp, %r9d
leal (%r9,%r10), %r11d
movl %r11d, %ebp
shrl $0x1f, %ebp
addl %r11d, %ebp
sarl %ebp
cmpl %r10d, %r9d
jl 0x7713
addss 0x4(%rsp), %xmm0
xorl %r9d, %r9d
movl %eax, %r10d
movl %r14d, %r15d
movl %edx, %r11d
testb %r8b, %r8b
je 0x778e
xorl %r9d, %r9d
movl %r14d, %r15d
movl %eax, %r10d
movslq %r15d, %r11
movss (%rbx,%r11,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x7771
decl %r15d
movl %r15d, %r10d
jmp 0x7774
movl %r15d, %r9d
leal (%r9,%r10), %r11d
movl %r11d, %r15d
shrl $0x1f, %r15d
addl %r11d, %r15d
sarl %r15d
leal -0x1(%r10), %r11d
cmpl %r11d, %r9d
jl 0x775b
cmpl %r11d, %r9d
jne 0x77a9
movslq %r10d, %r9
movss (%rbx,%r9,8), %xmm1
xorl %r9d, %r9d
ucomiss %xmm0, %xmm1
setbe %r9b
addl %r9d, %r15d
orl $0x2, %esi
movslq %esi, %rsi
movss (%rcx,%rsi,4), %xmm0
movl %r14d, %ebx
cmpl $0x2, %edi
jl 0x77f3
movaps %xmm0, %xmm1
subss 0x4(%rsp), %xmm1
xorl %ecx, %ecx
movl %r14d, %ebx
movl %eax, %esi
movslq %ebx, %rdi
movq 0x58(%rsp), %r9
ucomiss (%r9,%rdi,8), %xmm1
ja 0x77df
movl %ebx, %esi
jmp 0x77e3
incl %ebx
movl %ebx, %ecx
leal (%rcx,%rsi), %edi
movl %edi, %ebx
shrl $0x1f, %ebx
addl %edi, %ebx
sarl %ebx
cmpl %esi, %ecx
jl 0x77cc
addss 0x4(%rsp), %xmm0
xorl %ecx, %ecx
testb %r8b, %r8b
je 0x7836
xorl %ecx, %ecx
movslq %r14d, %rdx
movq 0x58(%rsp), %rsi
movss (%rsi,%rdx,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x781c
decl %r14d
movl %r14d, %eax
jmp 0x781f
movl %r14d, %ecx
leal (%rcx,%rax), %edx
movl %edx, %r14d
shrl $0x1f, %r14d
addl %edx, %r14d
sarl %r14d
leal -0x1(%rax), %edx
cmpl %edx, %ecx
jl 0x7802
cmpl %edx, %ecx
jne 0x7851
cltq
movq 0x58(%rsp), %rcx
movss (%rcx,%rax,8), %xmm1
xorl %eax, %eax
ucomiss %xmm0, %xmm1
setbe %al
addl %eax, %r14d
leaq 0x98(%rsp), %rdi
callq 0xa108
shll $0x3, %r12d
shll $0x3, %r13d
cmpl %r13d, %r12d
jg 0x78a2
movslq %r12d, %r12
movq 0x90(%rsp), %rax
addq %rax, %r12
movslq %r13d, %r13
addq %rax, %r13
movl 0x4(%r12), %esi
leaq 0x98(%rsp), %rdi
leaq 0xd4(%rsp), %rdx
callq 0xa1b6
addq $0x8, %r12
cmpq %r13, %r12
jbe 0x787f
shll $0x3, %ebp
shll $0x3, %r15d
cmpl %r15d, %ebp
movq 0x58(%rsp), %r13
jg 0x78fb
movslq %ebp, %r12
movq 0x50(%rsp), %rax
addq %rax, %r12
movslq %r15d, %r15
addq %rax, %r15
movl 0x4(%r12), %esi
leaq 0x98(%rsp), %rdi
callq 0xa454
testq %rax, %rax
je 0x78f2
movl 0x4(%r12), %esi
leaq 0x98(%rsp), %rdi
leaq 0x7c(%rsp), %rdx
callq 0xa1b6
addq $0x8, %r12
cmpq %r15, %r12
jbe 0x78c4
shll $0x3, %ebx
shll $0x3, %r14d
cmpl %r14d, %ebx
movq 0x90(%rsp), %rbp
leaq 0x10(%rsp), %r15
leaq 0xd0(%rsp), %r12
jg 0x795e
movslq %ebx, %rbx
addq %r13, %rbx
movslq %r14d, %r14
addq %r13, %r14
movl 0x4(%rbx), %esi
leaq 0x98(%rsp), %rdi
callq 0xa454
leaq 0x7c(%rsp), %rcx
cmpq %rcx, %rax
jne 0x7955
movl 0x4(%rbx), %esi
leaq 0x98(%rsp), %rdi
movq %r12, %rdx
callq 0xa1b6
addq $0x8, %rbx
cmpq %r14, %rbx
jbe 0x7928
cmpl $0x0, 0xb0(%rsp)
jle 0x79bf
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0xa8(%rsp), %rax
cmpq %r12, (%rax,%rbx,2)
jne 0x79ab
movq 0xa0(%rsp), %rdx
addq %rbx, %rdx
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x79a1
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x79ab
leaq 0x30(%rsp), %rdi
callq 0x8112
incq %r14
movslq 0xb0(%rsp), %rax
addq $0x4, %rbx
cmpq %rax, %r14
jl 0x796d
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpq %rax, %rcx
je 0x7a2f
xorl %ebx, %ebx
movq 0x88(%rsp), %r14
movslq (%rax,%rbx,4), %rdx
cmpb $0x0, (%r14,%rdx)
jne 0x7a1b
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x79fc
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x7a12
leaq (%rax,%rbx,4), %rdx
movq %r15, %rdi
callq 0x8112
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
movslq (%rax,%rbx,4), %rdx
movb $0x1, (%r14,%rdx)
incq %rbx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rdx, %rbx
jb 0x79d8
jmp 0x7a37
movq 0x88(%rsp), %r14
cmpq %rax, %rcx
je 0x7a41
movq %rax, 0x38(%rsp)
leaq 0x98(%rsp), %rdi
callq 0xa196
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
jmp 0x7594
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
sarq $0x2, %rax
cmpq 0xc0(%rsp), %rax
setb %cl
cmpq 0xc8(%rsp), %rax
seta %al
orb %cl, %al
jne 0x7a97
movq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x7c44
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rbx
subq (%rax), %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x7abd
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7ad4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x7aeb
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
sarq $0x3, %rbx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rbx
cmpq 0xb8(%rsp), %rbx
jae 0x7b21
movl 0x8(%rsp), %eax
movq 0x48(%rsp), %rcx
movl 0x60(%rcx), %ebx
incl %eax
movl %eax, 0x8(%rsp)
cmpl %ebx, %eax
jl 0x753d
movq %rbp, %rdi
callq 0x2260
movq 0x50(%rsp), %rdi
callq 0x2260
movq %r13, %rdi
callq 0x2260
movq %r14, %rdi
callq 0x2260
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7b59
jmp 0x7b59
movq %rax, %rbx
jmp 0x7b76
jmp 0x7b66
jmp 0x7b66
jmp 0x7b66
jmp 0x7b66
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xa196
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x7b8d
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7ba4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x7bbb
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x23a0
nop