// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, 0x50(%rsp)
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r12
movl $0x1, 0x4c(%rsp)
leaq 0x60(%rsp), %rdi
movl $0x2, %esi
movl $0x2, %edx
callq 0xc278
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x141ef
xorl %r14d, %r14d
leaq 0x20(%rsp), %r13
movq %rsp, %rbp
movq (%r12), %rcx
movl (%rax,%r14,4), %eax
movl 0x24(%rcx), %edx
imull %eax, %edx
addl %ebx, %edx
movq 0x40(%rcx), %rcx
movswl (%rcx,%rdx,2), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, (%rsp)
movl %eax, 0x4(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x141ce
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x141d9
movq %r13, %rdi
movq %rbp, %rdx
callq 0x14f50
incq %r14
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
ja 0x1418b
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
cmpq %rbp, %r13
je 0x14239
movq %rbp, %rax
subq %r13, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x15c(%rip), %rcx      # 0x140c0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1508b
leaq -0x16e(%rip), %rdx      # 0x140c0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x151bc
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0x142f3
movq 0x20(%rsp), %rcx
xorps %xmm0, %xmm0
cvtss2sd (%rcx), %xmm0
movl $0x1, %r14d
movq %rsp, %r13
leaq 0x58(%rsp), %rbp
xorps %xmm1, %xmm1
cvtss2sd (%rax,%r14,8), %xmm1
ucomisd %xmm1, %xmm0
jne 0x1428b
jnp 0x142da
xorps %xmm1, %xmm1
cvtss2sd (%rax,%r14,8), %xmm1
addsd %xmm1, %xmm0
mulsd 0x1d70(%rip), %xmm0     # 0x16010
movsd %xmm0, 0x58(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x142c1
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x142cc
movq %r13, %rdi
movq %rbp, %rdx
callq 0xcfc2
movq 0x20(%rsp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax,%r14,8), %xmm0
incq %r14
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
ja 0x1427a
movq 0x8(%rsp), %rax
cmpq (%rsp), %rax
je 0x143da
callq 0x30a0
cltq
movq 0x8(%rsp), %rcx
subq (%rsp), %rcx
sarq $0x3, %rcx
xorl %edx, %edx
divq %rcx
movq %rdx, 0x40(%rsp)
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x143a2
movslq 0x40(%rsp), %r14
shlq $0x3, %r14
xorl %r13d, %r13d
leaq 0x60(%rsp), %rbp
movq (%r12), %rcx
movl (%rax,%r13,4), %eax
movl 0x24(%rcx), %edx
imull %eax, %edx
addl %ebx, %edx
movq 0x40(%rcx), %rsi
movswl (%rsi,%rdx,2), %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movq (%rsp), %rdx
movsd (%rdx,%r14), %xmm1
ucomisd %xmm0, %xmm1
movq 0x8(%rcx), %rdx
movq 0x28(%rcx), %rcx
movswl (%rcx,%rax,2), %esi
movsd (%rdx,%rax,8), %xmm0
jbe 0x14384
movq %rbp, %rdi
callq 0xc644
jmp 0x1438c
movq %rbp, %rdi
callq 0xc624
incq %r13
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r13, %rcx
ja 0x1433a
movq (%rsp), %rax
movslq 0x40(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
leaq 0x4c(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x13090
movaps %xmm0, %xmm1
movq 0x50(%rsp), %rdi
movl %ebx, %esi
movsd 0x40(%rsp), %xmm0
callq 0x13570
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x143f0
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14407
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x60(%rsp), %rdi
callq 0xc428
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1442e
jmp 0x14429
jmp 0x1442e
movq %rax, %rbx
jmp 0x14447
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x14447
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1445e
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x60(%rsp), %rdi
callq 0xc428
movq %rbx, %rdi
callq 0x3320