// File: 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:
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, 0x1e0(%rsp)
movq %rsi, 0x1d8(%rsp)
movl %edx, 0x1d4(%rsp)
movq %rcx, 0x1c8(%rsp)
movq 0x1e0(%rsp), %rax
movq %rax, 0xd8(%rsp)
leaq 0x1c4(%rsp), %rdi
callq 0xcdf0
leaq 0x148(%rsp), %rdi
movl $0x2, %edx
movl %edx, %esi
callq 0x16b40
jmp 0x28cf9
leaq 0x120(%rsp), %rdi
callq 0x296a0
movl $0x0, 0x11c(%rsp)
movslq 0x11c(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x1d8(%rsp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq 0xd0(%rsp), %rax
cmpq %rcx, %rax
jae 0x28e39
movq 0xd8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xc0(%rsp)
movq 0x1d8(%rsp), %rdi
movslq 0x11c(%rsp), %rsi
callq 0xcd80
movq 0xc0(%rsp), %rdi
movl (%rax), %esi
movl 0x1d4(%rsp), %edx
callq 0x16a20
movw %ax, 0xce(%rsp)
jmp 0x28d8a
movw 0xce(%rsp), %ax
cwtl
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x114(%rsp)
movq 0x1d8(%rsp), %rdi
movslq 0x11c(%rsp), %rsi
callq 0xcd80
movl (%rax), %eax
movl %eax, 0x118(%rsp)
leaq 0x120(%rsp), %rdi
leaq 0x114(%rsp), %rsi
callq 0x296b0
jmp 0x28dd5
jmp 0x28dd7
movl 0x11c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x11c(%rsp)
jmp 0x28d11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x292e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x297f0
leaq 0x148(%rsp), %rdi
callq 0x16d70
jmp 0x292e7
leaq 0x120(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0x29770
movq 0xb8(%rsp), %rdi
movq %rax, 0x108(%rsp)
callq 0x297a0
movq %rax, 0x100(%rsp)
movq 0x108(%rsp), %rdi
movq 0x100(%rsp), %rsi
leaq -0xa62(%rip), %rdx      # 0x28420
callq 0x29720
jmp 0x28e89
movsd 0x7d2f(%rip), %xmm0     # 0x30bc0
movsd %xmm0, 0xf8(%rsp)
leaq 0x120(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x297d0
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xf0(%rsp)
movl $0x0, 0xec(%rsp)
movslq 0xec(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x1d8(%rsp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq 0xb0(%rsp), %rax
cmpq %rcx, %rax
jae 0x28fc6
movq 0xd8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xa0(%rsp)
movslq 0xec(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movq 0xa0(%rsp), %rdi
movl 0x4(%rax), %esi
callq 0xcdc0
movw %ax, 0xae(%rsp)
jmp 0x28f3a
movq 0xd8(%rsp), %rax
movw 0xae(%rsp), %cx
movswl %cx, %ecx
movl %ecx, 0x8c(%rsp)
movq (%rax), %rax
movq %rax, 0x90(%rsp)
movslq 0xec(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movq 0x90(%rsp), %rdi
movl 0x4(%rax), %esi
callq 0xcd50
movsd %xmm0, 0x98(%rsp)
jmp 0x28f8f
movsd 0x98(%rsp), %xmm0
movl 0x8c(%rsp), %esi
leaq 0x148(%rsp), %rdi
callq 0x17090
jmp 0x28fae
jmp 0x28fb0
movl 0xec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xec(%rsp)
jmp 0x28ec7
movl $0x0, 0xe8(%rsp)
movl $0x1, 0xe4(%rsp)
movslq 0xe4(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x1d8(%rsp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq 0x80(%rsp), %rax
cmpq %rcx, %rax
jae 0x292b8
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
movslq 0xe4(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movsd 0x78(%rsp), %xmm0
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2904c
jp 0x2904c
jmp 0x292a0
movl 0xe8(%rsp), %eax
movl %eax, 0xe0(%rsp)
movl 0xe0(%rsp), %eax
cmpl 0xe4(%rsp), %eax
jge 0x291c1
movq 0xd8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movslq 0xe0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movq 0x68(%rsp), %rdi
movl 0x4(%rax), %esi
callq 0xcdc0
movw %ax, 0x76(%rsp)
jmp 0x290a7
movq 0xd8(%rsp), %rax
movw 0x76(%rsp), %cx
movswl %cx, %ecx
movl %ecx, 0x54(%rsp)
movq (%rax), %rax
movq %rax, 0x58(%rsp)
movslq 0xe0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movq 0x58(%rsp), %rdi
movl 0x4(%rax), %esi
callq 0xcd50
movsd %xmm0, 0x60(%rsp)
jmp 0x290ed
movl 0x54(%rsp), %esi
movsd 0x60(%rsp), %xmm0
movaps 0x7af2(%rip), %xmm1     # 0x30bf0
pxor %xmm1, %xmm0
leaq 0x148(%rsp), %rdi
callq 0x17090
jmp 0x29111
movq 0xd8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x48(%rsp)
movslq 0xe0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movq 0x48(%rsp), %rdi
movl 0x4(%rax), %esi
callq 0xcdc0
movw %ax, 0x52(%rsp)
jmp 0x2914a
movq 0xd8(%rsp), %rax
movw 0x52(%rsp), %cx
movswl %cx, %ecx
movl %ecx, 0x34(%rsp)
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movslq 0xe0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movq 0x38(%rsp), %rdi
movl 0x4(%rax), %esi
callq 0xcd50
movsd %xmm0, 0x40(%rsp)
jmp 0x29190
movsd 0x40(%rsp), %xmm0
movl 0x34(%rsp), %esi
leaq 0x148(%rsp), %rdi
callq 0x170f0
jmp 0x291a9
jmp 0x291ab
movl 0xe0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe0(%rsp)
jmp 0x2905a
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0xe4(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movsd 0x8(%rsp), %xmm0
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd 0x6e11(%rip), %xmm1     # 0x30010
mulsd %xmm1, %xmm0
movsd %xmm0, 0xf8(%rsp)
movq 0x1c8(%rsp), %rax
movq %rax, 0x10(%rsp)
movl 0x1d4(%rsp), %eax
movl %eax, 0x1c(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x1c4(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x26490
movsd %xmm0, 0x28(%rsp)
jmp 0x29250
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
movl 0x1c(%rsp), %esi
movq 0x10(%rsp), %rdi
callq 0x26be0
jmp 0x2926c
movslq 0xe4(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x297d0
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xf0(%rsp)
movl 0xe4(%rsp), %eax
movl %eax, 0xe8(%rsp)
jmp 0x292a2
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
jmp 0x28fdc
leaq 0x120(%rsp), %rdi
callq 0x297f0
leaq 0x148(%rsp), %rdi
callq 0x16d70
leaq 0x1c4(%rsp), %rdi
callq 0xd410
addq $0x1e8, %rsp            # imm = 0x1E8
retq
leaq 0x1c4(%rsp), %rdi
callq 0xd410
movq 0x140(%rsp), %rdi
callq 0x33e0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)