// File: mxy161610207[P]codesim/./include/MaximumWeightFlow.h
// Function: Graph::spfa(int, int)
bool spfa(int s, int t)
	{
		queue<int>q;
		for (int i = 0; i < N; i++)
		{
			dis[i] = (double)INF;
			vis[i] = false;
			pre[i] = -1;
		}
		dis[s] = 0;
		vis[s] = true;
		q.push(s);
		while (!q.empty())
		{
			int u = q.front();
			q.pop();
			vis[u] = false;
			for (int i = head[u]; i != -1; i = edge[i].next)
			{
				int v = edge[i].to;
				if (edge[i].cap > edge[i].flow &&
					dis[v] > dis[u] + edge[i].cost)
				{
					dis[v] = dis[u] + edge[i].cost;
					pre[v] = i;
					if (!vis[v])
					{
						vis[v] = true;
						q.push(v);
					}
				}
			}
		}
		if (pre[t] == -1)return false;
		else return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5190
movl $0x0, -0x6c(%rbp)
movq -0x98(%rbp), %rcx
movl -0x6c(%rbp), %eax
cmpl 0x274120(%rcx), %eax
jge 0x4f34
movq -0x98(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movsd 0x512b(%rip), %xmm0     # 0xa030
movsd %xmm0, 0x25e130(%rax,%rcx,8)
movslq -0x6c(%rbp), %rcx
movb $0x0, 0x271a00(%rax,%rcx)
movslq -0x6c(%rbp), %rcx
movl $0xffffffff, 0x2544c8(%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x4ee0
movq -0x98(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq $0x0, 0x25e130(%rax,%rcx,8)
movslq -0x14(%rbp), %rcx
movb $0x1, 0x271a00(%rax,%rcx)
leaq -0x68(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x51c0
jmp 0x4f66
jmp 0x4f68
leaq -0x68(%rbp), %rdi
callq 0x51f0
movb %al, -0x99(%rbp)
jmp 0x4f79
movb -0x99(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4f8a
jmp 0x513c
leaq -0x68(%rbp), %rdi
callq 0x5210
movq %rax, -0xa8(%rbp)
jmp 0x4f9c
movq -0xa8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x80(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5230
jmp 0x4fb3
movq -0x98(%rbp), %rax
movslq -0x80(%rbp), %rcx
movb $0x0, 0x271a00(%rax,%rcx)
movslq -0x80(%rbp), %rcx
movl 0x24a860(%rax,%rcx,4), %eax
movl %eax, -0x84(%rbp)
cmpl $-0x1, -0x84(%rbp)
je 0x5137
movq -0x98(%rbp), %rcx
movslq -0x84(%rbp), %rax
imulq $0x18, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
movl (%rax), %eax
movl %eax, -0x88(%rbp)
movslq -0x84(%rbp), %rax
imulq $0x18, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
movl 0x8(%rax), %eax
movslq -0x84(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jle 0x5112
movq -0x98(%rbp), %rax
movslq -0x88(%rbp), %rcx
movsd 0x25e130(%rax,%rcx,8), %xmm0
movslq -0x80(%rbp), %rcx
movsd 0x25e130(%rax,%rcx,8), %xmm1
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
addsd 0x10(%rax), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5112
movq -0x98(%rbp), %rax
movslq -0x80(%rbp), %rcx
movsd 0x25e130(%rax,%rcx,8), %xmm0
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
addsd 0x10(%rcx), %xmm0
movslq -0x88(%rbp), %rcx
movsd %xmm0, 0x25e130(%rax,%rcx,8)
movl -0x84(%rbp), %edx
movslq -0x88(%rbp), %rcx
movl %edx, 0x2544c8(%rax,%rcx,4)
movslq -0x88(%rbp), %rcx
testb $0x1, 0x271a00(%rax,%rcx)
jne 0x5110
movq -0x98(%rbp), %rax
movslq -0x88(%rbp), %rcx
movb $0x1, 0x271a00(%rax,%rcx)
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x51c0
jmp 0x50f7
jmp 0x5110
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5250
jmp 0x5186
jmp 0x5112
jmp 0x5114
movq -0x98(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x84(%rbp)
jmp 0x4fd7
jmp 0x4f68
movq -0x98(%rbp), %rax
movslq -0x18(%rbp), %rcx
cmpl $-0x1, 0x2544c8(%rax,%rcx,4)
jne 0x5161
movb $0x0, -0x1(%rbp)
movl $0x1, -0x8c(%rbp)
jmp 0x516f
movb $0x1, -0x1(%rbp)
movl $0x1, -0x8c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5250
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x23f0
nop