// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rsi, 0x8(%rsp)
incl %edx
movl %edx, 0x20(%rdi)
movl %edx, 0x4(%rsp)
movl %edx, 0x1c(%rdi)
movq 0x8(%rdi), %r12
testq %r12, %r12
je 0xba27
movq %r8, %r14
movq %rcx, %r15
movq %rdi, %r13
movq %r9, 0x10(%rsp)
xorl %ebx, %ebx
movq 0x18(%r12), %rax
movl 0x1c(%rax), %ecx
testl %ecx, %ecx
je 0xb951
cmpl 0x1c(%r13), %ecx
jge 0xba17
movl 0x18(%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x18(%rcx), %eax
je 0xba17
movq 0x8(%r15), %rbp
movq %r12, %rdi
movq %r14, %rsi
callq 0x7bec
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7c2c
movq %rax, 0x8(%r15)
movl 0x20(%r13), %edi
movq 0x18(%r12), %rax
movl 0x1c(%rax), %esi
callq 0x98f0
movl %eax, 0x20(%r13)
jmp 0xba17
movq 0x8(%r15), %rbp
movq %r12, %rdi
movq %r14, %rsi
callq 0x7bec
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7c2c
movq %rax, 0x8(%r15)
movq 0x18(%r12), %rdi
movq %r13, %rsi
movl 0x4(%rsp), %edx
movq %r15, %rcx
movq %r14, %r8
movq 0x10(%rsp), %rbp
movq %rbp, %r9
callq 0xb8b6
movq %rbx, %rdi
movq %rax, %rsi
callq 0x883e
movq %rax, %rbx
movl 0x20(%r13), %edi
movq 0x18(%r12), %rax
movl 0x20(%rax), %esi
callq 0x98f0
movl %eax, 0x20(%r13)
movq 0x18(%r12), %rax
movl 0x20(%rax), %eax
cmpl 0x1c(%r13), %eax
jl 0xba17
movq %rbp, %rdi
callq 0x1498d
movq %rax, %rbp
movq 0x8(%r15), %rsi
movq 0x10(%rsi), %rax
movl 0x1c(%rax), %eax
movq 0x18(%r12), %rcx
cmpl 0x1c(%rcx), %eax
jl 0xb9f1
movq 0x8(%rsi), %rax
movq %rax, 0x8(%r15)
movq %rbp, %rdi
callq 0x848a
jmp 0xb9ca
movq 0x8(%rsi), %rax
movq %rax, 0x8(%r15)
movq %rbp, %rdi
callq 0x848a
movq %rbp, 0x18(%rbp)
movq %rbp, 0x20(%rbp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x883e
movq %rax, %rbx
movq 0x8(%r12), %r12
testq %r12, %r12
jne 0xb8f2
jmp 0xba29
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop