// File: ruippeixotog[P]algo-lib/min-cost-max-flow.cpp
// Function: mcmf(int, int)
pair<int, int> mcmf(int src, int sink) {
  memset(flow, false, sizeof(flow));
  memset(pi, 0, sizeof(pi));

  int minCost = 0, maxFlow = 0;
  while(dijkstra(src, sink) < INF) {
    int bot = INF;

    for(int v = sink, u = parent[v]; v != src; u = parent[v = u])
      bot = min(bot, flow[v][u] ? flow[v][u] : cap[u][v] - flow[u][v]);

    for(int v = sink, u = parent[v]; v != src; u = parent[v = u]) {
      if(flow[v][u]) { flow[v][u] = false; minCost -= cost[v][u]; }
      else { flow[u][v] = true; minCost += cost[u][v]; }
    }
    maxFlow += bot;
  }
  return make_pair(minCost, maxFlow);
}

// Assembly:
subq $0x38, %rsp
movl %edi, 0x2c(%rsp)
movl %esi, 0x28(%rsp)
leaq 0x7af7bd(%rip), %rdi    # 0x7b0f40
xorl %esi, %esi
movl $0x3d0900, %edx         # imm = 0x3D0900
callq 0x1070
leaq 0x7ae80a(%rip), %rdi    # 0x7affa0
xorl %esi, %esi
movl $0xfa0, %edx            # imm = 0xFA0
callq 0x1070
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x2c(%rsp), %edi
movl 0x28(%rsp), %esi
callq 0x1290
cvtsi2sd %eax, %xmm1
movsd 0x283d(%rip), %xmm0     # 0x4008
ucomisd %xmm1, %xmm0
jbe 0x19d5
movl $0x3b9aca00, 0x1c(%rsp) # imm = 0x3B9ACA00
movl 0x28(%rsp), %eax
movl %eax, 0x18(%rsp)
movslq 0x18(%rsp), %rcx
leaq 0x7ad80f(%rip), %rax    # 0x7af000
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x2c(%rsp), %eax
je 0x18c6
movslq 0x18(%rsp), %rcx
leaq 0x7af72e(%rip), %rax    # 0x7b0f40
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0x14(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x184b
movslq 0x18(%rsp), %rcx
leaq 0x7af70d(%rip), %rax    # 0x7b0f40
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0x14(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x4(%rsp)
jmp 0x188b
movslq 0x14(%rsp), %rcx
leaq 0x3dbf09(%rip), %rax    # 0x3dd760
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0x18(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movslq 0x14(%rsp), %rdx
leaq 0x7af6cb(%rip), %rcx    # 0x7b0f40
imulq $0xfa0, %rdx, %rdx      # imm = 0xFA0
addq %rdx, %rcx
movslq 0x18(%rsp), %rdx
subl (%rcx,%rdx,4), %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x10(%rsp)
leaq 0x1c(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1ce0
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x18(%rsp)
movslq %eax, %rcx
leaq 0x7ad746(%rip), %rax    # 0x7af000
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
jmp 0x17f8
movl 0x28(%rsp), %eax
movl %eax, 0xc(%rsp)
movslq 0xc(%rsp), %rcx
leaq 0x7ad726(%rip), %rax    # 0x7af000
movl (%rax,%rcx,4), %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x2c(%rsp), %eax
je 0x19c4
movslq 0xc(%rsp), %rcx
leaq 0x7af645(%rip), %rax    # 0x7b0f40
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0x8(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x195c
movslq 0xc(%rsp), %rcx
leaq 0x7af624(%rip), %rax    # 0x7b0f40
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0x8(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movslq 0xc(%rsp), %rcx
leaq 0xb522(%rip), %rax      # 0xce60
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movl 0x24(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x24(%rsp)
jmp 0x19a4
movslq 0x8(%rsp), %rcx
leaq 0x7af5d8(%rip), %rax    # 0x7b0f40
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0xc(%rsp), %rcx
movl $0x1, (%rax,%rcx,4)
movslq 0x8(%rsp), %rcx
leaq 0xb4d6(%rip), %rax      # 0xce60
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq 0xc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
addl 0x24(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x19a6
movl 0x8(%rsp), %eax
movl %eax, 0xc(%rsp)
movslq %eax, %rcx
leaq 0x7ad648(%rip), %rax    # 0x7af000
movl (%rax,%rcx,4), %eax
movl %eax, 0x8(%rsp)
jmp 0x18e1
movl 0x1c(%rsp), %eax
addl 0x20(%rsp), %eax
movl %eax, 0x20(%rsp)
jmp 0x17b2
leaq 0x24(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x1d20
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)