// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/cs_Outerplanar.c
// Function: _getCycleAndDiagonals
struct ShallowGraph* __getCycleAndDiagonals(struct Graph* g, struct ShallowGraphPool* sgp) {
	/* data structures described by Mitchell[1979] */
	struct ShallowGraph* list = getShallowGraph(sgp);
	struct ShallowGraph* pairs = getShallowGraph(sgp);
	struct ShallowGraph* edges = getGraphEdges(g, sgp);
	struct VertexList* node = NULL;
	struct VertexList* pair = NULL;
	/* data structures for canonical string computation */
	struct ShallowGraph* hamiltonianCycle = getShallowGraph(sgp);
	struct ShallowGraph* diagonals = getShallowGraph(sgp);
	/* data structures for sorting */
	struct VertexList** edgeArray;
	struct VertexList** pairArray;
	/* indices */
	struct VertexList* idx;
	int i, j, k;
	int n = 0;
	char found;


	/*
	 * Get a list "list" of vertices of degree 2 and mark them as such in the graph
	 * by setting ->d = 1. Also, count the number of not-NULL vertices.
	 * This is useful if the algorithm gets some "induced subgraph" where some
	 * vertices are not used.
	 */
	for (i=0; i<g->n; ++i) {
		if (g->vertices[i]) {

			++n;

			/* if vertex has degree 2, add it to list and mark it as such */
			if (isDegreeTwoVertex(g->vertices[i])) {
				struct VertexList* e = getVertexList(sgp->listPool);
				e->endPoint = g->vertices[i];
				pushEdge(list, e);

				g->vertices[i]->d = 1;
			}
		}
	}

	/* first check. number of edges ok ? */
	if (g->m > 2 * n - 3) {
		/* printf("incorrect edge count\n"); */
		dumpShallowGraph(sgp, list);
		dumpShallowGraph(sgp, pairs);
		dumpShallowGraph(sgp, edges);
		dumpShallowGraph(sgp, hamiltonianCycle);
		dumpShallowGraph(sgp, diagonals);
		return NULL;
	}

	/* second check: enough vertices of degree 2? */
	if (list->m < 2) {
		/* printf("not enough vertices of degree 2\n"); */
		dumpShallowGraph(sgp, list);
		dumpShallowGraph(sgp, pairs);
		dumpShallowGraph(sgp, edges);
		dumpShallowGraph(sgp, hamiltonianCycle);
		dumpShallowGraph(sgp, diagonals);
		return NULL;
	}

	/*
	 * Successively remove vertices of degree 2
	 */
	for (i=1, node=list->edges; /*node && */  (i<=n-2);  ++i, node=node->next) {

		struct Vertex* v = node->endPoint;

		/* near and next are the two vertices adjacent to node */
		struct Vertex* near = v->neighborhood->endPoint;
		struct Vertex* next = v->neighborhood->next->endPoint;

		/* if the edges leading to near and next are artificial triangulation
		 * edges that were added below in a previous step, add them to the
		 * edges list. Do it s.t. startPoint->number <= endPoint->number, as
		 * there will be lexicographic sorting */
		if (v->neighborhood->flag) {
			if (v->number < near->number) {
				appendEdge(edges, shallowCopyEdge(v->neighborhood, sgp->listPool));
			} else {
				appendEdge(edges, inverseEdge(v->neighborhood, sgp->listPool));
			}
		}
		if (v->neighborhood->next->flag) {
			if (v->number < next->number) {
				appendEdge(edges, shallowCopyEdge(v->neighborhood->next, sgp->listPool));
			} else {
				appendEdge(edges, inverseEdge(v->neighborhood->next, sgp->listPool));
			}
		}

		/* canonical string: add the edges to hamiltonianCycle, if they are no triangulation
		 * edges (artificial or original!). Which is recorded in ->used */
		if (!v->neighborhood->used) {
			appendEdge(hamiltonianCycle, shallowCopyEdge(v->neighborhood, sgp->listPool));
		}
		if (!v->neighborhood->next->used) {
			appendEdge(hamiltonianCycle, shallowCopyEdge(v->neighborhood->next, sgp->listPool));
		}

		/* add the pair (near, next) to pairs list, sort lexicographically
		 we have to add pair to the adjacency list of the graph, if this edge
		 does not already exist. Mark newly added edges in the flag tag. */
		pair = getVertexList(sgp->listPool);

		if (near->number < next->number) {

			pair->startPoint = near;
			pair->endPoint = next;

			/* this is for the case where g is not maximal outerplanar and
			 * a "triangulation edge" is added */
			if (!isIncident(near, next)) {
				struct VertexList* tmp = shallowCopyEdge(pair, sgp->listPool);
				tmp->flag = 1;
				addEdge(near, tmp);

				tmp = inverseEdge(pair, sgp->listPool);
				tmp->flag = 1;
				addEdge(next, tmp);
			} else {
				/* it the edge is an original edge of g, it is a diagonal and will be stored in
				 * diagonals (if that has not already been done). */
				for (idx=near->neighborhood; idx; idx=idx->next) {
					if (idx->endPoint == next) {
						if (!idx->flag && !idx->used) {
							appendEdge(diagonals, shallowCopyEdge(idx, sgp->listPool));
						}
						break;
					}
				}
			}
		} else {

			pair->startPoint = next;
			pair->endPoint = near;

			/* this is for the case where g is not maximal outerplanar and
			 * a "triangulation edge" is added */
			if (!isIncident(near, next)) {
				struct VertexList* tmp = shallowCopyEdge(pair, sgp->listPool);
				tmp->flag = 1;
				addEdge(next, tmp);

				tmp =  inverseEdge(pair, sgp->listPool);
				tmp->flag = 1;
				addEdge(near, tmp);
			} else {
				/* it the edge is an original edge of g, it is a diagonal and will be stored in
				 * diagonals (if that has not already been done). */
				for (idx=near->neighborhood; idx; idx=idx->next) {
					if (idx->endPoint == next) {
						if (!idx->flag && !idx->used) {
							appendEdge(diagonals, shallowCopyEdge(idx, sgp->listPool));
						}
						break;
					}
				}
			}
		}

		pushEdge(pairs, pair);

		/* canonical string: mark the new edge as triangulation edge via ->used */
		for (idx=near->neighborhood; idx; idx=idx->next) {
			if (idx->endPoint == next) {
				idx->used = 1;
			}
		}
		for (idx=next->neighborhood; idx; idx=idx->next) {
			if (idx->endPoint == near) {
				idx->used = 1;
			}
		}

		/* remove node from Graph, check if one of the neighbors
		 * becomes degree two vertex. If it is not already in list
		 * (which is encoded in ->d), add it to list.
		 *
		 * TODO ?
		 * BUG: not degree two vertex, but 2-vertex. this is a difference
		 * But 2-vertices make no sense in the context of ops */
		removeEdge(near, v, sgp->listPool);
		if (isDegreeTwoVertex(near)) {
			if (!near->d) {
				struct VertexList* e = getVertexList(sgp->listPool);
				e->endPoint = near;
				/* printf("add %i to list of deg 2 vertices\n", near->number); */
				appendEdge(list, e);
				near->d = 1;
			}
		}

		removeEdge(next, v, sgp->listPool);
		if (isDegreeTwoVertex(next)) {
			if (!next->d) {
				struct VertexList* e = getVertexList(sgp->listPool);
				/* printf("add %i to list of deg 2 vertices\n", next->number); */
				e->endPoint = next;
				appendEdge(list, e);
				next->d = 1;
			}
		}


		/* Here, the vertex should be removed from the graph. But the edges in
		 * hamiltonianCycle point to the vertices. We need them for the computation
		 * of the actual cycle. so we only dump the neighborhood of v. */
		dumpVertexListRecursively(sgp->listPool, v->neighborhood);
		v->neighborhood = NULL;


		/* this part may be omitted as it seems to be the case that
		 * "searching the list of pairs for an occurrence of something that
		 * is not in the list of edges includes an abort if there are e.g.
		 * two copies of an edge in pairs, but only one copy f that edge in
		 * edges.
		 *
		/ * mistake in the paper. one has to check, if the new edge
		 * is not contained in more than two triangles. As one triangle
		 * is already deleted by removing v there can be only one other
		 * triangle left without violation of this condition in the former
		 * graph */
		if (commonNeighborCount(near, next) > 1) {
			/* printf("removing node %i creates an edge that lies on more than two triangles\n", node->endPoint->number); */
			dumpShallowGraph(sgp, list);
			dumpShallowGraph(sgp, pairs);
			dumpShallowGraph(sgp, edges);
			dumpShallowGraph(sgp, hamiltonianCycle);
			dumpShallowGraph(sgp, diagonals);
			return NULL;
		}



		/* at this point, node->endPoint should be dumped, but this is not necessary
		 * as it is not considered any more and can be handled when dumping the whole
		 * graph
		dumpVertexList(sgp->listPool, popEdge(list)); */

		if (list->m - i < 2) {
			/* printf("removing node %i leaves not enough degree 2 vertices\n", node->endPoint->number); */
			dumpShallowGraph(sgp, list);
			dumpShallowGraph(sgp, pairs);
			dumpShallowGraph(sgp, edges);
			dumpShallowGraph(sgp, hamiltonianCycle);
			dumpShallowGraph(sgp, diagonals);
			return NULL;
		}
	}

	/* add the last edge (near, next) to edges */
	appendEdge(edges, shallowCopyEdge(pair, sgp->listPool));

	/* check for occurrence of something in pairs, that is not in edges
	 * for this, sort the two lists in lexicographic order and sweep through
	 * the two arrays afterwards */
	edgeArray = malloc(edges->m * sizeof(struct VertexList*));
	for (i=0, idx=edges->edges; i<edges->m; ++i, idx=idx->next) {
		edgeArray[i] = idx;
	}

	pairArray = malloc(pairs->m * sizeof(struct VertexList*));
	for (i=0, idx=pairs->edges; i<pairs->m; ++i, idx=idx->next) {
		pairArray[i] = idx;
	}

	qsort(pairArray, pairs->m, sizeof(struct VertexList*), &compareDirectedEdges);
	qsort(edgeArray, edges->m, sizeof(struct VertexList*), &compareDirectedEdges);


	/* sweep */
	for (j=0, k=0, found=1; j<pairs->m; ++j) {

		/* increment currentEdge as long as it is lex. smaller than sweeper. */
		for (; compareDirectedEdges(&(pairArray[j]), &(edgeArray[k])) > 0; ++k);

		/* check if the two are equal */
		if (compareDirectedEdges(&(pairArray[j]), &(edgeArray[k])) == 0) {
			++k;
			continue;

		} else {
			/* this is bad, g is no mop */
			found = 0;
			break;
		}
	}

	/* preliminary garbage collection */
	dumpShallowGraph(sgp, list);
	dumpShallowGraph(sgp, pairs);
	dumpShallowGraph(sgp, edges);
	free(edgeArray);
	free(pairArray);

	/* create canonical string of this block or return NULL,
	 * if the block is not outerplanar */
	if (found) {
		struct VertexList* e;
		struct VertexList* lastEdge = NULL;

		/* delete all edges that remain in g. That is exactly one. Store one copy of it
		 * in case that this edge belongs to the hamiltonian cycle. */
		for (i=0; i<g->n; ++i) {
			if (g->vertices[i]->neighborhood) {
				dumpVertexListRecursively(sgp->listPool, lastEdge);
				lastEdge = g->vertices[i]->neighborhood;
				g->vertices[i]->neighborhood = NULL;
			}
		}

		/* add edges in hamiltonianCycle to g */
		while ((e = popEdge(hamiltonianCycle))) {
			e->next = e->startPoint->neighborhood;
			e->startPoint->neighborhood = e;

			e = inverseEdge(e, sgp->listPool);
			e->next = e->startPoint->neighborhood;
			e->startPoint->neighborhood = e;
		}

		/* hamiltonianCycle is now empty and g is a undirected cycle.
		 * Now obtain a ShallowGraph where edges are ordered correctly. */
		for (e=g->vertices[0]->neighborhood; e; e=e->endPoint->neighborhood) {

			/* remove e from the adjacency list of its startpoint */
			e->startPoint->neighborhood = e->next;
			e->next = NULL;

			/* remove inverse edge of e from adjacency list of e's endpoint
			 * remember: a vertex has exactly two neighbors except in the
			 * last iteration of this loop */
			if (e->endPoint->neighborhood->endPoint == e->startPoint) {
				struct VertexList* tmp = e->endPoint->neighborhood;
				e->endPoint->neighborhood = e->endPoint->neighborhood->next;
				dumpVertexList(sgp->listPool, tmp);
			} else {
				dumpVertexList(sgp->listPool, e->endPoint->neighborhood->next);
				e->endPoint->neighborhood->next = NULL;
			}

			/* add e to hamiltonianCycle */
			appendEdge(hamiltonianCycle, e);
		}

		/* in case the reducion phase of this algorithm reduced the last triangle
		 * onto an edge on the hamiltonian cycle of g, this edge is not yet contained
		 * in hamiltonianCycle. We have stored it in lastEdge. Add it. */
		if (hamiltonianCycle->edges->startPoint != hamiltonianCycle->lastEdge->endPoint) {
			if (hamiltonianCycle->lastEdge->endPoint == lastEdge->startPoint) {
				appendEdge(hamiltonianCycle, lastEdge);
			} else {
				appendEdge(hamiltonianCycle, inverseEdge(lastEdge, sgp->listPool));
				dumpVertexList(sgp->listPool, lastEdge);
			}
		} else {
			dumpVertexList(sgp->listPool, lastEdge);
		}

		/* special case:
		 * TODO needs theoretical background
		 * if diagonals contains exactly one edge, it may be the case that this edge is
		 * contained in the hamiltonian cycle and has to be removed.
		 * If so, this edge has been lastEdge above and is stored in
		 * hamiltonianCycle->lastEdge, we have to check for inverse edges, too. */
		if (diagonals->m == 1) {
			if ((diagonals->edges->startPoint == hamiltonianCycle->lastEdge->startPoint)
					&& (diagonals->edges->endPoint == hamiltonianCycle->lastEdge->endPoint)) {
				dumpVertexList(sgp->listPool, popEdge(diagonals));
			}
			if ((diagonals->edges->startPoint == hamiltonianCycle->lastEdge->endPoint)
					&& (diagonals->edges->endPoint == hamiltonianCycle->lastEdge->startPoint)) {
				dumpVertexList(sgp->listPool, popEdge(diagonals));
			}
		}

		/* now hamiltonianCycle is a cycle and
		 * diagonals contains the diagonals of the block. hurra! */
		hamiltonianCycle->next = diagonals;
		return hamiltonianCycle;


	} else {
		/* g is not outerplanar. return NULL. */
		dumpShallowGraph(sgp, hamiltonianCycle);
		dumpShallowGraph(sgp, diagonals);
		return NULL;
	}

	return NULL;
}

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movq %rdi, 0x128(%rsp)
movq %rsi, 0x120(%rsp)
movq 0x120(%rsp), %rdi
callq 0x1fe70
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rdi
callq 0x1fe70
movq %rax, 0x110(%rsp)
movq 0x128(%rsp), %rdi
movq 0x120(%rsp), %rsi
callq 0xb530
movq %rax, 0x108(%rsp)
movq $0x0, 0x100(%rsp)
movq $0x0, 0xf8(%rsp)
movq 0x120(%rsp), %rdi
callq 0x1fe70
movq %rax, 0xf0(%rsp)
movq 0x120(%rsp), %rdi
callq 0x1fe70
movq %rax, 0xe8(%rsp)
movl $0x0, 0xc0(%rsp)
movl $0x0, 0xcc(%rsp)
movl 0xcc(%rsp), %eax
movq 0x128(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x7d69
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xcc(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x7d51
movl 0xc0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc0(%rsp)
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xcc(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xa600
cmpb $0x0, %al
je 0x7d4f
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f310
movq %rax, 0xb0(%rsp)
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xcc(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0xb0(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x118(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0xb610
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xcc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x1, 0x28(%rax)
jmp 0x7d51
jmp 0x7d53
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x7c76
movq 0x128(%rsp), %rax
movl 0x4(%rax), %eax
movl 0xc0(%rsp), %ecx
shll %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jle 0x7dfe
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x110(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xf0(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x1ff70
movq $0x0, 0x130(%rsp)
jmp 0x8ec1
movq 0x118(%rsp), %rax
cmpl $0x2, 0x10(%rax)
jge 0x7e86
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x110(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xf0(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x1ff70
movq $0x0, 0x130(%rsp)
jmp 0x8ec1
movl $0x1, 0xcc(%rsp)
movq 0x118(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x100(%rsp)
movl 0xcc(%rsp), %eax
movl 0xc0(%rsp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jg 0x8785
movq 0x100(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, 0x98(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x7fa5
movq 0xa8(%rsp), %rax
movl 0x18(%rax), %eax
movq 0xa0(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x7f6c
movq 0x108(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
jmp 0x7fa3
movq 0x108(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa370
movq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
jmp 0x7fa5
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x8051
movq 0xa8(%rsp), %rax
movl 0x18(%rax), %eax
movq 0x98(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x8014
movq 0x108(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
jmp 0x804f
movq 0x108(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa370
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
jmp 0x8051
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x809a
movq 0xf0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x80eb
movq 0xf0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f310
movq %rax, 0xf8(%rsp)
movq 0xa0(%rsp), %rax
movl 0x18(%rax), %eax
movq 0x98(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x82a0
movq 0xa0(%rsp), %rcx
movq 0xf8(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x98(%rsp), %rcx
movq 0xf8(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0xa5a0
cmpb $0x0, %al
jne 0x81f4
movq 0xf8(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
movl $0x1, 0x24(%rax)
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0xa660
movq 0xf8(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa370
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
movl $0x1, 0x24(%rax)
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0xa660
jmp 0x829b
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
je 0x8299
movq 0xd0(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0x98(%rsp), %rax
jne 0x827e
movq 0xd0(%rsp), %rax
cmpl $0x0, 0x24(%rax)
jne 0x827c
movq 0xd0(%rsp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x827c
movq 0xe8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xd0(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
jmp 0x8299
jmp 0x8280
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
jmp 0x8208
jmp 0x829b
jmp 0x841d
movq 0x98(%rsp), %rcx
movq 0xf8(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0xa0(%rsp), %rcx
movq 0xf8(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0xa5a0
cmpb $0x0, %al
jne 0x8374
movq 0xf8(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movl $0x1, 0x24(%rax)
movq 0x98(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0xa660
movq 0xf8(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa370
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movl $0x1, 0x24(%rax)
movq 0xa0(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0xa660
jmp 0x841b
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
je 0x8419
movq 0xd0(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0x98(%rsp), %rax
jne 0x83fe
movq 0xd0(%rsp), %rax
cmpl $0x0, 0x24(%rax)
jne 0x83fc
movq 0xd0(%rsp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x83fc
movq 0xe8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xd0(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
jmp 0x8419
jmp 0x8400
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
jmp 0x8388
jmp 0x841b
jmp 0x841d
movq 0x110(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0xb610
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
je 0x848e
movq 0xd0(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0x98(%rsp), %rax
jne 0x8476
movq 0xd0(%rsp), %rax
movl $0x1, 0x20(%rax)
jmp 0x8478
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
jmp 0x8446
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
je 0x84ea
movq 0xd0(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0xa0(%rsp), %rax
jne 0x84d2
movq 0xd0(%rsp), %rax
movl $0x1, 0x20(%rax)
jmp 0x84d4
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
jmp 0x84a2
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdx
callq 0xa6a0
movq 0xa0(%rsp), %rdi
callq 0xa600
cmpb $0x0, %al
je 0x857d
movq 0xa0(%rsp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x857b
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f310
movq %rax, 0x80(%rsp)
movq 0xa0(%rsp), %rcx
movq 0x80(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x118(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0xbf70
movq 0xa0(%rsp), %rax
movl $0x1, 0x28(%rax)
jmp 0x857d
movq 0x98(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdx
callq 0xa6a0
movq 0x98(%rsp), %rdi
callq 0xa600
cmpb $0x0, %al
je 0x8607
movq 0x98(%rsp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x8605
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f310
movq %rax, 0x78(%rsp)
movq 0x98(%rsp), %rcx
movq 0x78(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x118(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0xbf70
movq 0x98(%rsp), %rax
movl $0x1, 0x28(%rax)
jmp 0x8607
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x1f460
movq 0xa8(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0xa4d0
cmpl $0x1, %eax
jle 0x86c8
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x110(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xf0(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x1ff70
movq $0x0, 0x130(%rsp)
jmp 0x8ec1
movq 0x118(%rsp), %rax
movl 0x10(%rax), %eax
subl 0xcc(%rsp), %eax
cmpl $0x2, %eax
jge 0x8759
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x110(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xf0(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x1ff70
movq $0x0, 0x130(%rsp)
jmp 0x8ec1
jmp 0x875b
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
movq 0x100(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x100(%rsp)
jmp 0x7ea4
movq 0x108(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xf8(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa310
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
movq 0x108(%rsp), %rax
movslq 0x10(%rax), %rdi
shlq $0x3, %rdi
callq 0x1170
movq %rax, 0xe0(%rsp)
movl $0x0, 0xcc(%rsp)
movq 0x108(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xd0(%rsp)
movl 0xcc(%rsp), %eax
movq 0x108(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x884a
movq 0xd0(%rsp), %rdx
movq 0xe0(%rsp), %rax
movslq 0xcc(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
jmp 0x87f3
movq 0x110(%rsp), %rax
movslq 0x10(%rax), %rdi
shlq $0x3, %rdi
callq 0x1170
movq %rax, 0xd8(%rsp)
movl $0x0, 0xcc(%rsp)
movq 0x110(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xd0(%rsp)
movl 0xcc(%rsp), %eax
movq 0x110(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x88dc
movq 0xd0(%rsp), %rdx
movq 0xd8(%rsp), %rax
movslq 0xcc(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
jmp 0x8885
movq 0xd8(%rsp), %rdi
movq 0x110(%rsp), %rax
movslq 0x10(%rax), %rsi
movl $0x8, %edx
leaq -0x26ac(%rip), %rcx     # 0x6250
callq 0x1060
movq 0xe0(%rsp), %rdi
movq 0x108(%rsp), %rax
movslq 0x10(%rax), %rsi
movl $0x8, %edx
leaq -0x26d1(%rip), %rcx     # 0x6250
callq 0x1060
movl $0x0, 0xc8(%rsp)
movl $0x0, 0xc4(%rsp)
movb $0x1, 0xbf(%rsp)
movl 0xc8(%rsp), %eax
movq 0x110(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x8a16
jmp 0x895e
movq 0xd8(%rsp), %rdi
movslq 0xc8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0xe0(%rsp), %rsi
movslq 0xc4(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x6250
cmpl $0x0, %eax
jle 0x89ab
jmp 0x8998
movl 0xc4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc4(%rsp)
jmp 0x895e
movq 0xd8(%rsp), %rdi
movslq 0xc8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0xe0(%rsp), %rsi
movslq 0xc4(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x6250
cmpl $0x0, %eax
jne 0x89f6
movl 0xc4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc4(%rsp)
jmp 0x8a00
movb $0x0, 0xbf(%rsp)
jmp 0x8a16
movl 0xc8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc8(%rsp)
jmp 0x8944
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x110(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x1ff70
movq 0xe0(%rsp), %rdi
callq 0x1030
movq 0xd8(%rsp), %rdi
callq 0x1030
cmpb $0x0, 0xbf(%rsp)
je 0x8e8b
movq $0x0, 0x68(%rsp)
movl $0x0, 0xcc(%rsp)
movl 0xcc(%rsp), %eax
movq 0x128(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x8b36
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xcc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x8(%rax)
je 0x8b1e
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x68(%rsp), %rsi
callq 0x1f460
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xcc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xcc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, 0x8(%rax)
jmp 0x8b20
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x8a91
jmp 0x8b38
movq 0xf0(%rsp), %rdi
callq 0xbef0
movq %rax, 0x70(%rsp)
cmpq $0x0, %rax
je 0x8bc0
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x70(%rsp), %rcx
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x70(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa370
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x70(%rsp), %rcx
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x8b38
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x8ccb
movq 0x70(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x70(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq 0x70(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x8c6b
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x60(%rsp), %rsi
callq 0x1f410
jmp 0x8ca2
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x1f410
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq $0x0, 0x8(%rax)
movq 0xf0(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0xbf70
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x70(%rsp)
jmp 0x8bd8
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq 0xf0(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x18(%rcx), %rax
je 0x8d63
movq 0xf0(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq 0x68(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x8d1b
movq 0xf0(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0xbf70
jmp 0x8d61
movq 0xf0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0xa370
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xbf70
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x68(%rsp), %rsi
callq 0x1f410
jmp 0x8d79
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x68(%rsp), %rsi
callq 0x1f410
movq 0xe8(%rsp), %rax
cmpl $0x1, 0x10(%rax)
jne 0x8e65
movq 0xe8(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq 0xf0(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jne 0x8df8
movq 0xe8(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq 0xf0(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jne 0x8df8
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0xe8(%rsp), %rdi
callq 0xbef0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x1f410
movq 0xe8(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq 0xf0(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jne 0x8e63
movq 0xe8(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq 0xf0(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jne 0x8e63
movq 0x120(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, (%rsp)
movq 0xe8(%rsp), %rdi
callq 0xbef0
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x1f410
jmp 0x8e65
movq 0xe8(%rsp), %rcx
movq 0xf0(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0xf0(%rsp), %rax
movq %rax, 0x130(%rsp)
jmp 0x8ec1
movq 0x120(%rsp), %rdi
movq 0xf0(%rsp), %rsi
callq 0x1ff70
movq 0x120(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x1ff70
movq $0x0, 0x130(%rsp)
movq 0x130(%rsp), %rax
addq $0x138, %rsp            # imm = 0x138
retq
nopw %cs:(%rax,%rax)