// File: /workspace/github_cpp_makefile_star2_O3/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 0xc280
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x146e2
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 0x144dc
movq 0x28(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x144e7
movq %r12, %rdi
movq %r13, %rdx
callq 0x14ee2
incq %rbx
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
ja 0x14499
movq (%rsp), %r13
movq 0x8(%rsp), %r12
cmpq %r12, %r13
je 0x14554
movq %r12, %rax
subq %r13, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x4f0(%rip), %rcx      # 0x1403c
movq %r13, %rdi
movq %r12, %rsi
callq 0x1501d
leaq -0x502(%rip), %rdx      # 0x1403c
movq %r13, %rdi
movq %r12, %rsi
callq 0x1514e
movq (%rsp), %r13
movq (%r14), %rax
movq 0x8(%r14), %rcx
cmpq %rax, %rcx
je 0x146d2
xorps %xmm0, %xmm0
cvtss2sd (%r13), %xmm0
movsd %xmm0, 0x20(%rsp)
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 0xc62c
incq %rbx
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
movq %rdx, %rsi
sarq $0x2, %rsi
cmpq %rbx, %rsi
ja 0x14573
movq (%rsp), %r13
cmpq $0x5, %rdx
jb 0x146cd
xorl %edx, %edx
movl $0x1, %ebx
leaq 0x40(%rsp), %r12
movss (%r13,%rbx,8), %xmm0
movss %xmm0, 0x1c(%rsp)
cvtss2sd %xmm0, %xmm0
movsd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x145f0
jnp 0x146b5
movslq %edx, %r13
cmpq %r13, %rbx
jle 0x14660
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 0x2534(%rip), %xmm0     # 0x16b50
movq %r12, %rdi
callq 0xc62c
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 0xc64c
incq %r13
cmpq %r13, %rbx
jne 0x145f8
movq (%rsp), %rax
movss (%rax,%rbx,8), %xmm0
movss %xmm0, 0x1c(%rsp)
leaq 0x34(%rsp), %rdi
movq %r12, %rsi
callq 0x1300c
movapd %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x1c(%rsp), %xmm2
movsd 0x20(%rsp), %xmm0
addsd %xmm2, %xmm0
mulsd 0x1984(%rip), %xmm0     # 0x16010
movq 0x38(%rsp), %rdi
movl %ebp, %esi
callq 0x134f4
movq (%rsp), %r13
xorps %xmm0, %xmm0
cvtss2sd (%r13,%rbx,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq (%r14), %rax
movq 0x8(%r14), %rcx
movl %ebx, %edx
incq %rbx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x2, %rsi
cmpq %rbx, %rsi
ja 0x145cd
jmp 0x146d2
testq %r13, %r13
je 0x146e2
movq 0x10(%rsp), %rsi
subq %r13, %rsi
movq %r13, %rdi
callq 0x3210
leaq 0x40(%rsp), %rdi
callq 0xc430
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14706
jmp 0x14706
jmp 0x14706
jmp 0x14706
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1471f
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x40(%rsp), %rdi
callq 0xc430
movq %rbx, %rdi
callq 0x3320
nop