// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/listCycles.c
// Function: getNumberOfNonIsoCycles
int getNumberOfNonIsoCycles(struct Graph* g, struct ShallowGraphPool* sgp, struct GraphPool* gp) {
	struct Graph* tmp;
	struct Graph* idx;
	int numCycles;

	/* find biconnected Components */
	struct ShallowGraph* h = listBiconnectedComponents(g, sgp);
	struct Graph* forest = partitionIntoForestAndCycles(h, g, gp, sgp);
	/* TODO refactor */
	struct Graph* biconnectedComponents = forest->next;

	/* list all cycles */
	struct ShallowGraph* simpleCycles = NULL;
	struct ShallowGraph* cyclePatterns = NULL;
	struct Vertex* cyclePatternSearchTree = NULL;

	for (idx=biconnectedComponents; idx; idx=idx->next) {
		simpleCycles = addComponent(simpleCycles, listCycles(idx, sgp));
	}

	/* if cycles were found, compute canonical strings */
	if (simpleCycles) {
		/* transform cycle of shallow graphs to a list */
		simpleCycles->prev->next = NULL;
		simpleCycles->prev = NULL;

		cyclePatterns = getCyclePatterns(simpleCycles, sgp);
		cyclePatternSearchTree = buildSearchTree(cyclePatterns, gp, sgp);

		numCycles = cyclePatternSearchTree->number;
	} else {
		numCycles = 0;
	}

	/* garbage collection */

	/* dump cycles, if any
	 * TODO may be moved upwards directly after finding simple cycles */
	if (cyclePatternSearchTree) {
			dumpSearchTree(gp, cyclePatternSearchTree);
	}

	/* dump biconnected components list */
	for (idx=biconnectedComponents; idx; idx=tmp) {
		tmp = idx->next;
		dumpGraph(gp, idx);
	}

	dumpGraph(gp, forest);

	/* each cycle is found twice */
	return numCycles / 2;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x10700
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rcx
callq 0x10d30
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x11949
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x40(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x11750
movq (%rsp), %rdi
movq %rax, %rsi
callq 0xbd60
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x11908
cmpq $0x0, 0x18(%rsp)
je 0x119aa
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
movq $0x0, 0x18(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x20(%rax)
movq 0x18(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x6a00
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x2d520
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x3c(%rsp)
jmp 0x119b2
movl $0x0, 0x3c(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x119c9
movq 0x50(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x2d3c0
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x11a04
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x1fb30
movq 0x48(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0x119d3
movq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x1fb30
movl 0x3c(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)