// File: 0asa[P]TTree-source/RandomTTForest.cpp
// Function: RandomTTForest::learn()
double RandomTTForest::learn() {
	clock_t clock_start = clock();
	for (int t = 0 ; t < nbtree ; ++t) {
		fprintf(stderr, "# TTree %3d ",t+1);
		term[t] = new ClassicNodeTree((BlockDB*)db,k, nmin);
		term[t]->setKint(kint);
		//term[t]->setMaxComplexity(2);
		term[t]->setGroupCand(groupcand);
		term[t]->setInternalComp(internalComp);
		term[t]->setTreeType(treeType);
		std::vector<unsigned int> bsls = Sampler::bootstrap((*ls));
		term[t]->setLS(&bsls);
		term[t]->setAttCand(cand);
		term[t]->learn();
		fprintf(_treeinfo, "Tree %03d - Complexity : %03d - ",t+1,term[t]->getComplexity());
		// 27-07-2012
		fprintf(_treeinfo, "MaxDepth : %03d - ",term[t]->getMaxDepth());
		Result result(db);
		result = test(t+1,ts);
		fprintf(_treeinfo,"Error rate : %f %%\n", result.getErrorRate());
		result.printProb(_treeinfo);
	}
	
	return (clock() - clock_start);
}

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movq %rdi, 0x130(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x40(%rsp)
callq 0x3180
movq %rax, 0x128(%rsp)
movl $0x0, 0x124(%rsp)
movq 0x40(%rsp), %rcx
movl 0x124(%rsp), %eax
cmpl 0x98(%rcx), %eax
jae 0x24182
movq 0x1d1c5(%rip), %rax     # 0x40fd8
movq (%rax), %rdi
movl 0x124(%rsp), %edx
incl %edx
leaq 0xcaa6(%rip), %rsi      # 0x308cc
xorl %eax, %eax
callq 0x3360
movl $0xa0, %edi
callq 0x3270
movq %rax, %rdi
movq 0x40(%rsp), %rax
movq %rdi, %rcx
movq %rcx, 0x38(%rsp)
movq 0x8(%rax), %rsi
movl 0xa8(%rax), %edx
movl 0x10(%rax), %ecx
callq 0xf5f0
jmp 0x23e5b
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rsi
movq 0xa0(%rax), %rcx
movslq 0x124(%rsp), %rdx
movq %rsi, (%rcx,%rdx,8)
movq 0xa0(%rax), %rcx
movslq 0x124(%rsp), %rdx
movq (%rcx,%rdx,8), %rdi
movl 0x5c(%rax), %esi
callq 0x7390
movq 0x40(%rsp), %rsi
movq 0xa0(%rsi), %rax
movslq 0x124(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
subq $-0x80, %rsi
callq 0x1d650
movq 0x40(%rsp), %rax
movq 0xa0(%rax), %rcx
movslq 0x124(%rsp), %rdx
movq (%rcx,%rdx,8), %rdi
movl 0x58(%rax), %esi
callq 0x73b0
movq 0x40(%rsp), %rax
movq 0xa0(%rax), %rcx
movslq 0x124(%rsp), %rdx
movq (%rcx,%rdx,8), %rdi
movl 0x60(%rax), %esi
callq 0x75d0
movq 0x40(%rsp), %rax
movq 0x20(%rax), %rsi
leaq 0xf8(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x23850
movq 0x40(%rsp), %rax
movq 0x30(%rsp), %rsi
movq 0xa0(%rax), %rax
movslq 0x124(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x204d0
jmp 0x23f33
movq 0x40(%rsp), %rax
movq 0x30(%rax), %rsi
movq 0xa0(%rax), %rax
movslq 0x124(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x20510
jmp 0x23f56
movq 0x40(%rsp), %rax
movq 0xa0(%rax), %rax
movslq 0x124(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
jmp 0x23f78
movq 0x40(%rsp), %rcx
movq 0xa0(%rcx), %rax
movq 0xb0(%rcx), %rcx
movq %rcx, 0x20(%rsp)
movslq 0x124(%rsp), %rcx
movl %ecx, %edx
incl %edx
movl %edx, 0x28(%rsp)
movq (%rax,%rcx,8), %rdi
callq 0x20530
movl %eax, 0x2c(%rsp)
jmp 0x23faf
movl 0x2c(%rsp), %ecx
movl 0x28(%rsp), %edx
movq 0x20(%rsp), %rdi
leaq 0xc938(%rip), %rsi      # 0x308fb
xorl %eax, %eax
callq 0x3360
movq 0x40(%rsp), %rcx
movq 0xa0(%rcx), %rax
movq 0xb0(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movslq 0x124(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x24aa0
movl %eax, 0x1c(%rsp)
jmp 0x23ff9
movl 0x1c(%rsp), %edx
movq 0x10(%rsp), %rdi
leaq 0xc913(%rip), %rsi      # 0x3091c
xorl %eax, %eax
callq 0x3360
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0xa0(%rsp), %rdi
callq 0x24ac0
jmp 0x24028
movq 0x40(%rsp), %rsi
movl 0x124(%rsp), %edx
incl %edx
movq 0x28(%rsi), %rcx
leaq 0x48(%rsp), %rdi
callq 0x241b0
jmp 0x24046
leaq 0xa0(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6fc0
jmp 0x2405a
leaq 0x48(%rsp), %rdi
callq 0x24b00
movq 0x40(%rsp), %rax
movq 0xb0(%rax), %rax
movq %rax, (%rsp)
leaq 0xa0(%rsp), %rdi
movsd 0xbf8c(%rip), %xmm0     # 0x30010
callq 0x24ba0
movsd %xmm0, 0x8(%rsp)
jmp 0x24091
movsd 0x8(%rsp), %xmm0
movq (%rsp), %rdi
leaq 0xc38e(%rip), %rsi      # 0x30430
movb $0x1, %al
callq 0x3360
movq 0x40(%rsp), %rax
movq 0xb0(%rax), %rsi
leaq 0xa0(%rsp), %rdi
callq 0x24b20
jmp 0x240c4
leaq 0xa0(%rsp), %rdi
callq 0x24b00
leaq 0xf8(%rsp), %rdi
callq 0x6830
movl 0x124(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x124(%rsp)
jmp 0x23df4
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
movl $0xa0, %esi
callq 0x3280
jmp 0x2419c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x24173
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x24166
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x24b00
leaq 0xa0(%rsp), %rdi
callq 0x24b00
leaq 0xf8(%rsp), %rdi
callq 0x6830
jmp 0x2419c
callq 0x3180
subq 0x128(%rsp), %rax
cvtsi2sd %rax, %xmm0
addq $0x138, %rsp            # imm = 0x138
retq
movq 0x118(%rsp), %rdi
callq 0x33e0
nopl (%rax)