// File: /workspace/github_cpp_makefile_star2_O1/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 $0x178, %rsp            # imm = 0x178
movq %rdi, %r14
callq 0x3130
movq %rax, 0x58(%rsp)
movq 0x8(%r14), %rsi
leaq 0x150(%rsp), %rdi
callq 0x135c8
xorl %eax, %eax
movq %rax, 0x50(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq %rax, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
leaq 0x108(%rsp), %rdi
callq 0x11ef4
movl $0x60, %edi
callq 0x3200
movq %rax, %r15
movq %rax, %rdi
callq 0x1103c
movq %r15, 0x50(%r14)
movq 0x20(%r14), %rsi
leaq 0xd8(%rsp), %rdi
callq 0x7b1c
leaq 0xd8(%rsp), %rsi
movq %r15, %rdi
callq 0x7392
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
movl 0x58(%r15), %ecx
cmpq %rcx, %rax
jbe 0xb18c
movl %eax, 0x58(%r15)
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0xb1a9
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x50(%r14), %rsi
leaq 0x108(%rsp), %rdi
callq 0x11f00
leaq 0x108(%rsp), %r12
leaq 0x78(%rsp), %r13
leaq 0x120(%rsp), %rbx
movq %r12, %rdi
callq 0x1564e
testb %al, %al
jne 0xb622
movl 0x14(%r14), %eax
cmpl 0x18(%r14), %eax
jge 0xb622
movq %r12, %rdi
callq 0x1563c
movq %rax, %r15
movq %r13, %rdi
movq %rax, %rsi
callq 0x7b1c
movq 0x80(%rsp), %rax
subq 0x78(%rsp), %rax
sarq $0x2, %rax
movslq 0x10(%r14), %rcx
cmpq %rcx, %rax
jb 0xb5ff
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movl 0x58(%r14), %edx
testl %edx, %edx
je 0xb2b0
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x9ca2
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
movapd 0x120(%rsp), %xmm0
movapd %xmm0, (%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x10(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x120(%rsp)
movq $0x0, 0x130(%rsp)
testq %rdi, %rdi
je 0xb291
subq %rdi, %rsi
callq 0x3210
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xb2bc
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0xb2bc
movq 0x30(%r14), %rsi
movq %rsp, %rdi
callq 0x7392
movq 0x168(%rsp), %rax
movq 0x170(%rsp), %rsi
leaq 0x150(%rsp), %rcx
addq %rcx, %rsi
testb $0x1, %al
je 0xb2e3
movq (%rsi), %rcx
movq -0x1(%rcx,%rax), %rax
movq %rbx, %rdi
movq %r13, %rdx
movq %rsp, %rcx
callq *%rax
movsd 0x148(%rsp), %xmm0
ucomisd 0xb401(%rip), %xmm0     # 0x16700
jbe 0xb5e9
movq 0x8(%r14), %rdi
movq %rbx, %rsi
movq %r13, %rdx
leaq 0x40(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0xd616
movq %r15, %rdi
movq %rbx, %rsi
callq 0x11114
movl $0x60, %edi
callq 0x3200
movq %rax, %rbp
movq %rax, %rdi
callq 0x1103c
movq %rbp, %rdi
movq %r15, %rsi
callq 0x111d8
movl 0x54(%r15), %eax
incl %eax
movl %eax, 0x54(%rbp)
leaq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x7b1c
movq %rbp, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x7392
movq 0x8(%rbp), %rax
subq (%rbp), %rax
sarq $0x2, %rax
movl 0x58(%rbp), %ecx
cmpq %rcx, %rax
jbe 0xb38b
movl %eax, 0x58(%rbp)
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0xb3a8
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %r15, %rdi
movq %rbp, %rsi
callq 0x111de
movq %r12, %rdi
movq %rbp, %rsi
callq 0x11f00
movl $0x60, %edi
callq 0x3200
movq %rax, %rbp
movq %rax, %rdi
callq 0x1103c
movq %rbp, %rdi
movq %r15, %rsi
callq 0x111d8
movl 0x54(%r15), %eax
incl %eax
movl %eax, 0x54(%rbp)
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x7b1c
movq %rbp, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x7392
movq 0x8(%rbp), %rax
subq (%rbp), %rax
sarq $0x2, %rax
movl 0x58(%rbp), %ecx
cmpq %rcx, %rax
jbe 0xb420
movl %eax, 0x58(%rbp)
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0xb43d
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %r15, %rdi
movq %rbp, %rsi
callq 0x111e4
movq %r12, %rdi
movq %rbp, %rsi
callq 0x11f00
movl 0x54(%r15), %eax
incl %eax
cmpl %eax, 0x15c(%r14)
jae 0xb469
movl %eax, 0x15c(%r14)
incl 0x14(%r14)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movl $0x10, %edi
callq 0x3200
movq %rax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
movq %rax, %rsi
addq $0x10, %rsi
movq %rsi, 0x70(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq 0x78(%rsp), %rcx
movq 0x80(%rsp), %rdi
movq %rdi, %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
movq %rsi, 0x68(%rsp)
cmpq %rcx, %rdi
je 0xb506
movq 0x8(%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x28(%rdi), %rdi
cmpq $0x1, %rdx
movq %rdx, %r8
adcq $0x0, %r8
xorl %r9d, %r9d
movl (%rcx,%r9,4), %r10d
movsd (%rsi,%r10,8), %xmm0
movswq (%rdi,%r10,2), %r10
addsd (%rax,%r10,8), %xmm0
movsd %xmm0, (%rax,%r10,8)
incq %r9
cmpq %r9, %r8
jne 0xb4e3
movq %rdx, %xmm0
punpckldq 0xb1cd(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xb1d5(%rip), %xmm0     # 0x166f0
movapd %xmm0, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addpd %xmm1, %xmm0
movupd (%rax), %xmm1
divpd %xmm0, %xmm1
movupd %xmm1, (%rax)
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
callq 0x11244
xorpd %xmm0, %xmm0
movapd %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
leaq 0xf0(%rsp), %rbp
movq %rbp, %rdi
leaq 0x90(%rsp), %rsi
callq 0x7b1c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x7392
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
movl 0x58(%r15), %ecx
cmpq %rcx, %rax
jbe 0xb598
movl %eax, 0x58(%r15)
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0xb5b5
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0xb5d2
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xb5e9
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb5ff
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb1cf
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0xb1cf
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
testq %rdi, %rdi
je 0xb650
subq %rdi, %rsi
callq 0x3210
xorpd %xmm0, %xmm0
movq 0x20(%rsp), %rdi
movq 0x30(%rsp), %rsi
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
testq %rdi, %rdi
je 0xb676
subq %rdi, %rsi
callq 0x3210
movq %r14, %rdi
callq 0xa742
callq 0x3130
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x11efa
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xb6aa
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xb6c1
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
subq 0x58(%rsp), %rbx
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
movsd %xmm0, 0x58(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x1361e
movsd 0x58(%rsp), %xmm0
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0xb822
movq 0xe8(%rsp), %rsi
jmp 0xb81a
movq %rax, %rbx
movl $0x60, %esi
movq %r15, %rdi
jmp 0xb81d
movq %rax, %rbx
jmp 0xb82f
jmp 0xb7ef
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0xb75c
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0xb75c
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0xb77e
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0xb77e
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xb7f2
movq 0x70(%rsp), %rsi
jmp 0xb7c5
jmp 0xb7ef
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0xb7f2
movq 0xb8(%rsp), %rsi
jmp 0xb7c5
jmp 0xb7ca
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0xb7f2
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
jmp 0xb7d5
movq %rax, %rbx
movl $0x60, %esi
movq %rbp, %rdi
callq 0x3210
jmp 0xb7f2
jmp 0xb7e8
jmp 0xb7ef
jmp 0xb7ef
jmp 0xb7ef
jmp 0xb7e8
jmp 0xb7e8
movq %rax, %rbx
jmp 0xb822
jmp 0xb7ef
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb808
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb822
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x108(%rsp), %rdi
callq 0x11efa
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xb846
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xb85d
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x150(%rsp), %rdi
callq 0x1361e
movq %rbx, %rdi
callq 0x3320