// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/lwm_initAndCollect.c
// Function: getNonisomorphicSpanningTreeSamplesOfDB
static int getNonisomorphicSpanningTreeSamplesOfDB(struct Graph*** db, int k, struct GraphPool* gp, struct ShallowGraphPool* sgp) {
	struct Graph* g = NULL;
	int dbSize = 0;
	int i = 0;

	while ((g = iterateFile())) {
		struct Vertex* searchTree = getVertex(gp->vertexPool);
		struct ShallowGraph* sample = NULL;
		if (g->n < 2) {
			// a singleton is a tree. we add it / its unique spanning tree to the search tree
			addToSearchTree(searchTree, canonicalStringOfTree(g, sgp), gp, sgp);
		} else {
			// sample k spanning trees, canonicalize them and add them in a search tree (to avoid duplicates, i.e. isomorphic spanning trees)
			sample = runForEachConnectedComponent(&xsampleSpanningTreesUsingWilson, g, k, k, 1, gp, sgp);
			for (struct ShallowGraph* tree=sample; tree!=NULL; tree=tree->next) {
				if (tree->m != 0) {
					struct Graph* tmp = shallowGraphToGraph(tree, gp);
					addToSearchTree(searchTree, canonicalStringOfTree(tmp, sgp), gp, sgp);
					/* garbage collection */
					dumpGraph(gp, tmp);
				}
			}
		}

		// create a forest h of disjoint copies of the spanning trees
		struct Graph* h = NULL;
		struct ShallowGraph* strings = listStringsInSearchTree(searchTree, sgp);
		for (struct ShallowGraph* string=strings; string!=NULL; string=string->next) {
			struct Graph* tmp;
			tmp = treeCanonicalString2Graph(string, gp);
			tmp->next = h;
			h = tmp;
		}
		h = mergeGraphs(h, gp);
		h->number = g->number;
		h->activity = g->activity;

		// avoid memory leaks, access to freed memory, and free unused stuff
		hardCopyGraphLabels(h);
		dumpShallowGraphCycle(sgp, sample);
		dumpShallowGraphCycle(sgp, strings);
		dumpSearchTree(gp, searchTree);
		dumpGraph(gp, g);

		/* make space for storing graphs in array */
		if (dbSize <= i) {
			dbSize = dbSize == 0 ? 128 : dbSize * 2;
			*db = realloc(*db, dbSize * sizeof (struct Graph*));
		}
		/* store graph */
		(*db)[i] = h;
		++i;
	}

	return i;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movl %esi, 0x8c(%rsp)
movq %rdx, 0x80(%rsp)
movq %rcx, 0x78(%rsp)
movq $0x0, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
movl $0x0, 0x68(%rsp)
movb $0x0, %al
callq 0x13f30
movq %rax, 0x70(%rsp)
cmpq $0x0, %rax
je 0x1b82e
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f6a0
movq %rax, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x70(%rsp), %rax
cmpl $0x2, (%rax)
jge 0x1b5f3
movq 0x60(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x9eb0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
movq 0x80(%rsp), %rdx
movq 0x78(%rsp), %rcx
callq 0x2c520
jmp 0x1b6bf
movq 0x70(%rsp), %rsi
movl 0x8c(%rsp), %edx
movslq 0x8c(%rsp), %rcx
movq 0x80(%rsp), %r9
movq 0x78(%rsp), %rax
leaq 0xfa15(%rip), %rdi      # 0x2b030
movl $0x1, %r8d
movq %rax, (%rsp)
callq 0x2bad0
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x1b6bd
movq 0x50(%rsp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1b6a8
movq 0x50(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0xb1e0
movq %rax, 0x48(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x9eb0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
movq 0x80(%rsp), %rdx
movq 0x78(%rsp), %rcx
callq 0x2c520
movq 0x80(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x1fb30
jmp 0x1b6aa
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x50(%rsp)
jmp 0x1b639
jmp 0x1b6bf
movq $0x0, 0x40(%rsp)
movq 0x60(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x2d570
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x1b72d
movq 0x30(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0xa0f0
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x1b6e6
movq 0x40(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0xa870
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x70(%rsp), %rax
movl 0xc(%rax), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x40(%rsp), %rdi
callq 0x1a320
movq 0x78(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x20000
movq 0x78(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x20000
movq 0x80(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x2d3c0
movq 0x80(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x1fb30
movl 0x6c(%rsp), %eax
cmpl 0x68(%rsp), %eax
jg 0x1b805
cmpl $0x0, 0x6c(%rsp)
jne 0x1b7cc
movl $0x80, %eax
movl %eax, 0x14(%rsp)
jmp 0x1b7d6
movl 0x6c(%rsp), %eax
shll %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x6c(%rsp)
movq 0x90(%rsp), %rax
movq (%rax), %rdi
movslq 0x6c(%rsp), %rsi
shlq $0x3, %rsi
callq 0x11a0
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rdx
movq 0x90(%rsp), %rax
movq (%rax), %rax
movslq 0x68(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x68(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x68(%rsp)
jmp 0x1b57c
movl 0x68(%rsp), %eax
addq $0x98, %rsp
retq
nopw (%rax,%rax)