// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rsi, %r13
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movq $0x0, 0x30(%rdi)
movslq 0xa0(%rsp), %r12
movl %r12d, 0x30(%rdi)
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rdi)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rdi)
leaq (,%r12,8), %rbx
movq %rbx, %rdi
callq 0x1190
movq %rax, 0x30(%rsp)
movq %rax, 0x18(%r14)
movq %rbx, %rdi
callq 0x1190
movq %r14, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movq %rax, 0x28(%r14)
movq 0x98(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, 0x38(%rsp)
testq %r12, %r12
jle 0xf3c8
xorl %r14d, %r14d
movq %r15, 0x28(%rsp)
movq %r13, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf19b
movq %rbx, 0x40(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe9d1
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xc63f
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xeb0d
movq %rax, %r13
movq 0x30(%rsp), %rax
movq %r13, (%rax,%r14,8)
movq 0x10(%rsp), %rax
movq $0x0, (%rax,%r14,8)
testq %r13, %r13
je 0xf398
movq 0x10(%rsp), %rax
leaq (%rax,%r14,8), %r15
xorl %ebp, %ebp
movl $0x1, %edi
movl $0x10, %esi
callq 0x1120
movq %rax, %rbx
movq %r13, %rdi
xorl %esi, %esi
callq 0x1bc66
movq %rax, (%rbx)
addq $0x8, %rbp
cmpq $0x0, (%r15)
cmoveq %r15, %rbp
movq %rbx, (%rbp)
movq 0x18(%r13), %r13
movq %rbx, %rbp
testq %r13, %r13
jne 0xf35d
movq 0x28(%rsp), %r15
movq %r15, %rdi
movq 0x40(%rsp), %rsi
callq 0x149f4
movq 0x20(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x14700
incq %r14
cmpq 0x38(%rsp), %r14
jne 0xf2ee
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xec1e
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