// File: /workspace/github_cpp_makefile_star2_O3/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 0xb8(%rsp), %rdi
callq 0x1554c
xorl %eax, %eax
movq %rax, 0x20(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq %rax, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
callq 0x7b86
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x73dc
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x2, %rax
movl 0x58(%rbx), %ecx
cmpq %rcx, %rax
jbe 0x9764
movl %eax, 0x58(%rbx)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x9781
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0xb8(%rsp), %rdi
movq %rbx, %rsi
callq 0x15574
leaq 0xd8(%rsp), %r14
leaq 0xb8(%rsp), %rbx
leaq 0xd0(%rsp), %r13
leaq 0x30(%rsp), %rbp
movq %rbx, %rdi
callq 0x155be
testb %al, %al
jne 0x9b38
movq %rbx, %rdi
callq 0x155ac
movq %rax, %r12
movq %rax, %rdi
callq 0x110c6
testb %al, %al
jne 0x9aa2
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x7b86
movq 0x30(%r12), %rax
movq 0x18(%rax), %rdi
movq (%rdi), %rax
movq 0x68(%rsp), %rsi
movq %r15, %rdx
callq *0x30(%rax)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
cmpq %rsi, %rdx
je 0x9817
movq %rsi, 0x18(%rsp)
movq %rsi, %rdx
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x9828
movq %rax, 0x38(%rsp)
movq 0x50(%rsp), %rax
cmpq %rax, 0x58(%rsp)
je 0x98e8
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 0x11528
movq 0x30(%r12), %rax
movq 0x50(%rsp), %rdx
addq %r15, %rdx
ucomisd 0x8(%rax), %xmm0
jae 0x9892
movq 0x38(%rsp), %rsi
movq %rbp, %rdi
leaq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rsi
je 0x98a8
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rax)
jmp 0x98ad
movq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rsi
jne 0x9885
callq 0x9f8a
movq %r13, %rdi
callq 0x12826
incq %rbx
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
addq $0x4, %r15
cmpq %rbx, %rcx
ja 0x983d
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0xb8(%rsp), %rbx
movq %r13, %rdi
leaq 0xf(%rsp), %rcx
callq 0x9dc2
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 0x9945
subq %rdi, %rsi
callq 0x3210
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rdi
leaq 0xf(%rsp), %rcx
callq 0x9dc2
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
je 0x99ac
subq %rdi, %rsi
callq 0x3210
movq %r12, %rdi
callq 0x110d8
movq %rax, %r15
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x7b86
movq %r15, %rdi
leaq 0x88(%rsp), %rsi
callq 0x73dc
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
movl 0x58(%r15), %ecx
cmpq %rcx, %rax
jbe 0x99f1
movl %eax, 0x58(%r15)
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x9a0e
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %r12, %rdi
callq 0x110d8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x15574
movq %r12, %rdi
callq 0x110de
movq %rax, %r15
leaq 0x70(%rsp), %rdi
movq %rbp, %rsi
callq 0x7b86
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x73dc
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
movl 0x58(%r15), %ecx
cmpq %rcx, %rax
jbe 0x9a5e
movl %eax, 0x58(%r15)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x9a78
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %r12, %rdi
callq 0x110de
movq %rbx, %rdi
movq %rax, %rsi
callq 0x15574
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9aa2
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
xorpd %xmm0, %xmm0
movapd %xmm0, 0xd0(%rsp)
movq $0x0, 0xe0(%rsp)
leaq 0x130(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x7b86
movq %r12, %rdi
movq %r15, %rsi
callq 0x73dc
movq 0x8(%r12), %rax
subq (%r12), %rax
sarq $0x2, %rax
movl 0x58(%r12), %ecx
cmpq %rcx, %rax
jbe 0x9af5
movl %eax, 0x58(%r12)
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x9b12
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x97ae
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0x97ae
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x9b4f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9b66
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0xb8(%rsp), %rdi
callq 0x1555c
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x9c5a
movq 0xb0(%rsp), %rsi
jmp 0x9c52
jmp 0x9c27
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x9c43
movq 0x80(%rsp), %rsi
jmp 0x9bdd
jmp 0x9c2e
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x9c43
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
jmp 0x9c43
jmp 0x9c2e
jmp 0x9c27
movq %rax, %rbx
jmp 0x9c10
movq %rax, %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x9c10
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x9c5a
movq 0xe0(%rsp), %rsi
jmp 0x9c52
movq %rax, %rbx
jmp 0x9c5a
jmp 0x9c2e
movq %rax, %rbx
jmp 0x9c43
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x12826
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9c5a
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x9c71
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9c88
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3210
leaq 0xb8(%rsp), %rdi
callq 0x1555c
movq %rbx, %rdi
callq 0x3320
nop