// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/poset_pathCover.c
// Function: createVertexCoverFlowInstanceOfPoset
static struct Graph* createVertexCoverFlowInstanceOfPoset(struct Graph* g, struct GraphPool* gp) {
	struct Graph* flowInstance = createGraph(2 * g->n, gp);
	int maxCapacity = g->n;

	// source and sink of s-t flow instance
	struct Vertex* s = flowInstance->vertices[0];
	struct Vertex* t = flowInstance->vertices[1];

	// actual elements of poset start at vertex 1. they have infinite capacity.
	// HINT: if you ever want to change this for general graphs, consider that the
	// above s,t positions and size of flowInstance need to be changed.
	for (int v=1; v<g->n; ++v) {
		struct Vertex* vStart = flowInstance->vertices[2 * v];
		struct Vertex* vEnd = flowInstance->vertices[2 * v + 1];

		// add edge for each vertex in the original graph
		addResidualEdgesWithCapacity(vStart, vEnd, maxCapacity, gp->listPool);

		// add copy of original edges and residuals, they have infinite capacity
		for (struct VertexList* e=g->vertices[v]->neighborhood; e!=NULL; e=e->next) {
			addResidualEdgesWithCapacity(vEnd, flowInstance->vertices[2 * e->endPoint->number], maxCapacity, gp->listPool);
		}

		// add edge from s to vEnd with capacity 1
		addResidualEdgesWithCapacity(s, vEnd, 1, gp->listPool);

		// add edge from v to t
		addResidualEdgesWithCapacity(vStart, t, 1, gp->listPool);
	}

	return flowInstance;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq 0x50(%rsp), %rax
movl (%rax), %edi
shll %edi
movq 0x48(%rsp), %rsi
callq 0xb850
movq %rax, 0x40(%rsp)
movq 0x50(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x3c(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
movq 0x50(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x26cf4
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x24(%rsp), %ecx
shll %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x24(%rsp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x3c(%rsp), %edx
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rcx
callq 0x1d70
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x26caa
movq 0x10(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movl 0x18(%rcx), %ecx
shll %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
movl 0x3c(%rsp), %edx
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rcx
callq 0x1d70
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x26c5d
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rcx
movl $0x1, %edx
callq 0x1d70
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rcx
movl $0x1, %edx
callq 0x1d70
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x26bdc
movq 0x40(%rsp), %rax
addq $0x58, %rsp
retq
nop