// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/lwm_initAndCollect.c
// Function: getFrequentVertices
int getFrequentVertices(struct Graph** db, int dbSize, struct Vertex* frequentVertices, struct GraphPool* gp) {
	int i = 0;
	struct compInfo* results = NULL;
	int resultSize = 0;

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

		int v;

		/* the vertices contained in g can be obtained from a single spanning tree, as all spanning trees contain
		the same vertex set. However, to omit multiplicity, we again resort to a temporary searchTree */
		struct Vertex* containedVertices = getVertex(gp->vertexPool);

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

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

		for (v=0; v<g->n; ++v) {
			/* See commented out how it would look if done by the book.
			However, this has to be fast and canonicalStringOfTree has
			too much overhead!
			    struct ShallowGraph* cString;
			    auxiliary->vertices[0]->label = patternGraph->vertices[v]->label;
			    cString = canonicalStringOfTree(auxiliary, sgp);
			    addToSearchTree(containedVertices, cString, gp, sgp); */
			struct VertexList* cString = getVertexList(gp->listPool);
			cString->label = g->vertices[v]->label;
			containedVertices->d += addStringToSearchTree(containedVertices, cString, gp);
			containedVertices->number += 1;
		}
		/* set multiplicity of patterns to 1 and add to global vertex pattern set, print to file */
		resetToUnique(containedVertices);
		mergeSearchTrees(frequentVertices, containedVertices, 1, results, &resultPos, frequentVertices, 0, gp);
		dumpSearchTree(gp, containedVertices);
	}
	if (results != NULL) {
		free(results);
	}
	return resultSize;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rdx, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
xorl %r14d, %r14d
testl %esi, %esi
cmovlel %r14d, %esi
movq %rsi, 0x20(%rsp)
xorl %r13d, %r13d
movq $0x0, (%rsp)
cmpq 0x20(%rsp), %r14
je 0xe756
movq 0x10(%rsp), %rax
movq (%rax,%r14,8), %rbp
movq 0x10(%rbx), %rdi
callq 0x114a5
movq %rax, %r12
movl (%rbp), %r15d
andl $0x0, 0xc(%rsp)
cmpl %r13d, %r15d
jle 0xe6d1
movq (%rsp), %rdi
callq 0x1030
movl %r15d, %edi
callq 0x18655
movq %rax, (%rsp)
jmp 0xe6d4
movl %r13d, %r15d
xorl %r13d, %r13d
movslq (%rbp), %rax
cmpq %rax, %r13
jge 0xe717
movq 0x18(%rbx), %rdi
callq 0x11307
movq 0x10(%rbp), %rcx
movq (%rcx,%r13,8), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x18320
movsbl %al, %eax
addl %eax, 0x28(%r12)
incl 0x18(%r12)
incq %r13
jmp 0xe6d7
movq %r12, %rdi
callq 0x188f3
movq 0x18(%rsp), %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
movq (%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %rdi, %r9
pushq %rbx
pushq $0x0
callq 0x1877e
popq %rax
popq %rcx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18dcd
incq %r14
movl %r15d, %r13d
jmp 0xe68c
movq (%rsp), %rdi
callq 0x1030
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq