// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/listSpanningTrees.c
// Function: _rec
struct ShallowGraph* __rec(int d, struct Graph* graph, struct Graph* partialTree, int* components, int n, struct ShallowGraphPool* sgp, struct GraphPool* gp) {

	struct VertexList* e;
	struct ShallowGraph* result1;
	struct ShallowGraph* result2;
	struct ShallowGraph* B;
	struct ShallowGraph* bridges;
	struct ShallowGraph* graphEdges = __getGraphAndNonGraphEdges(partialTree, getGraphEdges(graph, sgp), sgp);
	struct ShallowGraph* rest = graphEdges->next;

	if (rest->m == 0) {
		struct ShallowGraph* tree = getGraphEdges(partialTree, sgp);
		tree->next = tree->prev = tree;

		/* garbage collection */
		dumpShallowGraphCycle(sgp, graphEdges);

		return tree;
	}
	/* get edge that will be included and excluded in this __recursive step */
	e = popEdge(rest);

	/* add e to partialTree (already contained in graph) to find spanning trees containing e */
	addEdgeBetweenVertices(e->startPoint->number, e->endPoint->number, e->label, partialTree, gp);

	/* S1 */
	/* let B be the set of all edges (in graph) joining edges already connected in partialTree */
	B = __selectB(partialTree, rest, components, n, sgp);

	/* ensures, that adding an edge of graph to partialTree results in a tree in the __recursive call */
	deleteEdges(graph, B, gp);

	result1 = __rec(d+1, graph, partialTree, components, n, sgp, gp);

	/* add edges to graph again */
	addEdges(graph, B, gp);

	/* preliminary garbage collection */
	dumpShallowGraphCycle(sgp, B);

	/* delete e from partialTree and graph to find spanning trees not containing e */
	deleteEdgeBetweenVertices(graph, e, gp);
	deleteEdgeBetweenVertices(partialTree, e, gp);

	/* S2 */
	bridges = __getNonTreeBridges(graph, partialTree, sgp);

	addEdges(partialTree, bridges, gp);
	result2 = __rec(d+1, graph, partialTree, components, n, sgp, gp);

	deleteEdges(partialTree, bridges, gp);

	/* At the end, spanningTree and graph need to be same as in the beginning. */
	addEdgeBetweenVertices(e->startPoint->number, e->endPoint->number, e->label, graph, gp);

	/* garbage collection */
	dumpVertexList(sgp->listPool, e);
	dumpShallowGraphCycle(sgp, bridges);
	dumpShallowGraphCycle(sgp, graphEdges);

	return addComponent(result1, result2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rbx
movl %r8d, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movl %edi, 0x14(%rsp)
movq 0x70(%rsp), %r12
movq %rsi, %rdi
movq %r9, %rsi
callq 0x6172
movq %r13, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x9cfe
movq %rax, %rbp
movq 0x18(%rax), %r14
cmpl $0x0, 0x10(%r14)
je 0x9fe8
movq %r14, %rdi
callq 0x65fe
movq %rbp, 0x30(%rsp)
movq %rax, %rbp
movq (%rax), %rdx
movq 0x10(%rax), %rax
movl 0x18(%rax), %edi
movq 0x18(%rbp), %rax
movl 0x18(%rax), %esi
movq %r13, %rcx
movq %r12, %r8
callq 0x6200
movq %r13, %rdi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
movl 0x18(%rsp), %ecx
movq %rbx, %r8
callq 0x9c20
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x5d7c
movl 0x14(%rsp), %edi
incl %edi
movl %edi, 0x14(%rsp)
movq %r12, (%rsp)
movq %r15, %rsi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
movl 0x18(%rsp), %r8d
movq %rbx, %r9
callq 0x9e2f
movq %rax, 0x28(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x6274
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11888
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x5d1f
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x5d1f
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x9da2
movq %rax, %r14
movq %r13, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x6274
movq %r12, (%rsp)
movl 0x14(%rsp), %edi
movq %r15, %rsi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
movl 0x18(%rsp), %r8d
movq %rbx, %r9
callq 0x9e2f
movq %rax, 0x18(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5d7c
movq (%rbp), %rdx
movq 0x10(%rbp), %rax
movl 0x18(%rax), %edi
movq 0x18(%rbp), %rax
movl 0x18(%rax), %esi
movq %r15, %rcx
movq %r12, %r8
callq 0x6200
movq 0x10(%rbx), %rdi
movq %rbp, %rsi
callq 0x11364
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11888
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x11888
movq 0x28(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x656a
movq %r13, %rdi
movq %rbx, %rsi
callq 0x6172
movq %rax, %r14
movq %rax, 0x20(%rax)
movq %rax, 0x18(%rax)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x11888
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq