// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/listComponents.c
// Function: _tarjanFBC
struct ShallowGraph* __tarjanFBC(struct Vertex *v, struct Vertex* w, int i, struct VertexList* stack, struct ListPool* lp, struct ShallowGraphPool* gp) {
	struct VertexList *index, *stackEdge;

	struct ShallowGraph* graphList = NULL;
	struct ShallowGraph* tmp;

	/* set the lowest occurrence of a vertex in the current cycle to the current vertex */
	v->lowPoint = i + 1;
	/* assign dfs-numbers */
	v->visited = i + 1;

	for (index = v->neighborhood; index; index = index->next) {
		if (!(index->endPoint->visited)) {
			/* add copy of the current edge to stack of edges, head of the stack remains the head! */
			stack->next = push(stack->next, shallowCopyEdge(index, lp));

			/* recursive call */
			tmp = __tarjanFBC(index->endPoint, v, i + 1, stack, lp, gp);

			/* add output to component list */
			graphList = addComponent(graphList, tmp);

			/* TODO comment */
			v->lowPoint = min(v->lowPoint, index->endPoint->lowPoint);

			if (index->endPoint->lowPoint >= v->visited) {

				/* start new biconnected component */
				struct ShallowGraph* newBiconnectedComponent = getShallowGraph(gp);
				for (stackEdge = stack->next; stackEdge->startPoint->visited >= index->endPoint->visited; stackEdge = stack->next) {
					/* pop stackEdge and add it to the newBiconnectedComponent */
					stack->next = stackEdge->next;
					pushEdge(newBiconnectedComponent, stackEdge);
//					newBiconnectedComponent->edges = push(newBiconnectedComponent->edges, stackEdge);
//					++(newBiconnectedComponent->m);
				}

				/* pop index edge */
				stack->next = stackEdge->next;
				pushEdge(newBiconnectedComponent, stackEdge);
//				newBiconnectedComponent->edges = push(newBiconnectedComponent->edges, stackEdge);
//				++(newBiconnectedComponent->m);

				/* set the prev and next pointers s.t. newBiconnectedComponent is "a cycle of length 1" */
				newBiconnectedComponent->next = newBiconnectedComponent;
				newBiconnectedComponent->prev = newBiconnectedComponent;

				/* add new biconnected component to the list of components */
				graphList = addComponent(graphList, newBiconnectedComponent);
			}
		} else {
			/* if the edge leads to a vertex that was already visited and is not the edge on which we 
			entered the vertex, we have found a cycle and add the edge to the stack. */
			if ((index->endPoint->visited < v->visited) && (index->endPoint->number != w->number)) {
				/* add index to the edge stack */
				stack->next = push(stack->next, shallowCopyEdge(index, lp));
				v->lowPoint = min(v->lowPoint, index->endPoint->visited);
			} 
		}
	}
	return graphList;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movq %r8, %r12
movq %rcx, %r15
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
incl %edx
movl %edx, 0x20(%rdi)
movl %edx, 0xc(%rsp)
movl %edx, 0x1c(%rdi)
movq $0x0, (%rsp)
movq %rdi, %r13
movq 0x8(%r13), %r13
testq %r13, %r13
je 0x9496
movq 0x18(%r13), %rax
movl 0x1c(%rax), %ecx
testl %ecx, %ecx
je 0x93c8
cmpl 0x1c(%rbx), %ecx
jge 0x936c
movl 0x18(%rax), %eax
movq 0x20(%rsp), %rcx
cmpl 0x18(%rcx), %eax
je 0x936c
movq 0x8(%r15), %rbp
movq %r13, %rdi
movq %r12, %rsi
callq 0x5a28
movq %rbp, %rdi
movq %rax, %rsi
callq 0x5a68
movq %rax, 0x8(%r15)
movl 0x20(%rbx), %edi
movq 0x18(%r13), %rax
movl 0x1c(%rax), %esi
callq 0x751c
movl %eax, 0x20(%rbx)
jmp 0x936c
movq 0x8(%r15), %rbp
movq %r13, %rdi
movq %r12, %rsi
callq 0x5a28
movq %rbp, %rdi
movq %rax, %rsi
callq 0x5a68
movq %rax, 0x8(%r15)
movq 0x18(%r13), %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
movq %r15, %rcx
movq %r12, %r8
movq %r14, %r9
callq 0x9336
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x656a
movq %rax, (%rsp)
movl 0x20(%rbx), %edi
movq 0x18(%r13), %rax
movl 0x20(%rax), %esi
callq 0x751c
movl %eax, 0x20(%rbx)
movq 0x18(%r13), %rax
movl 0x20(%rax), %eax
cmpl 0x1c(%rbx), %eax
jl 0x936c
movq %r12, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %r14, %rdi
callq 0x117e9
movq %rax, %rbp
movq 0x8(%r15), %rsi
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movl 0x1c(%rcx), %r14d
movq 0x18(%r13), %rcx
movl 0x1c(%rcx), %r12d
movq %rax, 0x8(%r15)
movq %rbp, %rdi
callq 0x61e7
cmpl %r12d, %r14d
jge 0x9446
movq %rbp, 0x18(%rbp)
movq %rbp, 0x20(%rbp)
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x656a
movq %rax, (%rsp)
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r12
jmp 0x936c
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)