// File: /workspace/github_cpp_makefile_star2_O1/0asa[P]TTree-source/ClassicNodeTree.cpp
// Function: ClassicNodeTree::computeVimp(std::vector<float, std::allocator<float>>&, std::vector<unsigned int, std::allocator<unsigned int>>&)
void  ClassicNodeTree::computeVimp(std::vector<float> &vim, std::vector<unsigned int> &set) {
	Node* n = root;
	Stack stack;
	std::vector<unsigned int> left;
	std::vector<unsigned int> right;
	n->setLS(set);
	stack.push(n);
	while (!stack.empty()) {
		n = stack.pop();
		if (!n->isLeaf()) {
			std::vector<unsigned int> ss = n->getLS();
			((TreeNodeTest*)n->getTest())->weak->computeVimp(vim,ss);	
			// getLRset ?
			left.clear();
			right.clear();
			for (int i = 0 ; i < ss.size() ; ++i) {
				Result r = ((TreeNodeTest*)n->getTest())->weak->test((double) ss[i]);	
				if (r.prob.getProb(0)>=((TreeNodeTest*)n->getTest())->getTh())
					left.push_back(ss[i]);
				else 
					right.push_back(ss[i]);
			}
			// SHRINK TO FIT TRICK :
			std::vector<unsigned int>(left.begin(),left.end()).swap(left);
			std::vector<unsigned int>(right.begin(),right.end()).swap(right);
			//printf("((TreeNodeTest*)n)->getLRSet(ss,left,right);\n"); fflush(stdout);
			// push left and right
			n->getLeft()->setLS(left); stack.push(n->getLeft());
			n->getRight()->setLS(right); stack.push(n->getRight());			
		}
		std::vector<unsigned int> empty;
		n->setLS(empty);
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdx, %r14
movq %rsi, 0x68(%rsp)
movq 0x50(%rdi), %rbx
leaq 0x130(%rsp), %rdi
callq 0x155dc
xorl %eax, %eax
movq %rax, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq %rax, 0x20(%rsp)
movapd %xmm0, 0x10(%rsp)
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x7b1c
leaq 0xb8(%rsp), %rsi
movq %rbx, %rdi
callq 0x7392
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x2, %rax
movl 0x58(%rbx), %ecx
cmpq %rcx, %rax
jbe 0x973e
movl %eax, 0x58(%rbx)
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x975b
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x130(%rsp), %rdi
movq %rbx, %rsi
callq 0x15604
leaq 0xd8(%rsp), %r14
leaq 0x130(%rsp), %rbx
leaq 0x70(%rsp), %rbp
leaq 0xd0(%rsp), %r13
movq %rbx, %rdi
callq 0x1564e
testb %al, %al
jne 0x9b11
movq %rbx, %rdi
callq 0x1563c
movq %rax, %r12
movq %rax, %rdi
callq 0x110f6
testb %al, %al
jne 0x9a86
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x7b1c
movq 0x30(%r12), %rax
movq 0x18(%rax), %rdi
movq (%rdi), %rax
movq 0x68(%rsp), %rsi
movq %r15, %rdx
callq *0x30(%rax)
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x97eb
movq %rax, 0x38(%rsp)
movq %rbx, %rbp
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x97ff
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rax
cmpq %rax, 0x58(%rsp)
je 0x98af
xorl %r15d, %r15d
xorl %ebx, %ebx
movq 0x30(%r12), %rcx
movq 0x18(%rcx), %rsi
movl (%rax,%r15), %edx
movq (%rsi), %rax
movq %r13, %rdi
callq *0x10(%rax)
movq %r14, %rdi
xorl %esi, %esi
callq 0x11558
movq 0x30(%r12), %rax
movq 0x50(%rsp), %rdx
addq %r15, %rdx
ucomisd 0x8(%rax), %xmm0
jae 0x986b
movq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rsi
je 0x9881
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rax)
jmp 0x9886
movq 0x38(%rsp), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rsi
jne 0x985e
callq 0x9f7a
movq %r13, %rdi
callq 0x1288e
incq %rbx
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
addq $0x4, %r15
cmpq %rbx, %rcx
ja 0x9814
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rdi
leaq 0xf(%rsp), %rcx
callq 0x9da0
movq 0xe0(%rsp), %rax
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rsi
movq %rsi, 0xe0(%rsp)
movapd 0xd0(%rsp), %xmm0
movq %rdi, 0xd0(%rsp)
movq %rcx, 0xd8(%rsp)
movapd %xmm0, 0x30(%rsp)
movq %rax, 0x40(%rsp)
testq %rdi, %rdi
movq %rbp, %rbx
je 0x9919
subq %rdi, %rsi
callq 0x3210
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rdi
leaq 0xf(%rsp), %rcx
callq 0x9da0
leaq 0x70(%rsp), %rbp
movq 0xe0(%rsp), %rax
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rsi
movq %rsi, 0xe0(%rsp)
movapd 0xd0(%rsp), %xmm0
movq %rdi, 0xd0(%rsp)
movq %rcx, 0xd8(%rsp)
movapd %xmm0, 0x10(%rsp)
movq %rax, 0x20(%rsp)
testq %rdi, %rdi
je 0x9985
subq %rdi, %rsi
callq 0x3210
movq %r12, %rdi
callq 0x11108
movq %rax, %r15
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7b1c
movq %r15, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x7392
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
movl 0x58(%r15), %ecx
cmpq %rcx, %rax
jbe 0x99ca
movl %eax, 0x58(%r15)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x99e7
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %r12, %rdi
callq 0x11108
movq %rbx, %rdi
movq %rax, %rsi
callq 0x15604
movq %r12, %rdi
callq 0x1110e
movq %rax, %r15
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x7b1c
movq %r15, %rdi
leaq 0x88(%rsp), %rsi
callq 0x7392
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
movl 0x58(%r15), %ecx
cmpq %rcx, %rax
jbe 0x9a3f
movl %eax, 0x58(%r15)
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x9a5c
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %r12, %rdi
callq 0x1110e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x15604
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9a86
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
xorpd %xmm0, %xmm0
movapd %xmm0, 0xd0(%rsp)
movq $0x0, 0xe0(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x7b1c
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7392
movq 0x8(%r12), %rax
subq (%r12), %rax
sarq $0x2, %rax
movl 0x58(%r12), %ecx
cmpq %rcx, %rax
jbe 0x9ad1
movl %eax, 0x58(%r12)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x9aeb
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x9788
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0x9788
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9b28
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x9b3f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x130(%rsp), %rdi
callq 0x155ec
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x9c33
movq 0xc8(%rsp), %rsi
jmp 0x9c2b
jmp 0x9c00
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x9c1c
movq 0x98(%rsp), %rsi
jmp 0x9bb9
jmp 0x9c07
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x9c1c
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0x9c1c
jmp 0x9c07
jmp 0x9c00
movq %rax, %rbx
jmp 0x9be9
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x9be9
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x9c33
movq 0xe0(%rsp), %rsi
jmp 0x9c2b
movq %rax, %rbx
jmp 0x9c33
jmp 0x9c07
movq %rax, %rbx
jmp 0x9c1c
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x1288e
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9c33
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9c4a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x9c61
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0x130(%rsp), %rdi
callq 0x155ec
movq %rbx, %rdi
callq 0x3320