// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/lwmr_initAndCollect.c
// Function: getFrequentDirectedEdges
static void getFrequentDirectedEdges(struct Graph** db, int dbSize, int initialResultSetSize, struct Vertex* frequentEdges, struct GraphPool* gp) {
	int i = 0;
	struct compInfo* results = NULL;
	int resultSize = 0;

	if (initialResultSetSize > 0) {
		results = getResultVector(initialResultSetSize);
		resultSize = initialResultSetSize;
	}

	/* iterate over all graphs in the database */
	for (i=0; i<dbSize; ++i) {
		struct Graph* g = db[i];
		int v;

		/* frequency of an edge increases by one if there exists a pattern for the current graph (a spanning tree)
		that contains the edge. Thus we need to find all edges contained in any spanning tree and then add them
		to frequentEdges once omitting multiplicity */
		struct Vertex* containedEdges = getVertex(gp->vertexPool);

		/* init temporary result storage if necessary */
		int neededResultSize = g->m;
		int resultPos = 0;
		if (neededResultSize > resultSize) {
			if (results) {
				free(results);
			}

			results = getResultVector(neededResultSize);
			resultSize = neededResultSize;
		}

		for (v=0; v<g->n; ++v) {
			struct VertexList* e;
			for (e=g->vertices[v]->neighborhood; e!=NULL; e=e->next) {

				/* as for vertices, I use specialized code to generate
				the canonical string of a single directed edge */

				/* cString = v (e w) */
				struct VertexList* cString;
				cString = getTerminatorEdge(gp->listPool);

				struct VertexList* tmp = getVertexList(gp->listPool);
				tmp->label = e->endPoint->label;
				tmp->next = cString;

				cString = getVertexList(gp->listPool);
				cString->label = e->label;
				cString->next = tmp;

				tmp = getInitialisatorEdge(gp->listPool);
				tmp->next = cString;

				cString = getVertexList(gp->listPool);
				cString->label = e->startPoint->label;
				cString->next = tmp;

				/* add the string to the search tree */
				containedEdges->d += addStringToSearchTree(containedEdges, cString, gp);
				containedEdges->number += 1;
			}
		}

		/* set multiplicity of patterns to 1 and add to global edge pattern set */
		resetToUnique(containedEdges);
		mergeSearchTrees(frequentEdges, containedEdges, 1, results, &resultPos, frequentEdges, 0, gp);
		dumpSearchTree(gp, containedEdges);
	}

	if (results) {
		free(results);
	}
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
movl %edx, 0x78(%rsp)
movq %rcx, 0x70(%rsp)
movq %r8, 0x68(%rsp)
movl $0x0, 0x64(%rsp)
movq $0x0, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
cmpl $0x0, 0x78(%rsp)
jle 0x1df27
movl 0x78(%rsp), %edi
callq 0x2c430
movq %rax, 0x58(%rsp)
movl 0x78(%rsp), %eax
movl %eax, 0x54(%rsp)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
cmpl 0x7c(%rsp), %eax
jge 0x1e170
movq 0x80(%rsp), %rax
movslq 0x64(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x48(%rsp)
movq 0x68(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f6a0
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x54(%rsp), %eax
jle 0x1dfac
cmpq $0x0, 0x58(%rsp)
je 0x1df96
movq 0x58(%rsp), %rdi
callq 0x1030
movl 0x34(%rsp), %edi
callq 0x2c430
movq %rax, 0x58(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x54(%rsp)
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
movq 0x48(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x1e110
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x44(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x1e0fe
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x8fc0
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1f310
movq %rax, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1f310
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x9000
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1f310
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x38(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x68(%rsp), %rdx
callq 0x2bcf0
movsbl %al, %ecx
movq 0x38(%rsp), %rax
addl 0x28(%rax), %ecx
movl %ecx, 0x28(%rax)
movq 0x38(%rsp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x1dfe0
jmp 0x1e100
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x1dfb4
movq 0x38(%rsp), %rdi
callq 0x2c920
movq 0x70(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x58(%rsp), %rcx
movq 0x70(%rsp), %r9
movq 0x68(%rsp), %rax
movl $0x1, %edx
leaq 0x30(%rsp), %r8
xorl %r10d, %r10d
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2c650
movq 0x68(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x2d3c0
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x1df2f
cmpq $0x0, 0x58(%rsp)
je 0x1e182
movq 0x58(%rsp), %rdi
callq 0x1030
addq $0x88, %rsp
retq
nopw (%rax,%rax)