// File: 0asa[P]TTree-source/Scorer.cpp
// Function: Scorer::getRandNumericalScore(std::vector<unsigned int, std::allocator<unsigned int>>&, unsigned int, ScoreInfo&)
void Scorer::getRandNumericalScore(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];
		//printf("%d > %f\n",db->getAttVal(obj[i], att),a.value);
		values.push_back(a);
	}
	sort(values.begin(), values.end(),cmp);

	// get all the possible tresholds on values
	std::vector<double> th;
	double v = values[0].value;
	for (int i = 1 ; i < values.size() ; ++i) {
		if (v != values[i].value) {
			th.push_back((v+values[i].value)/2.0);
			v = values[i].value;
		}
	}
	if (th.size() > 0) {
	int r = rand() % th.size(); // got a random treshold
	// now use it to fill the ctable
	for (int i = 0 ; i < obj.size() ; ++i) {
		if (db->getAttVal(obj[i], att) < th[r])
			ctable.addLess(db->getOutput(obj[i]), db->getWeight(obj[i]));
		else
			ctable.addGeq(db->getOutput(obj[i]), db->getWeight(obj[i]));
	}
	si.update(att,th[r],score.getScore(ctable));
	}
}

// Assembly:
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdi, 0x1f0(%rsp)
movq %rsi, 0x1e8(%rsp)
movl %edx, 0x1e4(%rsp)
movq %rcx, 0x1d8(%rsp)
movq 0x1f0(%rsp), %rax
movq %rax, 0xd0(%rsp)
leaq 0x1d4(%rsp), %rdi
callq 0xcdf0
leaq 0x158(%rsp), %rdi
movl $0x2, %edx
movl %edx, %esi
callq 0x16b40
jmp 0x28589
leaq 0x130(%rsp), %rdi
callq 0x296a0
movl $0x0, 0x12c(%rsp)
movslq 0x12c(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x1e8(%rsp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq 0xc8(%rsp), %rax
cmpq %rcx, %rax
jae 0x286af
movq 0xd0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xb8(%rsp)
movq 0x1e8(%rsp), %rdi
movslq 0x12c(%rsp), %rsi
callq 0xcd80
movq 0xb8(%rsp), %rdi
movl (%rax), %esi
movl 0x1e4(%rsp), %edx
callq 0x16a20
movw %ax, 0xc6(%rsp)
jmp 0x2861a
movw 0xc6(%rsp), %ax
cwtl
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x124(%rsp)
movq 0x1e8(%rsp), %rdi
movslq 0x12c(%rsp), %rsi
callq 0xcd80
movl (%rax), %eax
movl %eax, 0x128(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x124(%rsp), %rsi
callq 0x296b0
jmp 0x28665
jmp 0x28667
movl 0x12c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x12c(%rsp)
jmp 0x285a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x28b96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x28b7c
leaq 0x130(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x29770
movq 0xb0(%rsp), %rdi
movq %rax, 0x118(%rsp)
callq 0x297a0
movq %rax, 0x110(%rsp)
movq 0x118(%rsp), %rdi
movq 0x110(%rsp), %rsi
leaq -0x2d8(%rip), %rdx      # 0x28420
callq 0x29720
jmp 0x286ff
leaq 0xf8(%rsp), %rdi
callq 0xca90
leaq 0x130(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x297d0
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xf0(%rsp)
movl $0x1, 0xec(%rsp)
movslq 0xec(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x29850
movq %rax, %rcx
movq 0xa8(%rsp), %rax
cmpq %rcx, %rax
jae 0x2887d
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movslq 0xec(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0x297d0
movsd 0xa0(%rsp), %xmm0
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x287af
jp 0x287af
jmp 0x28865
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
movslq 0xec(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0x297d0
movsd 0x98(%rsp), %xmm0
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd 0x781d(%rip), %xmm1     # 0x30010
mulsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x17880
jmp 0x28817
movslq 0xec(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0x297d0
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xf0(%rsp)
jmp 0x28865
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xcaa0
jmp 0x28b7c
jmp 0x28867
movl 0xec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xec(%rsp)
jmp 0x28739
leaq 0xf8(%rsp), %rdi
callq 0xab40
cmpq $0x0, %rax
jbe 0x28b40
callq 0x30b0
cltq
movq %rax, 0x90(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xab40
movq %rax, %rcx
movq 0x90(%rsp), %rax
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, 0xdc(%rsp)
movl $0x0, 0xd8(%rsp)
movslq 0xd8(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x1e8(%rsp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq 0x88(%rsp), %rax
cmpq %rcx, %rax
jae 0x28ace
movq 0xd0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x1e8(%rsp), %rdi
movslq 0xd8(%rsp), %rsi
callq 0xcd80
movq 0x78(%rsp), %rdi
movl (%rax), %esi
movl 0x1e4(%rsp), %edx
callq 0x16a20
movw %ax, 0x86(%rsp)
jmp 0x28947
movw 0x86(%rsp), %ax
cwtl
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x70(%rsp)
movslq 0xdc(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0xcda0
movsd 0x70(%rsp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x28a1e
movq 0xd0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x1e8(%rsp), %rdi
movslq 0xd8(%rsp), %rsi
callq 0xcd80
movq 0x60(%rsp), %rdi
movl (%rax), %esi
callq 0xcdc0
movw %ax, 0x6e(%rsp)
jmp 0x289bb
movq 0xd0(%rsp), %rax
movw 0x6e(%rsp), %cx
movswl %cx, %ecx
movl %ecx, 0x4c(%rsp)
movq (%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x1e8(%rsp), %rdi
movslq 0xd8(%rsp), %rsi
callq 0xcd80
movq 0x50(%rsp), %rdi
movl (%rax), %esi
callq 0xcd50
movsd %xmm0, 0x58(%rsp)
jmp 0x28a00
movsd 0x58(%rsp), %xmm0
movl 0x4c(%rsp), %esi
leaq 0x158(%rsp), %rdi
callq 0x170f0
jmp 0x28a19
jmp 0x28ab6
movq 0xd0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x1e8(%rsp), %rdi
movslq 0xd8(%rsp), %rsi
callq 0xcd80
movq 0x40(%rsp), %rdi
movl (%rax), %esi
callq 0xcdc0
movw %ax, 0x4a(%rsp)
jmp 0x28a56
movq 0xd0(%rsp), %rax
movw 0x4a(%rsp), %cx
movswl %cx, %ecx
movl %ecx, 0x2c(%rsp)
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x1e8(%rsp), %rdi
movslq 0xd8(%rsp), %rsi
callq 0xcd80
movq 0x30(%rsp), %rdi
movl (%rax), %esi
callq 0xcd50
movsd %xmm0, 0x38(%rsp)
jmp 0x28a9b
movsd 0x38(%rsp), %xmm0
movl 0x2c(%rsp), %esi
leaq 0x158(%rsp), %rdi
callq 0x17090
jmp 0x28ab4
jmp 0x28ab6
jmp 0x28ab8
movl 0xd8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd8(%rsp)
jmp 0x288d4
movq 0x1d8(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x1e4(%rsp), %eax
movl %eax, 0x14(%rsp)
movslq 0xdc(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0xcda0
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x1d4(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x26490
movsd %xmm0, 0x20(%rsp)
jmp 0x28b22
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
movl 0x14(%rsp), %esi
movq 0x8(%rsp), %rdi
callq 0x26be0
jmp 0x28b3e
jmp 0x28b40
leaq 0xf8(%rsp), %rdi
callq 0xcaa0
leaq 0x130(%rsp), %rdi
callq 0x297f0
leaq 0x158(%rsp), %rdi
callq 0x16d70
leaq 0x1d4(%rsp), %rdi
callq 0xd410
addq $0x1f8, %rsp            # imm = 0x1F8
retq
leaq 0x130(%rsp), %rdi
callq 0x297f0
leaq 0x158(%rsp), %rdi
callq 0x16d70
leaq 0x1d4(%rsp), %rdi
callq 0xd410
movq 0x150(%rsp), %rdi
callq 0x33e0