// File: /workspace/github_cpp_makefile_star2_O1/0asa[P]TTree-source/Scorer.cpp
// Function: Scorer::getBestNumericalScore(std::vector<unsigned int, std::allocator<unsigned int>>&, unsigned int, ScoreInfo&)
void Scorer::getBestNumericalScore(std::vector<unsigned int> &obj, unsigned int att, ScoreInfo &si) {		
	Score score;
	ContingencyTable ctable(2,2);
	std::vector<TUPLET> values;
	for (int i = 0 ; i < obj.size() ; ++i) {
		TUPLET a; a.value = db->getAttVal(obj[i], att) ; a.ind = obj[i];
		values.push_back(a);
	}
	sort(values.begin(), values.end(),cmp);
	double th = -1.0;
	double v = values[0].value;
	// init ctable
	for (int i = 0 ; i < obj.size() ; ++i)
		ctable.addGeq(db->getOutput(values[i].ind), db->getWeight(values[i].ind));
	int lasti = 0;
	for (int i = 1 ; i < obj.size() ; ++i) {		
		// test des scores aux valeurs intermédiaires
		if (v != values[i].value) {
			// mise a jour incrémentale de la ctable !
			for (int j = lasti ; j < i ; ++j) {
				ctable.addGeq (db->getOutput(values[j].ind) , -db->getWeight(values[j].ind));
				ctable.addLess(db->getOutput(values[j].ind) ,  db->getWeight(values[j].ind));
			}

			th = (v+values[i].value)/2.0 ;
			si.update(att,th,score.getScore(ctable));
			v = values[i].value;
			lasti = i;
		}
	}	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rcx, 0x38(%rsp)
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, 0x34(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x2, %esi
movl $0x2, %edx
callq 0xc278
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x1458d
xorl %ebx, %ebx
movq %rsp, %r12
leaq 0x28(%rsp), %r13
movq (%r15), %rcx
movl (%rax,%rbx,4), %eax
movl 0x24(%rcx), %edx
imull %eax, %edx
addl %ebp, %edx
movq 0x40(%rcx), %rcx
movswl (%rcx,%rdx,2), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, 0x28(%rsp)
movl %eax, 0x2c(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x1456c
movq 0x28(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x14577
movq %r12, %rdi
movq %r13, %rdx
callq 0x14f50
incq %rbx
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
ja 0x14529
movq (%rsp), %r12
movq 0x8(%rsp), %r13
cmpq %r13, %r12
je 0x145d6
movq %r13, %rax
subq %r12, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x4f9(%rip), %rcx      # 0x140c0
movq %r12, %rdi
movq %r13, %rsi
callq 0x1508b
leaq -0x50b(%rip), %rdx      # 0x140c0
movq %r12, %rdi
movq %r13, %rsi
callq 0x151bc
movq (%rsp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x1462e
xorl %ebx, %ebx
leaq 0x40(%rsp), %r12
movq (%r15), %rax
movq (%rsp), %rcx
movl 0x4(%rcx,%rbx,8), %ecx
movq 0x8(%rax), %rdx
movq 0x28(%rax), %rax
movswl (%rax,%rcx,2), %esi
movsd (%rdx,%rcx,8), %xmm0
movq %r12, %rdi
callq 0xc624
incq %rbx
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
ja 0x145f7
movq 0x8(%r14), %rax
subq (%r14), %rax
cmpq $0x5, %rax
movsd 0x20(%rsp), %xmm1
jb 0x1473c
xorl %eax, %eax
movl $0x1, %ebx
leaq 0x40(%rsp), %r12
movq (%rsp), %rcx
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%rbx,8), %xmm0
ucomisd %xmm0, %xmm1
jne 0x14669
jnp 0x14725
movsd %xmm1, 0x20(%rsp)
movslq %eax, %r13
cmpq %r13, %rbx
jle 0x146d0
movq (%r15), %rax
movq (%rsp), %rcx
movl 0x4(%rcx,%r13,8), %ecx
movq 0x8(%rax), %rdx
movq 0x28(%rax), %rax
movswl (%rax,%rcx,2), %esi
movsd (%rdx,%rcx,8), %xmm0
xorps 0x24b5(%rip), %xmm0     # 0x16b50
movq %r12, %rdi
callq 0xc624
movq (%r15), %rax
movq (%rsp), %rcx
movl 0x4(%rcx,%r13,8), %ecx
movq 0x8(%rax), %rdx
movq 0x28(%rax), %rax
movswl (%rax,%rcx,2), %esi
movsd (%rdx,%rcx,8), %xmm0
movq %r12, %rdi
callq 0xc644
incq %r13
cmpq %r13, %rbx
jne 0x14677
movq (%rsp), %rax
movss (%rax,%rbx,8), %xmm0
movss %xmm0, 0x30(%rsp)
leaq 0x34(%rsp), %rdi
movq %r12, %rsi
callq 0x13090
movapd %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x30(%rsp), %xmm2
movsd 0x20(%rsp), %xmm0
addsd %xmm2, %xmm0
mulsd 0x1905(%rip), %xmm0     # 0x16010
movq 0x38(%rsp), %rdi
movl %ebp, %esi
callq 0x13570
movq (%rsp), %rax
xorps %xmm1, %xmm1
cvtss2sd (%rax,%rbx,8), %xmm1
movl %ebx, %eax
incq %rbx
movq 0x8(%r14), %rcx
subq (%r14), %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
ja 0x14651
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x14752
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x40(%rsp), %rdi
callq 0xc428
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14776
jmp 0x14776
jmp 0x14776
jmp 0x14776
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1478f
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x40(%rsp), %rdi
callq 0xc428
movq %rbx, %rdi
callq 0x3320
nop