// File: /workspace/github_c_makefile_star2_O3/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, %r13
movq %rdx, (%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
movq %rcx, %rdi
callq 0x1498d
movq %rax, 0x8(%rsp)
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x1148e
xorl %ecx, %ecx
xorl %r12d, %r12d
movq (%rsp), %rax
movq 0x10(%rax), %rdi
movq %rcx, %rbx
callq 0x1447e
movq %rax, %rbp
movq (%r14), %rax
movq %rax, (%rbp)
movq %rbx, 0x10(%rbp)
incl %r12d
movq %r14, 0x18(%rsp)
movq 0x18(%r14), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x11477
movq %rbp, 0x20(%rsp)
movq 0x18(%r15), %rax
movq 0x8(%rax), %r14
testq %r14, %r14
je 0x11462
movq %r15, 0x28(%rsp)
movq %r12, 0x30(%rsp)
movq 0x10(%r13), %rdi
callq 0x141f1
movq %rax, %rbx
movq 0x20(%rsp), %r12
movq %r12, 0x10(%rax)
movq (%r15), %rax
movq %rax, (%rbx)
movq (%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1447e
movq %rax, 0x18(%rbx)
movq (%r14), %rcx
movq %rcx, (%rax)
movq %r13, %r15
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x848a
movq (%r12), %rdi
movq 0x18(%rbx), %r12
movq (%r12), %rsi
callq 0x1140
movq %r12, %rcx
testl %eax, %eax
je 0x1143c
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x7c08
movq %r13, %rdi
movq %rax, %rsi
callq 0x848a
movq 0x18(%rbx), %rcx
movq %rbp, 0x10(%rcx)
movq 0x30(%rsp), %r12
incl %r12d
movq 0x8(%r14), %r14
movq %rcx, %rbp
testq %r14, %r14
movq %r15, %r13
movq 0x28(%rsp), %r15
jne 0x113bf
jmp 0x11465
movq %rbp, %rcx
movq 0x8(%r15), %r15
movq %rcx, %rbp
testq %r15, %r15
jne 0x113a9
jmp 0x1147a
movq %rbp, %rcx
movq 0x18(%rsp), %r14
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0x11365
jmp 0x11493
xorl %r12d, %r12d
xorl %ecx, %ecx
movq %rcx, %r15
movq 0x8(%rsp), %r14
movq (%r14), %rbx
testq %rbx, %rbx
je 0x11501
cmpl $0x0, 0x28(%rbx)
jne 0x114bb
movl $0x1, 0x28(%rbx)
movq (%rbx), %rdi
callq 0x14a88
movq %rax, (%rbx)
movq 0x10(%rbx), %rax
cmpl $0x0, 0x24(%rax)
jne 0x114db
movl $0x1, 0x24(%rax)
movq (%rax), %rdi
callq 0x14a88
movq 0x10(%rbx), %rcx
movq %rax, (%rcx)
movq 0x18(%rbx), %rax
cmpl $0x0, 0x24(%rax)
jne 0x114fb
movl $0x1, 0x24(%rax)
movq (%rax), %rdi
callq 0x14a88
movq 0x18(%rbx), %rcx
movq %rax, (%rcx)
movq 0x8(%rbx), %rbx
jmp 0x1149e
movq (%rsp), %rdi
callq 0x146a9
movq 0x10(%rsp), %rbx
movq %rax, (%rbx)
movq %rax, %rdi
movl %r12d, %esi
callq 0x7e6c
testl %r12d, %r12d
jle 0x1153e
movl %r12d, %eax
xorl %ecx, %ecx
movq (%rbx), %rdx
movq 0x10(%rdx), %rdx
movq %r15, (%rdx,%rcx,8)
incq %rcx
movq 0x10(%r15), %r15
cmpq %rcx, %rax
jne 0x11527
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq