// File: /workspace/github_cpp_makefile_star2_O2/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, 0x2c(%rsp)
leaq 0x40(%rsp), %rdi
pushq $0x2
popq %rdx
movl %edx, %esi
callq 0xa834
movq %rsp, %r12
andq $0x0, 0x10(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
xorl %ebx, %ebx
leaq 0x30(%rsp), %r13
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0x1134e
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
cvtsi2ss %ecx, %xmm0
movss %xmm0, 0x30(%rsp)
movl %eax, 0x34(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x11636
incq %rbx
jmp 0x11307
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
leaq -0x3a5(%rip), %rdx      # 0x10fb9
callq 0x11de9
movq (%rsp), %rax
cvtss2sd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x40(%rsp), %r12
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0x113b7
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 0xab42
incq %rbx
jmp 0x11378
xorl %edx, %edx
pushq $0x1
popq %r13
leaq 0x40(%rsp), %r12
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x2, %rsi
cmpq %r13, %rsi
jbe 0x114b4
movq (%rsp), %rsi
cvtss2sd (%rsi,%r13,8), %xmm0
movsd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x113f1
jnp 0x114ac
movslq %edx, %rbx
cmpq %r13, %rbx
jge 0x1144d
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
xorps 0x2724(%rip), %xmm0     # 0x13b40
movq %r12, %rdi
callq 0xab42
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 0xab62
incq %rbx
jmp 0x113f4
movq (%rsp), %rax
movss (%rax,%r13,8), %xmm0
movss %xmm0, 0x28(%rsp)
leaq 0x2c(%rsp), %rdi
movq %r12, %rsi
callq 0x101dc
movapd %xmm0, %xmm1
cvtss2sd 0x28(%rsp), %xmm2
movsd 0x20(%rsp), %xmm0
addsd %xmm2, %xmm0
mulsd 0x1b8a(%rip), %xmm0     # 0x13010
movq 0x38(%rsp), %rdi
movl %ebp, %esi
callq 0x105c6
movq (%rsp), %rax
cvtss2sd (%rax,%r13,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq (%r14), %rax
movq 0x8(%r14), %rcx
movl %r13d, %edx
incq %r13
jmp 0x113c2
movq %rsp, %rdi
callq 0x11c72
leaq 0x40(%rsp), %rdi
callq 0xa982
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x114e0
jmp 0x114e0
jmp 0x114e0
jmp 0x114e0
movq %rax, %rbx
movq %rsp, %rdi
callq 0x11c72
leaq 0x40(%rsp), %rdi
callq 0xa982
movq %rbx, %rdi
callq 0x3330
nop