// File: 0asa[P]TTree-source/ClassicTree.cpp
// Function: ClassicTree::createProbsInLeaf()
void ClassicTree::createProbsInLeaf() {
	Node* n = root;
	Stack stack;
	stack.push(n);
	while (!stack.empty()) {
		n = stack.pop();
		if (!n->isLeaf()) {
			stack.push(n->getLeft());
			stack.push(n->getRight());
		} else {
			// create vote and add it to corresponding to the leaf
			std::vector<double> vote(2,0.0);
			std::vector<unsigned int> list = n->getLS();
			for (int i = 0 ; i < list.size() ; ++i)
				vote[db->getOutput(list[i])] += db->getWeight(list[i]);
			for (int i = 0 ; i < vote.size() ; ++i) 
				vote[i] /= list.size();

			n->setVote(vote);
		}
	}
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x50(%rax), %rax
movq %rax, 0xf8(%rsp)
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x2d660
movq 0x80(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x2d680
jmp 0x13e14
jmp 0x13e16
leaq 0xe0(%rsp), %rdi
callq 0x2d720
movb %al, 0x77(%rsp)
jmp 0x13e29
movb 0x77(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x13e38
jmp 0x1418a
leaq 0xe0(%rsp), %rdi
callq 0x2d6d0
movq %rax, 0x68(%rsp)
jmp 0x13e4c
movq 0x68(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x21aa0
movb %al, 0x67(%rsp)
jmp 0x13e6c
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x13ee4
jmp 0x13e76
movq 0xf8(%rsp), %rdi
callq 0x21af0
movq %rax, 0x58(%rsp)
jmp 0x13e8a
movq 0x58(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x2d680
jmp 0x13e9e
movq 0xf8(%rsp), %rdi
callq 0x21b00
movq %rax, 0x50(%rsp)
jmp 0x13eb2
movq 0x50(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x2d680
jmp 0x13ec6
jmp 0x14185
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x1419f
movq $0x0, 0xb0(%rsp)
leaq 0xaf(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xccb0
movq 0x48(%rsp), %rcx
leaq 0xb8(%rsp), %rdi
movl $0x2, %esi
leaq 0xb0(%rsp), %rdx
callq 0xccc0
jmp 0x13f23
leaq 0xaf(%rsp), %rdi
callq 0xcd40
movq 0xf8(%rsp), %rdi
callq 0xcba0
movq %rax, 0x40(%rsp)
jmp 0x13f44
movq 0x40(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0xcbb0
jmp 0x13f58
movl $0x0, 0x8c(%rsp)
movslq 0x8c(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
jae 0x1409a
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movslq 0x8c(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0xcd80
movq 0x28(%rsp), %rdi
movl (%rax), %esi
callq 0xcd50
movsd %xmm0, 0x30(%rsp)
jmp 0x13fc5
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
movslq 0x8c(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0xcd80
movq 0x18(%rsp), %rdi
movl (%rax), %esi
callq 0xcdc0
movw %ax, 0x26(%rsp)
jmp 0x13ffb
movw 0x26(%rsp), %ax
movswq %ax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0xcda0
movsd 0x30(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x13f63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xaf(%rsp), %rdi
callq 0xcd40
jmp 0x1419f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x14176
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x6830
jmp 0x14176
movl $0x0, 0x88(%rsp)
movslq 0x88(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0xab40
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x14143
leaq 0x90(%rsp), %rdi
callq 0x8bf0
movq %rax, %xmm0
movaps 0x1c66b(%rip), %xmm1    # 0x30750
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x1c66f(%rip), %xmm1    # 0x30760
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0x88(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0xcda0
movsd 0x8(%rsp), %xmm1
movsd (%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x140a5
movq 0xf8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x21dd0
jmp 0x1415a
leaq 0x90(%rsp), %rdi
callq 0x6830
leaq 0xb8(%rsp), %rdi
callq 0xcaa0
jmp 0x14185
leaq 0xb8(%rsp), %rdi
callq 0xcaa0
jmp 0x1419f
jmp 0x13e16
leaq 0xe0(%rsp), %rdi
callq 0x2d670
addq $0x108, %rsp            # imm = 0x108
retq
leaq 0xe0(%rsp), %rdi
callq 0x2d670
movq 0xd8(%rsp), %rdi
callq 0x33e0
nopl (%rax)