// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/bipartiteMatching.c
// Function: pushRelabelMaxFlow
void pushRelabelMaxFlow(struct Graph* g, struct Vertex* s, struct Vertex* t, struct ShallowGraphPool* sgp) {

	struct ShallowGraph** activeVertices = pr_init(g, s, sgp);

	int i = 0;
	for (struct Vertex* active=popFromVertexQueue(activeVertices[i], sgp); active!=NULL; active=popFromVertexQueue(activeVertices[i], sgp)) {

		// look for allowed edges and push as much flow as possible
		char foundAllowedEdge = 0;
		for (struct VertexList* e=active->neighborhood; e!=NULL; e=e->next) {
			if (pr_isAllowedEdge(e)) {
				pr_push(e, s, t, activeVertices, sgp);
				foundAllowedEdge = 1;

				// if vertex lost its 'active' state, stop looping
				if (active->visited == 0) {
					break;
				}
			}
		}

		// if there are no allowed edges (left), relabel v
		if (!foundAllowedEdge) {
			i = pr_relabel(active);
			addToVertexQueue(active, activeVertices[i], sgp);
		} else {
			if (active->visited != 0) {
				addToVertexQueue(active, activeVertices[i], sgp);
			}
		}

		if (peekFromVertexQueue(activeVertices[i]) == NULL) {
			i = pr_findSmallestActiveIndex(activeVertices, i);
		}
	}

	// garbage collection
	for (i=0; i<2 * g->n - 1; ++i) {
		dumpShallowGraph(sgp, activeVertices[i]);
	}
	free(activeVertices);
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x1760
movq %rax, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x28(%rsp), %rsi
callq 0x328c0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x1707
movb $0x0, 0xf(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
je 0x165a
movq (%rsp), %rdi
callq 0x1870
cmpl $0x0, %eax
je 0x164a
movq (%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
callq 0x18e0
movb $0x1, 0xf(%rsp)
movq 0x10(%rsp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x1648
jmp 0x165a
jmp 0x164a
jmp 0x164c
movq (%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rsp)
jmp 0x1604
cmpb $0x0, 0xf(%rsp)
jne 0x168e
movq 0x10(%rsp), %rdi
callq 0x19b0
movl %eax, 0x1c(%rsp)
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movq 0x28(%rsp), %rdx
callq 0x32870
jmp 0x16b8
movq 0x10(%rsp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x16b6
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movq 0x28(%rsp), %rdx
callq 0x32870
jmp 0x16b8
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x32930
cmpq $0x0, %rax
jne 0x16e3
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x1a30
movl %eax, 0x1c(%rsp)
jmp 0x16e5
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x28(%rsp), %rsi
callq 0x328c0
movq %rax, 0x10(%rsp)
jmp 0x15e6
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0x40(%rsp), %rcx
movl (%rcx), %ecx
shll %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1748
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x1ff70
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x170f
movq 0x20(%rsp), %rdi
callq 0x1030
addq $0x48, %rsp
retq
nopw (%rax,%rax)