// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/iterativeSubtreeIsomorphism.c
// Function: makeBipartiteInstanceFromVerticesCached
static struct Graph* makeBipartiteInstanceFromVerticesCached(struct SubtreeIsoDataStore data, struct CachedGraph* cachedB, struct Vertex* removalVertex, struct Vertex* u, struct Vertex* v, struct GraphPool* gp) {

	int sizeofX = degree(u);
	int sizeofY = degree(v);

	// if one of the neighbors of u is removed from this instance to see if there is a matching covering all neighbors but it,
	// the bipartite graph must be smaller
	if (removalVertex->number != u->number) {
		--sizeofX;
	}

	struct Graph* B = getCachedGraph(sizeofX + sizeofY, cachedB);

	/* store size of first partitioning set */
	B->number = sizeofX;

	/* add vertex numbers of original vertices to ->lowPoint of each vertex in B
	and add edge labels to vertex labels to compare edges easily */
	int i = 0;
	for (struct VertexList* e=u->neighborhood; e!=NULL; e=e->next) {
		if (e->endPoint->number != removalVertex->number) {
			B->vertices[i]->lowPoint = e->endPoint->number;
			B->vertices[i]->label = e->label;
			++i;
		}
	}
	for (struct VertexList* e=v->neighborhood; e!=NULL; e=e->next) {
		B->vertices[i]->lowPoint = e->endPoint->number;
		B->vertices[i]->label = e->label;
		++i;
	}

	/* add edge (x,y) if u in S(y,x) */
	for (i=0; i<sizeofX; ++i) {
		int x = B->vertices[i]->lowPoint;
		for (int j=sizeofX; j<B->n; ++j) {
			int y = B->vertices[j]->lowPoint;

			/* y has to be a child of v */
			if (data.g->vertices[y]->visited < v->visited) {
				/* edge labels have to match, (v, child)->label in g == (u, child)->label in h
				these values were stored in B->vertices[i,j]->label */
				if (labelCmp(B->vertices[i]->label, B->vertices[j]->label) == 0) {
					if (containsCharacteristic(data, u, data.h->vertices[x], data.g->vertices[y])) {
						addResidualEdges(B->vertices[i], B->vertices[j], gp->listPool);
						++B->m;
					}
				}
			}
		}
	}
	return B;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, 0x48(%rsp)
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r12
leaq 0x90(%rsp), %rbp
movq %rdx, %rdi
callq 0x5a8a
movl %eax, %r15d
movq %r14, %rdi
callq 0x5a8a
movl 0x18(%r13), %edx
movl 0x18(%rbx), %esi
xorl %ecx, %ecx
movl %edx, 0x38(%rsp)
movl %esi, 0x30(%rsp)
cmpl %esi, %edx
setne %cl
movl %r15d, 0x40(%rsp)
subl %ecx, %r15d
leal (%rax,%r15), %edi
movq %r12, %rsi
callq 0x1f5e
movq %rax, %r12
movq %r15, %r9
movl %r15d, 0x8(%rax)
xorl %eax, %eax
movq %rbx, 0x50(%rsp)
xorl %edx, %edx
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x7c61
movq 0x18(%rbx), %rsi
movl 0x18(%rsi), %esi
cmpl 0x18(%r13), %esi
je 0x7c2e
movq 0x10(%r12), %rdi
movl %edx, %r8d
movq (%rdi,%r8,8), %rdi
movl %esi, 0x20(%rdi)
movq (%rbx), %rsi
movq %rsi, (%rdi)
incl %edx
addq $0x8, %rax
jmp 0x7c2e
movq %r14, %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x7c8c
movq 0x18(%rcx), %rdx
movl 0x18(%rdx), %edx
movq 0x10(%r12), %rsi
movq (%rsi,%rax), %rsi
movl %edx, 0x20(%rsi)
movq (%rcx), %rdx
movq %rdx, (%rsi)
addq $0x8, %rax
jmp 0x7c64
xorl %eax, %eax
movl 0x30(%rsp), %ecx
cmpl %ecx, 0x38(%rsp)
setne %al
movslq 0x40(%rsp), %rcx
subq %rax, %rcx
movq %rcx, 0x30(%rsp)
xorl %r13d, %r13d
testl %r9d, %r9d
cmovlel %r13d, %r9d
movq %r9, 0x38(%rsp)
cmpq 0x38(%rsp), %r13
je 0x7d8e
movq 0x10(%r12), %rax
movq (%rax,%r13,8), %rax
movslq 0x20(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x30(%rsp), %r15
movslq (%r12), %rax
cmpq %rax, %r15
jge 0x7d86
movq 0x10(%r12), %rcx
movq (%rcx,%r15,8), %rax
movslq 0x20(%rax), %rbx
movq 0x8(%rbp), %rdx
movq 0x10(%rdx), %rdx
movq (%rdx,%rbx,8), %rdx
movl 0x1c(%rdx), %edx
cmpl 0x1c(%r14), %edx
jge 0x7d7e
movq (%rcx,%r13,8), %rcx
movq (%rcx), %rdi
movq (%rax), %rsi
callq 0x19340
testl %eax, %eax
jne 0x7d7e
movq 0x8(%rbp), %rax
movq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq 0x40(%rsp), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x10(%rax), %rax
movq (%rax,%rbx,8), %rdx
movq 0x20(%rbp), %rax
movq %rax, 0x20(%rsp)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x50(%rsp), %rdi
callq 0x133cf
testl %eax, %eax
je 0x7d7e
movq 0x10(%r12), %rax
movq (%rax,%r13,8), %rdi
movq (%rax,%r15,8), %rsi
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdx
callq 0x17e4
incl 0x4(%r12)
incq %r15
jmp 0x7cd7
incq %r13
jmp 0x7cb5
movq %r12, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq