// File: /workspace/github_c_makefile_star2_O3/pwelke[P]GraphMiningTools/graph.c
// Function: cloneInducedGraph
struct Graph* cloneInducedGraph(struct Graph* g, struct GraphPool* gp) {
	struct Graph* copy = getGraph(gp);
	struct Vertex** tmp;
	int i, j;
	int actualVertices = 0;

	copy->activity = g->activity;
	copy->m = g->m;
	copy->number = g->number;

	setVertexNumber(copy, g->n);

	/* copy vertices */
	for (i=0; i<g->n; ++i) {
		if (g->vertices[i]) {
			copy->vertices[i] = shallowCopyVertex(g->vertices[i], gp->vertexPool);
			++actualVertices;
		}
	}

	/* copy edges */
	for (i=0; i<g->n; ++i) {
		if (g->vertices[i]) {
			for (struct VertexList* e=g->vertices[i]->neighborhood; e; e=e->next) {
				struct VertexList* f = getVertexList(gp->listPool);
				f->endPoint = copy->vertices[e->endPoint->number];
				f->startPoint = copy->vertices[e->startPoint->number];
				f->label = e->label;

				/* add the shallow copy to the new graph */
				f->next = copy->vertices[e->startPoint->number]->neighborhood;
				copy->vertices[e->startPoint->number]->neighborhood = f;
			}
		}
	}

	/* up to this point, there may be elements of copy->vertices, that are NULL */
	tmp = copy->vertices;

	/* set the number of vertices correctly */
	setVertexNumber(copy, actualVertices);

	/* shift the vertices that are there into the new array and
	 * assign new numbers */
	j = 0;
	for (i=0; i<g->n; ++i) {
		if (tmp[i]) {
			copy->vertices[j] = tmp[i];
			copy->vertices[j]->lowPoint = copy->vertices[j]->number;
			copy->vertices[j]->number = j;
			++j;
		}
	}

	free(tmp);

	return copy;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x146a9
movq %rax, %rbx
movl 0xc(%r14), %eax
movl %eax, 0xc(%rbx)
movq 0x4(%r14), %rax
movq %rax, 0x4(%rbx)
movl (%r14), %esi
movq %rbx, %rdi
callq 0x7e6c
movl (%r14), %eax
testl %eax, %eax
jle 0x81eb
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x10(%r14), %rcx
movq (%rcx,%r12,8), %r13
testq %r13, %r13
je 0x8156
movq 0x10(%r15), %rdi
callq 0x1447e
movl 0x18(%r13), %ecx
movl %ecx, 0x18(%rax)
movq (%r13), %rcx
movq %rcx, (%rax)
movq 0x10(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incl %ebp
movl (%r14), %eax
incq %r12
movslq %eax, %rcx
cmpq %rcx, %r12
jl 0x8125
testl %eax, %eax
jle 0x81ed
xorl %r12d, %r12d
movq 0x10(%r14), %rcx
movq (%rcx,%r12,8), %rcx
testq %rcx, %rcx
je 0x81de
movq 0x8(%rcx), %r13
testq %r13, %r13
je 0x81de
movq 0x18(%r15), %rdi
callq 0x141f1
movq 0x10(%rbx), %rcx
movq 0x18(%r13), %rdx
movslq 0x18(%rdx), %rdx
movq (%rcx,%rdx,8), %rdx
movq %rdx, 0x18(%rax)
movq 0x10(%r13), %rdx
movslq 0x18(%rdx), %rdx
movq (%rcx,%rdx,8), %rdx
movq %rdx, 0x10(%rax)
movq (%r13), %rdx
movq %rdx, (%rax)
movq 0x10(%r13), %rdx
movslq 0x18(%rdx), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x8(%rsi), %rsi
movq %rsi, 0x8(%rax)
movq (%rcx,%rdx,8), %rcx
movq %rax, 0x8(%rcx)
movq 0x8(%r13), %r13
testq %r13, %r13
jne 0x8182
movl (%r14), %eax
incq %r12
movslq %eax, %rcx
cmpq %rcx, %r12
jl 0x816c
jmp 0x81ed
xorl %ebp, %ebp
movq 0x10(%rbx), %r15
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7e6c
movslq (%r14), %rax
testq %rax, %rax
jle 0x8236
xorl %ecx, %ecx
xorl %edx, %edx
movq (%r15,%rcx,8), %rsi
testq %rsi, %rsi
je 0x822e
movq 0x10(%rbx), %rdi
movslq %edx, %rdx
movq %rsi, (%rdi,%rdx,8)
movq 0x10(%rbx), %rsi
movq (%rsi,%rdx,8), %rsi
movl 0x18(%rsi), %edi
movl %edi, 0x20(%rsi)
movl %edx, 0x18(%rsi)
incl %edx
incq %rcx
cmpq %rcx, %rax
jne 0x8207
movq %r15, %rdi
callq 0x1030
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq