// File: /workspace/github_c_makefile_star2_O3/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 0x83ed
movq %r13, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0xc31b
movq %rax, %rbp
movq 0x18(%rax), %r14
cmpl $0x0, 0x10(%r14)
je 0xc60c
movq %r14, %rdi
callq 0x88ee
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 0x84a3
movq %r13, %rdi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
movl 0x18(%rsp), %ecx
movq %rbx, %r8
callq 0xc241
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x7f99
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 0xc453
movq %rax, 0x28(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x8538
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14a56
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x7f3c
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x7f3c
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xc3c0
movq %rax, %r14
movq %r13, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x8538
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 0xc453
movq %rax, 0x18(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x7f99
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 0x84a3
movq 0x10(%rbx), %rdi
movq %rbp, %rsi
callq 0x14250
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14a56
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x14a56
movq 0x28(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x883e
movq %r13, %rdi
movq %rbx, %rsi
callq 0x83ed
movq %rax, %r14
movq %rax, 0x20(%rax)
movq %rax, 0x18(%rax)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x14a56
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq