// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/localEasySubtreeIsomorphism.c
// Function: getFullSpanningtreeTree
struct SpanningtreeTree getFullSpanningtreeTree(struct BlockTree blockTree, struct GraphPool* gp, struct ShallowGraphPool* sgp) {
	struct SpanningtreeTree sptTree = {0,0,0,0,0,0,0};
	sptTree.g = blockTree.g;
	sptTree.nRoots = blockTree.nRoots;
	sptTree.roots = blockTree.roots;
	sptTree.parents = blockTree.parents;
	sptTree.localSpanningTrees = malloc(sptTree.nRoots * sizeof(struct Graph*));
	sptTree.localPostorders = malloc(sptTree.nRoots * sizeof(struct PostorderList*));

	for (int v=0; v<sptTree.nRoots; ++v) {
		struct ShallowGraph* mergedEdges = mergeShallowGraphs(blockTree.vRootedBlocks[v], sgp);
		// TODO make destructive. shallowGraphs are not used afterwards.
		struct Graph* mergedGraph = blockConverter(mergedEdges, gp);

		struct ShallowGraph* shallowSpanningtrees = listSpanningTrees(mergedGraph, sgp, gp);
		sptTree.localSpanningTrees[v] = spanningTreeConverter(shallowSpanningtrees, mergedGraph, gp, sgp);

		sptTree.localPostorders[v] = NULL;
		struct PostorderList* tail = NULL;
		for (struct Graph* localSpanningTree=sptTree.localSpanningTrees[v]; localSpanningTree!=NULL; localSpanningTree=localSpanningTree->next) {
			struct PostorderList* tmp = __getPOL();
			tmp->postorder = getPostorder(localSpanningTree, 0);
			if (sptTree.localPostorders[v] == NULL) {
				sptTree.localPostorders[v] = tail = tmp;
			} else {
				// append at the end of the list
				tail->next = tmp;
				tail = tmp;
			}
		}

		// garbage collection
		dumpShallowGraph(sgp, mergedEdges);
		dumpGraph(gp, mergedGraph);
	}

	initCharacteristicsArrayForLocalEasy(&sptTree);

	//garbage collection
	free(blockTree.vRootedBlocks);

	return sptTree;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
andq $0x0, 0x30(%rdi)
movslq 0xa0(%rsp), %r15
movl %r15d, 0x30(%rdi)
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rdi)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rdi)
movq %r15, %rbx
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x1180
movq %rax, 0x20(%rsp)
movq %rax, 0x18(%r14)
movq %rbx, %rdi
callq 0x1180
movq %r14, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq %rax, 0x28(%r14)
movq 0x98(%rsp), %rax
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
testl %r15d, %r15d
movl $0x0, %eax
cmovgl %r15d, %eax
movq %rax, 0x38(%rsp)
movq %r13, 0x30(%rsp)
movq %rbp, 0x28(%rsp)
cmpq 0x38(%rsp), %r14
je 0xc986
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0xc7c2
movq %rbx, 0x40(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xc093
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xa01b
movq %rax, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xc1cf
movq %rax, %r13
movq 0x20(%rsp), %rax
movq %r13, (%rax,%r14,8)
movq 0x18(%rsp), %rax
leaq (%rax,%r14,8), %r15
andq $0x0, (%rax,%r14,8)
xorl %ebp, %ebp
testq %r13, %r13
je 0xc95c
callq 0xde1a
movq %rax, %rbx
movq %r13, %rdi
xorl %esi, %esi
callq 0x1945b
addq $0x8, %rbp
cmpq $0x0, (%r15)
cmoveq %r15, %rbp
movq %rax, (%rbx)
movq %rbx, (%rbp)
movq 0x18(%r13), %r13
movq %rbx, %rbp
jmp 0xc929
movq 0x30(%rsp), %r13
movq %r13, %rdi
movq 0x40(%rsp), %rsi
callq 0x1184e
movq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x1166e
incq %r14
jmp 0xc8bc
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xc2f0
movq 0x8(%rsp), %rdi
callq 0x1030
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq