// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/treeEnumeration.c
// Function: extendPatternOnLeaves
struct Graph* extendPatternOnLeaves(struct Graph* g, struct ShallowGraph* candidateEdges, struct GraphPool* gp) {

	struct Graph* rho = NULL;

	// init visited flags
	for (int v=0; v<g->n; ++v) {
		g->vertices[v]->visited = 0;
	}

	// mark leaves and neighbors of leaves
	for (int v=0; v<g->n; ++v) {
		if (isLeaf(g->vertices[v])) {
			g->vertices[v]->visited = 1;
			g->vertices[v]->neighborhood->endPoint->visited = 1;
		}
	}

	// special case: singleton vertex should be extended, as well (even though it is not a leaf)
	if (g->n == 1) {
		g->vertices[0]->visited = 1;
	}

	// add refinement edges only at leaves and neighbors of leaves
	for (int v=0; v<g->n; ++v) {
		if (g->vertices[v]->visited) {
			for (struct VertexList* e=candidateEdges->edges; e!=NULL; e=e->next) {
				/* if the labels are compatible */
				if (strcmp(g->vertices[v]->label, e->startPoint->label) == 0) {
					struct Graph* h = refinementGraph(g, v, e, gp);
					h->next = rho;
					rho = h;
				}
			}
		}
	}
	return rho;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x30dd7
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x0, 0x1c(%rax)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x30da4
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x30e50
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xa490
cmpb $0x0, %al
je 0x30e41
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x1, 0x1c(%rax)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movl $0x1, 0x1c(%rax)
jmp 0x30e43
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x30ddf
movq 0x40(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x30e6d
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movl $0x1, 0x1c(%rax)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x30f3d
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x1c(%rax)
je 0x30f2b
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x30f29
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rsi
callq 0x1120
cmpl $0x0, %eax
jne 0x30f17
movq 0x40(%rsp), %rdi
movl 0x1c(%rsp), %esi
movq 0x10(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x309f0
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x30f19
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x30eaf
jmp 0x30f2b
jmp 0x30f2d
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x30e75
movq 0x28(%rsp), %rax
addq $0x48, %rsp
retq
nopw (%rax,%rax)