// File: /workspace/github_cpp_makefile_star2_O1/CK7[P]abawaca/src/ClusterSeparator.cpp
// Function: ClusterSeparator::reconstruct_best_clusters()
void ClusterSeparator::reconstruct_best_clusters()
{
	if(!this->is_best_separation_legal())
		return;

	const Dimension& 		dimension = clustering_db.get_dimension(this->get_separating_dimension());

	this->cluster1 = new Cluster(scaf_db);
	this->cluster2 = new Cluster(scaf_db);

	size_t cluster1_useful_ndps=0, cluster2_useful_ndps=0;
	for(vector<Dimension::DataPoint>::const_iterator vit = dimension.begin(); vit!=dimension.end(); vit++) {
		int useful = (scaf_db.ndps(scaf_db.dp2scaf(vit->dp)) > 1)? 1 : 0;

		if(vit->value <= this->get_separating_value()) {
			*(this->cluster1) += vit->dp;
			cluster1_useful_ndps += useful;
		}
		else {
			*(this->cluster2) += vit->dp;
			cluster2_useful_ndps += useful;
		}
	}

	if(cluster2_useful_ndps < cluster1_useful_ndps) {
		Cluster* temp = this->cluster1;
		this->cluster1 = this->cluster2;
		this->cluster2 = temp;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xa8(%rdi), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
testb %al, %al
je 0x12c9f
movq 0x18(%rbx), %rdi
movq 0xa8(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0xff94
movq %rax, %r15
movl $0xa0, %edi
callq 0x53a0
movq 0x8(%rbx), %r14
movq %r14, (%rax)
leaq 0x10(%rax), %rcx
xorl %r12d, %r12d
movl %r12d, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x28(%rax)
movq %r12, 0x30(%rax)
leaq 0x68(%rax), %rcx
movq %rcx, 0x38(%rax)
movl $0x1, %ecx
movq %rcx, 0x40(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x48(%rax)
movl $0x3f800000, %r13d      # imm = 0x3F800000
movl %r13d, 0x58(%rax)
movupd %xmm0, 0x60(%rax)
leaq 0x78(%rax), %rcx
movl %r12d, 0x78(%rax)
movq %r12, 0x80(%rax)
movq %rcx, 0x88(%rax)
movq %rcx, 0x90(%rax)
movq %r12, 0x98(%rax)
movq %rax, 0x28(%rbx)
movl $0xa0, %edi
callq 0x53a0
movq %r14, (%rax)
leaq 0x10(%rax), %rcx
movl %r12d, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x28(%rax)
movq %r12, 0x30(%rax)
leaq 0x68(%rax), %rcx
movq %rcx, 0x38(%rax)
movl $0x1, %ecx
movq %rcx, 0x40(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x48(%rax)
movl %r13d, 0x58(%rax)
movupd %xmm0, 0x60(%rax)
leaq 0x78(%rax), %rcx
movl %r12d, 0x78(%rax)
movq %r12, 0x80(%rax)
movq %rcx, 0x88(%rax)
movq %rcx, 0x90(%rax)
movq %r12, 0x98(%rax)
movq %rax, 0x30(%rbx)
movq 0x60(%r15), %r13
movl $0x0, %r14d
movq %r15, -0x30(%rbp)
cmpq 0x68(%r15), %r13
je 0x12c8a
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x8(%rbx), %r15
movq (%r13), %rsi
movq %r15, %rdi
callq 0xcd08
movq %r15, %rdi
movq %rax, %rsi
callq 0xcdbe
xorl %r15d, %r15d
cmpq $0x2, %rax
setae %r15b
movq 0xa8(%rbx), %rax
movsd 0x10(%rax), %xmm0
ucomisd 0x8(%r13), %xmm0
movq (%r13), %rsi
jae 0x12c70
movq 0x30(%rbx), %rdi
callq 0x12330
addq %r15, %r12
jmp 0x12c7c
movq 0x28(%rbx), %rdi
callq 0x12330
addq %r15, %r14
addq $0x10, %r13
movq -0x30(%rbp), %rax
cmpq 0x68(%rax), %r13
jne 0x12c24
cmpq %r14, %r12
jae 0x12c9f
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
movq %rcx, 0x28(%rbx)
movq %rax, 0x30(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq