// File: /workspace/github_cpp_makefile_star2_O2/0asa[P]TTree-source/ClassicTree.cpp
// Function: ClassicTree::learnET()
double ClassicTree::learnET() {
	clock_t clock_start = clock();
	Scorer s(db);
	std::vector<unsigned int> lsleft;
	std::vector<unsigned int> lsright;
	RandomStack stack; // IMPORTANT FOR TTREES WITH INTERNAL ET
	root = new Node();	root->setLS((*ls));	stack.push(root);
	while (!stack.empty() && complexity < maxcomplexity) {
		Node *n = stack.pop();
		std::vector<unsigned int> set = n->getLS();
		if (set.size() >= nmin) {
			std::vector<unsigned int> kcand;
			if (k > 0)
				kcand = Sampler::random((*cand),k);
			else
				kcand = (*cand); 
			ScoreInfo si = s.getRandScore(set,kcand);
			if (si.score > 0) {
				db->getLRSet(si,set,lsleft,lsright);
				n->setTest(si);
				Node *left  = new Node();	left->setParent(n);
				left->setDepth(n->getDepth()+1); // 09-07-2012
				left->setLS(lsleft);	n->setLeft(left);	stack.push(left);
				Node *right = new Node();	right->setParent(n);
				right->setDepth(n->getDepth()+1); // 09-07-2012
				right->setLS(lsright);	n->setRight(right);	stack.push(right);
				if (maxdepth < n->getDepth()+1) { maxdepth = n->getDepth()+1; }
				complexity++;
				// BEGIN-02-08-2012 : all nmin at once
				// need to attach vote at each node
				std::vector<double> vote(2,0.0);
				for (int i = 0 ; i < set.size() ; ++i)
					vote[db->getOutput(set[i])] += db->getWeight(set[i]);
				for (int i = 0 ; i < vote.size() ; ++i) 
					vote[i] /= set.size();
				n->setVote(vote);
				// END-02-08-2012
				//#ifdef NOLSFORTT // LS STORAGE ANNULATION
				std::vector<unsigned int> ls_null; n->setLS(ls_null);
				//#endif
			}
		}
	}
	// Clearing sets
	std::vector<unsigned int>().swap(lsleft);
	std::vector<unsigned int>().swap(lsright);
	createProbsInLeaf();
	return (clock() - clock_start);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %r14
callq 0x3140
movq %rax, 0x8(%rsp)
movq 0x8(%r14), %rsi
leaq 0x148(%rsp), %rdi
callq 0x10648
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xf198
pushq $0x60
popq %rdi
callq 0x3200
movq %rax, %r15
movq %rax, %rdi
callq 0xe460
movq %r15, 0x50(%r14)
movq 0x20(%r14), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x6c64
leaq 0xc8(%rsp), %rsi
movq %r15, %rdi
callq 0x8884
leaq 0xc8(%rsp), %rdi
callq 0x6886
movq 0x50(%r14), %rsi
leaq 0xb0(%rsp), %rdi
callq 0xf1a4
leaq 0xb0(%rsp), %r15
leaq 0x98(%rsp), %r12
movq %r15, %rdi
callq 0x12460
testb %al, %al
jne 0x9d35
movl 0x14(%r14), %eax
cmpl 0x18(%r14), %eax
jge 0x9d35
movq %r15, %rdi
callq 0x1244e
movq %rax, %rbx
movq %r12, %rdi
movq %rax, %rsi
callq 0x6c64
movq 0xa0(%rsp), %rax
subq 0x98(%rsp), %rax
sarq $0x2, %rax
movslq 0x10(%r14), %rcx
cmpq %rcx, %rax
jb 0x9d28
andq $0x0, 0x90(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x80(%rsp)
movl 0x58(%r14), %edx
testl %edx, %edx
je 0x9aa8
movq 0x30(%r14), %rsi
leaq 0xe0(%rsp), %rbp
movq %rbp, %rdi
callq 0x88a6
leaq 0x80(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x68a8
movq %rbp, %rdi
callq 0x6886
jmp 0x9ac4
movq 0x30(%r14), %rsi
leaq 0x80(%rsp), %r13
movq %r13, %rdi
callq 0x634c
leaq 0xe0(%rsp), %rbp
movq %rbp, %rdi
leaq 0x148(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0xa7bc
movsd 0x108(%rsp), %xmm0
ucomisd 0x9c15(%rip), %xmm0     # 0x13700
jbe 0x9d1b
movq 0x8(%r14), %rdi
leaq 0xe0(%rsp), %r13
movq %r13, %rsi
movq %r12, %rdx
leaq 0x30(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0xb54c
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe518
pushq $0x60
popq %rdi
callq 0x3200
movq %rax, %r13
movq %rax, %rdi
callq 0xe460
movq %r13, %rdi
movq %rbx, %rsi
callq 0xe5d4
movl 0x54(%rbx), %eax
incl %eax
movl %eax, 0x54(%r13)
leaq 0x130(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6c64
movq %r13, %rdi
leaq 0x130(%rsp), %rbp
movq %rbp, %rsi
callq 0x8884
movq %rbp, %rdi
callq 0x6886
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe5da
movq %r15, %rdi
movq %r13, %rsi
callq 0xf1a4
pushq $0x60
popq %rdi
callq 0x3200
movq %rax, %r13
movq %rax, %rdi
callq 0xe460
movq %r13, %rdi
movq %rbx, %rsi
callq 0xe5d4
movl 0x54(%rbx), %eax
incl %eax
movl %eax, 0x54(%r13)
leaq 0x118(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6c64
movq %r13, %rdi
leaq 0x118(%rsp), %rbp
movq %rbp, %rsi
callq 0x8884
movq %rbp, %rdi
callq 0x6886
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe5e0
movq %r15, %rdi
movq %r13, %rsi
callq 0xf1a4
movl 0x54(%rbx), %eax
incl %eax
cmpl %eax, 0x15c(%r14)
jae 0x9c06
movl %eax, 0x15c(%r14)
incl 0x14(%r14)
andq $0x0, 0x50(%rsp)
leaq 0x68(%rsp), %rdi
pushq $0x2
popq %rsi
leaq 0x50(%rsp), %rdx
leaq 0x7(%rsp), %rcx
callq 0x6cb2
movq 0x98(%rsp), %rcx
movq 0xa0(%rsp), %rax
subq %rcx, %rax
sarq $0x2, %rax
movq 0x8(%r14), %rdx
movq 0x68(%rsp), %rsi
xorl %edi, %edi
cmpq %rdi, %rax
je 0x9c76
movl (%rcx,%rdi,4), %r8d
movq 0x8(%rdx), %r9
movq 0x28(%rdx), %r10
movsd (%r9,%r8,8), %xmm0
movswq (%r10,%r8,2), %r8
addsd (%rsi,%r8,8), %xmm0
movsd %xmm0, (%rsi,%r8,8)
incq %rdi
jmp 0x9c49
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movq %rax, %xmm1
punpckldq 0x9a4c(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9a54(%rip), %xmm1     # 0x136f0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
xorl %eax, %eax
cmpq %rax, %rdx
je 0x9cc2
movsd (%rcx,%rax,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rax,8)
incq %rax
jmp 0x9caa
movq %rbx, %rdi
leaq 0x68(%rsp), %rsi
callq 0xe640
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
leaq 0x170(%rsp), %r13
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x6c64
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8884
movq %r13, %rdi
callq 0x6886
leaq 0x50(%rsp), %rdi
callq 0x6886
leaq 0x68(%rsp), %rdi
callq 0x6de4
leaq 0x80(%rsp), %rdi
callq 0x6886
movq %r12, %rdi
callq 0x6886
jmp 0x9a04
movaps 0x30(%rsp), %xmm0
leaq 0xe0(%rsp), %rbx
movaps %xmm0, (%rbx)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movq %rbx, %rdi
callq 0x6886
movapd 0x10(%rsp), %xmm0
movapd %xmm0, (%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rbx)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x6886
movq %r14, %rdi
callq 0x918e
callq 0x3140
subq 0x8(%rsp), %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xf19e
leaq 0x10(%rsp), %rdi
callq 0x6886
leaq 0x30(%rsp), %rdi
callq 0x6886
leaq 0x148(%rsp), %rdi
callq 0x1068c
movsd 0x8(%rsp), %xmm0
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0x9eb2
movq %rax, %rbx
pushq $0x60
popq %rsi
movq %r15, %rdi
callq 0x3210
jmp 0x9eb7
movq %rax, %rbx
jmp 0x9ec4
jmp 0x9e9a
movq %rax, %rbx
leaq 0x170(%rsp), %rdi
callq 0x6886
jmp 0x9e39
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x6886
jmp 0x9e48
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x6de4
jmp 0x9e9d
jmp 0x9e9a
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
jmp 0x9e70
jmp 0x9e77
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x6886
jmp 0x9e9d
movq %rax, %rbx
pushq $0x60
popq %rsi
movq %r13, %rdi
callq 0x3210
jmp 0x9e9d
jmp 0x9e93
jmp 0x9e9a
jmp 0x9e9a
jmp 0x9e9a
jmp 0x9e93
jmp 0x9e93
movq %rax, %rbx
jmp 0x9eb7
jmp 0x9e9a
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x6886
leaq 0x98(%rsp), %rdi
callq 0x6886
leaq 0xb0(%rsp), %rdi
callq 0xf19e
leaq 0x10(%rsp), %rdi
callq 0x6886
leaq 0x30(%rsp), %rdi
callq 0x6886
leaq 0x148(%rsp), %rdi
callq 0x1068c
movq %rbx, %rdi
callq 0x3330
nop