// File: /workspace/github_c_makefile_star2_O1/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 %rdx, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
testl %esi, %esi
jle 0x113df
movq %rcx, %rbx
movl %esi, %eax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq $0x0, (%rsp)
movq 0x18(%rsp), %rax
movq (%rax,%rbp,8), %r14
movq 0x10(%rbx), %rdi
callq 0x145b2
movq %rax, %r12
movl (%r14), %r15d
movl $0x0, 0xc(%rsp)
cmpl (%rsp), %r15d
jle 0x11352
testq %r13, %r13
je 0x11340
movq %r13, %rdi
callq 0x1030
movl %r15d, %edi
callq 0x1ae92
movq %rax, %r13
movl %r15d, %eax
movq %rax, (%rsp)
cmpl $0x0, (%r14)
jle 0x11398
xorl %r15d, %r15d
movq 0x18(%rbx), %rdi
callq 0x1432b
movq 0x10(%r14), %rcx
movq (%rcx,%r15,8), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1ab28
movsbl %al, %eax
addl %eax, 0x28(%r12)
incl 0x18(%r12)
incq %r15
movslq (%r14), %rax
cmpq %rax, %r15
jl 0x1135b
movq %r12, %rdi
callq 0x1b15f
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movl $0x1, %edx
movq %r13, %rcx
leaq 0xc(%rsp), %r8
movq %rdi, %r9
pushq %rbx
pushq $0x0
callq 0x1afe3
addq $0x10, %rsp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b644
incq %rbp
cmpq 0x10(%rsp), %rbp
jne 0x1130d
jmp 0x113ea
movq $0x0, (%rsp)
xorl %r13d, %r13d
testq %r13, %r13
je 0x113f7
movq %r13, %rdi
callq 0x1030
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq