// File: /workspace/github_c_makefile_star2_O1/pwelke[P]GraphMiningTools/lwm_initAndCollect.c
// Function: edgeSearchTree2ShallowGraph
struct ShallowGraph* edgeSearchTree2ShallowGraph(struct Vertex* frequentEdges, struct Graph** newVertices, struct GraphPool* gp, struct ShallowGraphPool* sgp) {
	struct ShallowGraph* result = getShallowGraph(sgp);
	struct VertexList* e;
	struct Vertex* createdVertices = NULL;
	int nVertices = 0;
	int i;
	struct Vertex* tmp;

	for (e=frequentEdges->neighborhood; e!=NULL; e=e->next) {
		struct Vertex* v = getVertex(gp->vertexPool);
		struct VertexList* f;
		v->label = e->label;
		/* store newly created vertex in a list */
		v->next = createdVertices;
		createdVertices = v;
		++nVertices;

		for (f=e->endPoint->neighborhood->endPoint->neighborhood; f!=NULL; f=f->next) {
			struct VertexList* g;
			for (g=f->endPoint->neighborhood; g!=NULL; g=g->next) {
				struct VertexList* new = getVertexList(sgp->listPool);
				new->startPoint = v;
				new->label = f->label;
				new->endPoint = getVertex(gp->vertexPool);
				new->endPoint->label = g->label;
				pushEdge(result, new);
				/* if the edge has not identical vertex labels at both vertices,
				add the reverse edge to the output */
				if (strcmp(v->label, new->endPoint->label) != 0) {
					pushEdge(result, inverseEdge(new, sgp->listPool));
				}
				/* store newly created vertex in a list */
				new->endPoint->next = createdVertices;
				createdVertices = new->endPoint;
				++nVertices;
			}
		}
	}

	/* to avoid memory leaks, make hardcopies of the labels */
	for (e=result->edges; e!=NULL; e=e->next) {
		if (!e->isStringMaster) {
			e->isStringMaster = 1;
			e->label = copyString(e->label);
		}
		if (!e->startPoint->isStringMaster) {
			e->startPoint->isStringMaster = 1;
			e->startPoint->label = copyString(e->startPoint->label);
		}
		if (!e->endPoint->isStringMaster) {
			e->endPoint->isStringMaster = 1;
			e->endPoint->label = copyString(e->endPoint->label);
		}
	}

	/* to avoid memory leaks, make a graph containing all newly created vertices and return it*/
	*newVertices = getGraph(gp);
	setVertexNumber(*newVertices, nVertices);
	for (i=0, tmp=createdVertices; i<nVertices; ++i, tmp=tmp->next) {
		(*newVertices)->vertices[i] = tmp;
	}

	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r15
movq %rdx, (%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movq %rcx, %rdi
callq 0x14aae
movq %rax, 0x8(%rsp)
movq 0x8(%rbx), %r13
testq %r13, %r13
movq %r14, 0x10(%rsp)
je 0x1156c
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x145b2
movq (%r13), %rcx
movq %rcx, (%rax)
movq %rbx, 0x10(%rax)
incl %r12d
movq %r13, 0x18(%rsp)
movq 0x18(%r13), %rcx
movq 0x8(%rcx), %rcx
movq 0x18(%rcx), %rcx
movq 0x8(%rcx), %r14
testq %r14, %r14
je 0x11555
movq %rax, 0x20(%rsp)
movq %rax, %rbp
movq 0x18(%r14), %rax
movq 0x8(%rax), %r13
testq %r13, %r13
je 0x11540
movq %r14, 0x28(%rsp)
movq %r12, 0x30(%rsp)
movq 0x10(%r15), %rdi
callq 0x1432b
movq %rax, %rbx
movq 0x20(%rsp), %r12
movq %r12, 0x10(%rax)
movq (%r14), %rax
movq %rax, (%rbx)
movq (%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x145b2
movq %rax, 0x18(%rbx)
movq (%r13), %rcx
movq %rcx, (%rax)
movq %r15, %r14
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x840c
movq (%r12), %rdi
movq 0x18(%rbx), %rax
movq (%rax), %rsi
callq 0x1140
testl %eax, %eax
je 0x11516
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x7bdc
movq %r15, %rdi
movq %rax, %rsi
callq 0x840c
movq 0x18(%rbx), %rbx
movq %rbp, 0x10(%rbx)
movq 0x30(%rsp), %r12
incl %r12d
movq 0x8(%r13), %r13
movq %rbx, %rbp
testq %r13, %r13
movq %r14, %r15
movq 0x28(%rsp), %r14
jne 0x114a0
jmp 0x11543
movq %rbp, %rbx
movq 0x8(%r14), %r14
movq %rbx, %rbp
testq %r14, %r14
jne 0x1148a
jmp 0x11558
movq %rax, %rbx
movq 0x18(%rsp), %r13
movq 0x8(%r13), %r13
testq %r13, %r13
jne 0x11449
jmp 0x11571
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x8(%rsp), %r15
movq (%r15), %r14
testq %r14, %r14
je 0x115de
cmpl $0x0, 0x28(%r14)
jne 0x11598
movl $0x1, 0x28(%r14)
movq (%r14), %rdi
callq 0x14ba7
movq %rax, (%r14)
movq 0x10(%r14), %rax
cmpl $0x0, 0x24(%rax)
jne 0x115b8
movl $0x1, 0x24(%rax)
movq (%rax), %rdi
callq 0x14ba7
movq 0x10(%r14), %rcx
movq %rax, (%rcx)
movq 0x18(%r14), %rax
cmpl $0x0, 0x24(%rax)
jne 0x115d8
movl $0x1, 0x24(%rax)
movq (%rax), %rdi
callq 0x14ba7
movq 0x18(%r14), %rcx
movq %rax, (%rcx)
movq 0x8(%r14), %r14
jmp 0x11579
movq (%rsp), %rdi
callq 0x147d7
movq 0x10(%rsp), %r14
movq %rax, (%r14)
movq %rax, %rdi
movl %r12d, %esi
callq 0x7e30
testl %r12d, %r12d
jle 0x1161b
movl %r12d, %eax
xorl %ecx, %ecx
movq (%r14), %rdx
movq 0x10(%rdx), %rdx
movq %rbx, (%rdx,%rcx,8)
incq %rcx
movq 0x10(%rbx), %rbx
cmpq %rcx, %rax
jne 0x11604
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq