// File: 0asa[P]TTree-source/ClassicTree.cpp
// Function: ClassicTree::learnfbf()
double ClassicTree::learnfbf() {
	clock_t clock_start = clock();
	Scorer s(db);
	std::vector<unsigned int> lsleft;
	std::vector<unsigned int> lsright;
	BestFirstStack stack(db);
	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.getBestScore(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++;
			}
		}
	}	
	createProbsInLeaf();
	return (clock() - clock_start);
}

// Assembly:
subq $0x218, %rsp            # imm = 0x218
movq %rdi, 0x210(%rsp)
movq 0x210(%rsp), %rax
movq %rax, 0x88(%rsp)
callq 0x3180
movq %rax, %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x208(%rsp)
movq 0x8(%rax), %rsi
leaq 0x1e0(%rsp), %rdi
callq 0x26d90
leaq 0x1c8(%rsp), %rdi
callq 0x67b0
leaq 0x1b0(%rsp), %rdi
callq 0x67b0
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x178(%rsp), %rdi
callq 0xc540
jmp 0x1423d
movl $0x60, %edi
callq 0x3270
movq %rax, 0x80(%rsp)
jmp 0x14251
movq 0x80(%rsp), %rdi
callq 0x21960
jmp 0x14260
movq 0x88(%rsp), %rax
movq 0x80(%rsp), %rcx
movq %rcx, 0x50(%rax)
movq 0x20(%rax), %rsi
movq 0x50(%rax), %rax
movq %rax, 0x78(%rsp)
leaq 0x150(%rsp), %rdi
callq 0xcbb0
jmp 0x14290
movq 0x78(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x12260
jmp 0x142a4
leaq 0x150(%rsp), %rdi
callq 0x6830
movq 0x88(%rsp), %rax
movq 0x50(%rax), %rsi
leaq 0x178(%rsp), %rdi
callq 0xc600
jmp 0x142cc
jmp 0x142ce
leaq 0x178(%rsp), %rdi
callq 0x2d720
movb %al, 0x77(%rsp)
jmp 0x142e1
movb 0x77(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x76(%rsp)
jne 0x14307
jmp 0x142f2
movq 0x88(%rsp), %rcx
movl 0x14(%rcx), %eax
cmpl 0x18(%rcx), %eax
setl %al
movb %al, 0x76(%rsp)
movb 0x76(%rsp), %al
testb $0x1, %al
jne 0x14314
jmp 0x14868
leaq 0x178(%rsp), %rdi
callq 0xc5b0
movq %rax, 0x68(%rsp)
jmp 0x14328
movq 0x68(%rsp), %rax
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rdi
callq 0xcba0
movq %rax, 0x60(%rsp)
jmp 0x14349
movq 0x60(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0xcbb0
jmp 0x1435d
leaq 0x130(%rsp), %rdi
callq 0x8bf0
movq 0x88(%rsp), %rcx
movslq 0x10(%rcx), %rcx
cmpq %rcx, %rax
jb 0x14856
leaq 0x118(%rsp), %rdi
callq 0x67b0
movq 0x88(%rsp), %rax
cmpl $0x0, 0x58(%rax)
jbe 0x1447f
movq 0x88(%rsp), %rax
movq 0x30(%rax), %rsi
movl 0x58(%rax), %edx
leaq 0x100(%rsp), %rdi
callq 0x122d0
jmp 0x143bc
leaq 0x118(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x6800
leaq 0x100(%rsp), %rdi
callq 0x6830
jmp 0x1449c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x148de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x148d1
movq 0x80(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
movl $0x60, %esi
callq 0x3280
jmp 0x148d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x6830
jmp 0x148d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x1483a
movq 0x88(%rsp), %rax
movq 0x30(%rax), %rsi
leaq 0x118(%rsp), %rdi
callq 0x90f0
jmp 0x1449a
jmp 0x1449c
leaq 0xd0(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x130(%rsp), %rdx
leaq 0x118(%rsp), %rcx
callq 0x168e0
jmp 0x144c3
movsd 0xf8(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x14811
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x130(%rsp), %rdx
leaq 0x1c8(%rsp), %rcx
leaq 0x1b0(%rsp), %r8
callq 0x19420
jmp 0x1450c
movq 0x148(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x21b10
jmp 0x14523
movl $0x60, %edi
callq 0x3270
movq %rax, 0x58(%rsp)
jmp 0x14534
movq 0x58(%rsp), %rdi
callq 0x21960
jmp 0x14540
movq 0x58(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rdi
movq 0x148(%rsp), %rsi
callq 0x21c50
jmp 0x14564
movq 0xc8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x148(%rsp), %rdi
callq 0x12630
movl %eax, 0x54(%rsp)
jmp 0x14584
movq 0x48(%rsp), %rdi
movl 0x54(%rsp), %esi
incl %esi
callq 0x12610
jmp 0x14596
movq 0xc8(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0xcbb0
jmp 0x145ba
movq 0x40(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x12260
jmp 0x145ce
leaq 0xb0(%rsp), %rdi
callq 0x6830
movq 0x148(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x21c70
jmp 0x145f2
movq 0xc8(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0xc600
jmp 0x14609
movl $0x60, %edi
callq 0x3270
movq %rax, 0x38(%rsp)
jmp 0x1461a
movq 0x38(%rsp), %rdi
callq 0x21960
jmp 0x14626
movq 0x38(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x148(%rsp), %rsi
callq 0x21c50
jmp 0x1464a
movq 0xa8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x148(%rsp), %rdi
callq 0x12630
movl %eax, 0x34(%rsp)
jmp 0x1466a
movq 0x28(%rsp), %rdi
movl 0x34(%rsp), %esi
incl %esi
callq 0x12610
jmp 0x1467c
movq 0xa8(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0xcbb0
jmp 0x146a0
movq 0x20(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x12260
jmp 0x146b4
leaq 0x90(%rsp), %rdi
callq 0x6830
movq 0x148(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x21c90
jmp 0x146d8
movq 0xa8(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0xc600
jmp 0x146ef
movq 0x88(%rsp), %rax
movl 0x15c(%rax), %eax
movl %eax, 0x18(%rsp)
movq 0x148(%rsp), %rdi
callq 0x12630
movl %eax, 0x1c(%rsp)
jmp 0x14714
movl 0x18(%rsp), %eax
movl 0x1c(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jae 0x14800
movq 0x148(%rsp), %rdi
callq 0x12630
movl %eax, 0x14(%rsp)
jmp 0x1473a
movq 0x88(%rsp), %rax
movl 0x14(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x15c(%rax)
jmp 0x14800
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x1482d
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
movl $0x60, %esi
callq 0x3280
jmp 0x1482d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x6830
jmp 0x1482d
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
movl $0x60, %esi
callq 0x3280
jmp 0x1482d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x6830
jmp 0x1482d
movq 0x88(%rsp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
leaq 0xd0(%rsp), %rdi
callq 0x12640
leaq 0x118(%rsp), %rdi
callq 0x6830
jmp 0x14856
leaq 0xd0(%rsp), %rdi
callq 0x12640
leaq 0x118(%rsp), %rdi
callq 0x6830
leaq 0x130(%rsp), %rdi
callq 0x6830
jmp 0x148d1
leaq 0x130(%rsp), %rdi
callq 0x6830
jmp 0x142ce
movq 0x88(%rsp), %rdi
callq 0x13dc0
jmp 0x14877
callq 0x3180
subq 0x208(%rsp), %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x178(%rsp), %rdi
callq 0xc580
leaq 0x1b0(%rsp), %rdi
callq 0x6830
leaq 0x1c8(%rsp), %rdi
callq 0x6830
leaq 0x1e0(%rsp), %rdi
callq 0x26e10
movsd 0x8(%rsp), %xmm0
addq $0x218, %rsp            # imm = 0x218
retq
leaq 0x178(%rsp), %rdi
callq 0xc580
leaq 0x1b0(%rsp), %rdi
callq 0x6830
leaq 0x1c8(%rsp), %rdi
callq 0x6830
leaq 0x1e0(%rsp), %rdi
callq 0x26e10
movq 0x170(%rsp), %rdi
callq 0x33e0
nopw %cs:(%rax,%rax)