// File: CK7[P]abawaca/src/ClusterSeparatorBySensitivitySpecificity.cpp
// Function: ClusterSeparatorBySensitivitySpecificity::separate_specific(ClusterSeparatorBySensitivitySpecificity::ClusterStats&, ClusterSeparatorBySensitivitySpecificity::ClusterStats&, unsigned long, double, ClusterSeparatorBySensitivitySpecificity::ClusteringResult&)
void ClusterSeparatorBySensitivitySpecificity::separate_specific(ClusterStats& curr_cluster1, ClusterStats& curr_cluster2, size_t dimension_index, double tested_value,
	ClusterSeparatorBySensitivitySpecificity::ClusteringResult& best_dimension_separation)
{
	// Which one is smaller in terms of the number of datapoints that will be considered 
	// for the clustering?
	if((curr_cluster1.num_useful_ndps() < this->cluster_ndps_threshold) || (curr_cluster2.num_useful_ndps() < this->cluster_ndps_threshold))
		return;

	// Now pick the smaller cluster, we will compute sensitivity and specificity on that one
	const ClusterStats& small_cluster = (curr_cluster1.num_useful_ndps() < curr_cluster2.num_useful_ndps())? curr_cluster1 : curr_cluster2;
	const ClusterStats& large_cluster = (curr_cluster1.num_useful_ndps() >= curr_cluster2.num_useful_ndps())? curr_cluster1 : curr_cluster2;

	ClusterSeparatorBySensitivitySpecificity::ClusteringResult	cr(dimension_index, tested_value, small_cluster.get_sensitivity(), small_cluster.get_specificity());
	if(cr.is_better(best_dimension_separation) && cq.is_split_better(small_cluster.get_cluster(), large_cluster.get_cluster()))
		best_dimension_separation.copy(cr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x90(%rbp), %rcx
cltq
cmpq 0xb0(%rcx), %rax
jb 0x28187
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x90(%rbp), %rcx
cltq
cmpq 0xb0(%rcx), %rax
jae 0x2818c
jmp 0x282e4
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, -0x94(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, %ecx
movl -0x94(%rbp), %eax
cmpl %ecx, %eax
jge 0x281bf
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0x281ca
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, -0xa4(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, %ecx
movl -0xa4(%rbp), %eax
cmpl %ecx, %eax
jl 0x28208
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x28213
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xc8(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0x38(%rbp), %rdi
callq 0x287b0
movsd %xmm0, -0xc0(%rbp)
movq -0x38(%rbp), %rdi
callq 0x287d0
movq -0xc8(%rbp), %rsi
movsd -0xc0(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0xb8(%rbp), %xmm0
leaq -0x88(%rbp), %rdi
callq 0x28800
movq -0x30(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0xbb70
testb $0x1, %al
jne 0x2828c
jmp 0x282e4
movq -0x90(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x38(%rbp), %rdi
callq 0x28680
movq %rax, -0xd0(%rbp)
movq -0x40(%rbp), %rdi
callq 0x28680
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq %rax, %rdx
callq 0x32be0
testb $0x1, %al
jne 0x282d3
jmp 0x282e4
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
leaq -0x88(%rbp), %rsi
callq *0x8(%rax)
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)