// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/listSpanningTrees.c
// Function: _recK
struct ShallowGraph* __recK(int d, int* k, 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);

		/* count this spanning tree */
		*k -= 1;

		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 = __recK(d+1, k, graph, partialTree, components, n, sgp, gp);

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

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

	/* if we did find enough spanning trees, skip second part */
	if (*k <= 0) {
		return result1;
	}

	/* 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 = __recK(d+1, k, 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:
subq $0x98, %rsp
movq 0xa8(%rsp), %rax
movq 0xa0(%rsp), %rax
movl %edi, 0x8c(%rsp)
movq %rsi, 0x80(%rsp)
movq %rdx, 0x78(%rsp)
movq %rcx, 0x70(%rsp)
movq %r8, 0x68(%rsp)
movl %r9d, 0x64(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x78(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0xb530
movq 0x18(%rsp), %rdi
movq %rax, %rsi
movq 0xa0(%rsp), %rdx
callq 0x12830
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x12f8a
movq 0x70(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0xb530
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0xa0(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x20000
movq 0x80(%rsp), %rax
movl (%rax), %ecx
subl $0x1, %ecx
movl %ecx, (%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x131dc
movq 0x28(%rsp), %rdi
callq 0xbef0
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x18(%rax), %edi
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movl 0x18(%rax), %esi
movq 0x58(%rsp), %rax
movq (%rax), %rdx
movq 0x70(%rsp), %rcx
movq 0xa8(%rsp), %r8
callq 0xb670
movq 0x70(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x68(%rsp), %rdx
movl 0x64(%rsp), %ecx
movq 0xa0(%rsp), %r8
callq 0x12660
movq %rax, 0x40(%rsp)
movq 0x78(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0xac50
movl 0x8c(%rsp), %edi
addl $0x1, %edi
movq 0x80(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %r8
movl 0x64(%rsp), %r9d
movq 0xa0(%rsp), %r10
movq 0xa8(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x12ea0
movq %rax, 0x50(%rsp)
movq 0x78(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0xb750
movq 0xa0(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x20000
movq 0x80(%rsp), %rax
cmpl $0x0, (%rax)
jg 0x13098
movq 0x50(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x131dc
movq 0x78(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0xaba0
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0xaba0
movq 0x78(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0xa0(%rsp), %rdx
callq 0x12960
movq %rax, 0x38(%rsp)
movq 0x70(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0xb750
movl 0x8c(%rsp), %edi
addl $0x1, %edi
movq 0x80(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %r8
movl 0x64(%rsp), %r9d
movq 0xa0(%rsp), %r10
movq 0xa8(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x12ea0
movq %rax, 0x48(%rsp)
movq 0x70(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0xac50
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x18(%rax), %edi
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movl 0x18(%rax), %esi
movq 0x58(%rsp), %rax
movq (%rax), %rdx
movq 0x78(%rsp), %rcx
movq 0xa8(%rsp), %r8
callq 0xb670
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x58(%rsp), %rsi
callq 0x1f410
movq 0xa0(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x20000
movq 0xa0(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x20000
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xbd60
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
nopl (%rax)