// File: /workspace/github_cpp_makefile_star2_O3/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, 0x44(%rsp)
leaq 0x60(%rsp), %rdi
movl $0x2, %esi
movl $0x2, %edx
callq 0xc280
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x141c3
xorl %ebp, %ebp
leaq 0x20(%rsp), %r14
movq %rsp, %r13
movq (%r12), %rcx
movl (%rax,%rbp,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 0x1414c
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x14157
movq %r14, %rdi
movq %r13, %rdx
callq 0x14ee2
incq %rbp
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
ja 0x1410a
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
cmpq %rbp, %r13
je 0x141c8
movq %rbp, %rax
subq %r13, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x15e(%rip), %rcx      # 0x1403c
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1501d
leaq -0x170(%rip), %rdx      # 0x1403c
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1514e
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
jmp 0x141c8
xorl %r13d, %r13d
xorl %ebp, %ebp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %rbp, %rax
subq %r13, %rax
cmpq $0x9, %rax
jb 0x1435c
xorps %xmm0, %xmm0
cvtss2sd (%r13), %xmm0
movl $0x1, %r14d
xorps %xmm1, %xmm1
cvtss2sd (%r13,%r14,8), %xmm1
ucomisd %xmm1, %xmm0
jne 0x14209
jnp 0x14257
addsd %xmm1, %xmm0
mulsd 0x1dfb(%rip), %xmm0     # 0x16010
movsd %xmm0, 0x58(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x14236
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x1424d
movq %rsp, %rdi
leaq 0x58(%rsp), %rdx
callq 0xcfea
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
xorps %xmm0, %xmm0
cvtss2sd (%r13,%r14,8), %xmm0
incq %r14
movq %rbp, %rax
subq %r13, %rax
sarq $0x3, %rax
cmpq %r14, %rax
ja 0x141f7
movq (%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x1434a
callq 0x30a0
cltq
movq (%rsp), %rcx
movq 0x8(%rsp), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
xorl %edx, %edx
divq %rsi
movq (%r15), %rax
movslq %edx, %r13
shlq $0x3, %r13
cmpq %rax, 0x8(%r15)
je 0x14316
xorl %ebp, %ebp
leaq 0x60(%rsp), %r14
movq (%r12), %rcx
movl (%rax,%rbp,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,%r13), %xmm1
ucomisd %xmm0, %xmm1
movq 0x8(%rcx), %rdx
movq 0x28(%rcx), %rcx
movswl (%rcx,%rax,2), %esi
movsd (%rdx,%rax,8), %xmm0
jbe 0x142f4
movq %r14, %rdi
callq 0xc64c
jmp 0x142fc
movq %r14, %rdi
callq 0xc62c
incq %rbp
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
ja 0x142ab
movq (%rsp), %rcx
movsd (%rcx,%r13), %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0x44(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1300c
movaps %xmm0, %xmm1
movq 0x50(%rsp), %rdi
movl %ebx, %esi
movsd 0x48(%rsp), %xmm0
callq 0x134f4
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1435c
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14373
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x60(%rsp), %rdi
callq 0xc430
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14395
jmp 0x143b0
jmp 0x14395
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x143b3
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0x143b3
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x143ca
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x60(%rsp), %rdi
callq 0xc430
movq %rbx, %rdi
callq 0x3320