// File: /workspace/github_cpp_makefile_star2_O3/nikosgalanis[P]Vectors-Similarity-Search-and-Clustering/programs/Clustering/../../algorithms/Clustering/clustering.h
// Function: Clustering<double>::reverse_assignment()
int reverse_assignment(void) {
			// keep a vector of the new assignments
			vector<int> new_assigned(n_points, -1);
			// initial radius
			T radius = min_dist_between_centroids() / 2;
			// keep track of the changes
			int changes = 0;
			// set a threshold in order to break the loop
			int prev_unassigned = INT_MAX;
			// keep track of unassinged points
			int unassinged = INT_MAX - 1;
			// break the loop when all the balls contain no new vectors
			while (unassinged != prev_unassigned) {
				// do a range search query for every centroid
				for (int i = 0; i < k; i++) {
					list<pair<int, T>> result;
					// the type of range search depends on what the user wants
					if (assignment_method == "reverse_LSH")
						result = lsh_instant->RangeSearch(centroids.at(i), radius, 1);
					else if (assignment_method == "reverse_Hypercube")
						result = hc_instant->RangeSearch(centroids.at(i), radius, 1);

					// iterate all the results
					typename std::list<std::pair<int,T>>::iterator pair_it;
					for (pair_it = result.begin(); pair_it !=result.end(); pair_it++) {
						// get the current vector
						int curr_vec = pair_it->first;

						// if it is still unassigned
						if (new_assigned.at(curr_vec) == -1) {
							// temporarly assign it to this centroid
							new_assigned.at(curr_vec) = i;
						}
						// if it has been already assigned
						else {
							// chcek if its distance from the current centroid, is less than the previous' one
							int prev_assigned = new_assigned.at(curr_vec); 
							T prev_dist = metrics::ManhatanDistance(feature_vectors.at(curr_vec), centroids.at(prev_assigned), space_dim);
							T new_dist = pair_it->second;
							// if it is, it is closest to the current centroid, thus change the asssigned value in the temp vector
							if (new_dist < prev_dist)
								new_assigned.at(curr_vec) = i;
						}
					}
				}

				// update the unassigned vectors count
				prev_unassigned = unassinged;
				unassinged = count_unassigned(new_assigned);
				// update the radius
				radius *= 2;
			}

			// update the untracked vectors, and check for new changes
			for (int i = 0; i < n_points; i++) {
				// for each one not tracked, use direct assignment
				if (new_assigned.at(i) == UNASSIGNED)
					new_assigned.at(i) = nearest_centroid(feature_vectors.at(i));
				// check for changes
				if (assigned_centroid.at(i) != new_assigned.at(i))
					changes++;
			}

			// update the assigned vector
			assigned_centroid = new_assigned;
			return changes;
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, %r14
movslq 0x4(%rdi), %rsi
movq %rsp, %rbx
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rcx
movq %rbx, %rdx
callq 0x5762
movq %r14, %rdi
callq 0x983a
mulsd 0x2727(%rip), %xmm0     # 0xb1d8
movsd %xmm0, 0x30(%rsp)
leaq 0x10(%r14), %r15
movl $0x7ffffffe, %ebp       # imm = 0x7FFFFFFE
leaq 0x80(%rsp), %r13
movq %r15, 0x60(%rsp)
movl %ebp, 0x5c(%rsp)
cmpl $0x0, (%r14)
jle 0x8e86
xorl %r15d, %r15d
movq %rbx, 0x8(%rsp)
movq %rbx, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x60(%rsp), %r12
movq %r12, %rdi
leaq 0x2784(%rip), %rsi      # 0xb283
callq 0x20a0
testl %eax, %eax
je 0x8bf4
movq %r12, %rdi
leaq 0x2790(%rip), %rsi      # 0xb2a6
callq 0x20a0
testl %eax, %eax
jne 0x8cf2
movq 0x30(%r14), %rax
movq 0x38(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r15, %rdx
jbe 0x9069
movq 0x98(%r14), %r12
leaq (%r15,%r15,2), %rcx
leaq (%rax,%rcx,8), %rsi
leaq 0xc8(%rsp), %r13
movq %r13, %rdi
callq 0x393a
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movsd 0x30(%rsp), %xmm0
movl $0x1, %ecx
callq 0x9cc6
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x8b9c
movq (%rdi), %r12
callq 0x2260
movq %r12, %rdi
cmpq %rbx, %r12
jne 0x8b8c
movq %rbx, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x18(%rsp), %rax
leaq 0x18(%rsp), %rcx
cmpq %rcx, %rax
je 0x8cd0
movq %rax, (%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbx, (%rax)
movq (%rsp), %rax
movq %rbx, 0x8(%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rcx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
leaq 0x28(%rsp), %rax
jmp 0x8cd9
movq 0x30(%r14), %rax
movq 0x38(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r15, %rdx
jbe 0x9058
movq 0x80(%r14), %r12
leaq (%r15,%r15,2), %rcx
leaq (%rax,%rcx,8), %rsi
movq %r13, %rdi
callq 0x393a
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movsd 0x30(%rsp), %xmm0
movl $0x1, %ecx
callq 0x99da
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x8c65
movq (%rdi), %r12
callq 0x2260
movq %r12, %rdi
cmpq %rbx, %r12
jne 0x8c55
movq %rbx, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x18(%rsp), %rax
leaq 0x18(%rsp), %rcx
cmpq %rcx, %rax
je 0x8cb6
movq %rax, (%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbx, (%rax)
movq (%rsp), %rax
movq %rbx, 0x8(%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rcx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
leaq 0x28(%rsp), %rax
jmp 0x8cbf
movq %rbx, (%rsp)
leaq 0x10(%rsp), %rax
movq $0x0, (%rax)
movq 0x80(%rsp), %rdi
jmp 0x8ce8
movq %rbx, (%rsp)
leaq 0x10(%rsp), %rax
movq $0x0, (%rax)
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x8cf2
callq 0x2260
movq (%rsp), %r12
cmpq %rbx, %r12
je 0x8e56
movslq 0x10(%r12), %rbp
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbp, %rdx
jbe 0x9014
movslq (%rax,%rbp,4), %r13
cmpq $-0x1, %r13
je 0x8e41
movq 0x48(%r14), %rax
movq 0x50(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %rbp, %rdx
jbe 0x9025
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
leaq (%rax,%rcx,8), %rsi
leaq 0x68(%rsp), %rdi
callq 0x393a
movq 0x30(%r14), %rax
movq 0x38(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r13, %rdx
jbe 0x9036
leaq (,%r13,2), %rcx
addq %r13, %rcx
leaq (%rax,%rcx,8), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x393a
movslq 0x8(%r14), %rax
movq 0xe0(%rsp), %rdi
xorpd %xmm2, %xmm2
testq %rax, %rax
jle 0x8ded
movq 0x68(%rsp), %rcx
xorl %edx, %edx
movapd 0x241f(%rip), %xmm1     # 0xb1f0
movsd (%rcx,%rdx,8), %xmm0
subsd (%rdi,%rdx,8), %xmm0
andpd %xmm1, %xmm0
addsd %xmm0, %xmm2
incq %rdx
cmpq %rdx, %rax
jne 0x8dd1
jmp 0x8df2
testq %rdi, %rdi
je 0x8e03
movsd %xmm2, 0x50(%rsp)
callq 0x2260
movsd 0x50(%rsp), %xmm2
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x8e1e
movsd %xmm2, 0x50(%rsp)
callq 0x2260
movsd 0x50(%rsp), %xmm2
ucomisd 0x18(%r12), %xmm2
jbe 0x8e45
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbp, %rdx
jbe 0x9047
movl %r15d, (%rax,%rbp,4)
movq (%r12), %r12
cmpq %rbx, %r12
jne 0x8cff
movq (%rsp), %r12
cmpq %rbx, %r12
je 0x8e6f
movq (%r12), %r13
movq %r12, %rdi
callq 0x2260
movq %r13, %r12
cmpq %rbx, %r13
jne 0x8e5b
incq %r15
movslq (%r14), %rax
cmpq %rax, %r15
leaq 0x80(%rsp), %r13
jl 0x8ade
leaq 0xb0(%rsp), %r15
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
callq 0x54c2
movq %r14, %rdi
movq %r15, %rsi
callq 0xa1f2
movl 0x5c(%rsp), %r12d
movl %eax, %ebp
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x8ebf
callq 0x2260
movsd 0x30(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
cmpl %r12d, %ebp
jne 0x8acd
cmpl $0x0, 0x4(%r14)
jle 0x8fde
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
xorl %r13d, %r13d
leaq 0x98(%rsp), %r12
xorl %r15d, %r15d
xorl %ebx, %ebx
subq %rax, %rcx
sarq $0x2, %rcx
movq %rcx, %rdx
cmpq %r15, %rcx
jbe 0x907a
cmpl $-0x1, (%rax,%r15,4)
jne 0x8f83
movq 0x48(%r14), %rsi
movq 0x50(%r14), %rdx
subq %rsi, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
cmpq %r15, %rdx
jbe 0x907a
addq %r13, %rsi
movq %r12, %rdi
callq 0x393a
movq %r14, %rdi
movq %r12, %rsi
callq 0x96c4
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
jbe 0x908b
movl %eax, (%rcx,%r15,4)
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x8f83
callq 0x2260
movq 0x60(%r14), %rsi
movq 0x68(%r14), %rdx
subq %rsi, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
jbe 0x907a
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
jbe 0x907a
movl (%rsi,%r15,4), %edx
xorl %esi, %esi
cmpl (%rax,%r15,4), %edx
setne %sil
addl %esi, %ebx
incq %r15
movslq 0x4(%r14), %rdx
addq $0x18, %r13
cmpq %rdx, %r15
jl 0x8efd
jmp 0x8fe0
xorl %ebx, %ebx
addq $0x60, %r14
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0x58de
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9000
callq 0x2260
movl %ebx, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x230a(%rip), %rdi      # 0xb325
movq %rbp, %rsi
xorl %eax, %eax
callq 0x2370
leaq 0x22f9(%rip), %rdi      # 0xb325
movq %rbp, %rsi
xorl %eax, %eax
callq 0x2370
leaq 0x22e8(%rip), %rdi      # 0xb325
movq %r13, %rsi
xorl %eax, %eax
callq 0x2370
leaq 0x22d7(%rip), %rdi      # 0xb325
movq %rbp, %rsi
xorl %eax, %eax
callq 0x2370
leaq 0x22c6(%rip), %rdi      # 0xb325
movq %r15, %rsi
xorl %eax, %eax
callq 0x2370
leaq 0x22b5(%rip), %rdi      # 0xb325
movq %r15, %rsi
xorl %eax, %eax
callq 0x2370
leaq 0x22a4(%rip), %rdi      # 0xb325
movq %r15, %rsi
xorl %eax, %eax
callq 0x2370
leaq 0x2293(%rip), %rdi      # 0xb325
movq %r15, %rsi
xorl %eax, %eax
callq 0x2370
jmp 0x90ca
jmp 0x90ca
jmp 0x90a2
movq %rax, %r14
movq 0x98(%rsp), %rdi
jmp 0x90bc
jmp 0x90ca
movq %rax, %r14
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x9129
callq 0x2260
jmp 0x9129
jmp 0x90ca
movq %rax, %r14
jmp 0x9129
movq %rax, %r14
movq 0xc8(%rsp), %rdi
jmp 0x90ff
jmp 0x910d
jmp 0x910d
movq %rax, %r14
movq 0x80(%rsp), %rdi
jmp 0x90ff
jmp 0x910d
jmp 0x910d
jmp 0x910d
jmp 0x910d
jmp 0x90f7
movq %rax, %r14
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x9110
callq 0x2260
jmp 0x9110
jmp 0x910d
movq %rax, %r14
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x9129
movq (%rdi), %r15
callq 0x2260
movq %r15, %rdi
cmpq %rbx, %r15
jne 0x9119
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9138
callq 0x2260
movq %r14, %rdi
callq 0x2450