// File: /workspace/github_cpp_makefile_star2_O2/Kingsford-Group[P]ghost2/src/writeAlternateDistances.hpp
// Function: writeAlternateDistances(Graph*, Graph*)
void writeAlternateDistances(Graph *G, Graph *H)
{
  ofstream fout((*G).getName()+"_vs_"+(*H).getName()+".df");
  AdjGraph s,t;
  s.init(G);
  t.init(H);
  MatrixXd *A = s.matrix(),
           *B = t.matrix(),
           S(*t.size(), *s.size()),
           P(*t.size(), *s.size());
  S.fill(1); P.fill(1);
  bool flag=false;
  for(int i=0;i<100;i++)
  {
      MatrixXd temp = (*B)*S*(*A);
      double tot=0, diff=0;
      for(int r=0;r<S.rows();r++)
        for(int c=0;c<S.cols();c++)
          tot+=temp(r,c)*S(r,c);
      tot = sqrt(tot);
      for(int r=0;r<S.rows();r++)
        for(int c=0;c<S.cols();c++)
          temp(r,c)/=tot;
      S=temp;
      if(i%2==0) 
      {
        for(int r=0;r<S.rows();r++)
          for(int c=0;c<S.cols();c++)
            diff+=fabs(temp(r,c)-P(r,c));
        P=S;
        if(diff<0.1)
          {cout << i << " iterations\n";flag=true; break;}
      }
      cout << "iter: " << i << "\n";
  }
  for(int r=0;r<S.rows();r++)
    for(int c=0;c<S.cols();c++)
    {
      fout << s.stringOf(c) << "\t" << t.stringOf(r) << 
             "\t" << 1.0-S(r,c) << "\n";
    }
  fout.close();
  if(!flag) cout << "didn't converge :(\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x68(%rdi), %rsi
leaq 0x70(%rsp), %r15
movq %r15, %rdi
callq 0xe7a0
leaq 0x2ca2a(%rip), %rdx     # 0x40984
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x1874a
leaq 0x68(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0xe7a0
leaq 0xc8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x19daf
leaq 0x2c9f6(%rip), %rdx     # 0x40989
leaq 0x130(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x1874a
leaq 0x198(%rsp), %rdi
leaq 0x130(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0xead0
leaq 0x130(%rsp), %rdi
callq 0xe290
leaq 0xc8(%rsp), %rdi
callq 0xe290
leaq 0x10(%rsp), %rdi
callq 0xe290
leaq 0x38(%rsp), %rdi
callq 0xe290
leaq 0x70(%rsp), %rdi
callq 0xe290
leaq 0x170(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x38(%rax)
movupd %xmm0, -0x28(%rax)
movupd %xmm0, -0x18(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x108(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movupd %xmm0, -0x38(%rax)
movupd %xmm0, -0x28(%rax)
movupd %xmm0, -0x18(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x130(%rsp), %rdi
movq %r14, %rsi
callq 0x13d70
leaq 0xc8(%rsp), %rdi
movq %rbx, %rsi
callq 0x13d70
leaq 0x10(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x130(%rsp), %rdx
callq 0x19e16
leaq 0x98(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x130(%rsp), %rdx
callq 0x19e16
movabsq $0x3ff0000000000000, %rbx # imm = 0x3FF0000000000000
leaq 0x38(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x29b8e
leaq 0x38(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0x98(%rsp), %rdi
callq 0x29b8e
movq $0x0, 0x30(%rsp)
leaq 0x70(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0xb0(%rsp), %rbp
leaq 0x98(%rsp), %rbx
xorl %r14d, %r14d
cmpl $0x64, %r14d
je 0x1433c
movq %r15, %rdi
leaq 0xd0(%rsp), %rsi
movq %r12, %rdx
callq 0x39fa0
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
leaq 0x138(%rsp), %rdx
callq 0x39fdc
movq %r13, %rdi
callq 0x19e4e
movq %rbp, %rdi
movq %rax, %rsi
callq 0x19e86
movq 0x48(%rsp), %rdi
callq 0xe670
movq 0x80(%rsp), %rdi
callq 0xe670
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r15d, %r15d
cmpq %r15, 0x18(%rsp)
jle 0x141c9
xorl %r13d, %r13d
cmpq %r13, 0x20(%rsp)
jle 0x141c4
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x18b38
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x18b38
movsd 0x60(%rsp), %xmm1
mulsd (%rax), %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
incq %r13
jmp 0x14178
incq %r15
jmp 0x1416e
movsd 0x8(%rsp), %xmm0
ucomisd 0x2bea9(%rip), %xmm0    # 0x40080
jb 0x141df
sqrtsd %xmm0, %xmm0
jmp 0x141e4
callq 0xe430
movsd %xmm0, 0x8(%rsp)
xorl %r15d, %r15d
cmpq %r15, 0x18(%rsp)
jle 0x14224
xorl %r13d, %r13d
cmpq %r13, 0x20(%rsp)
jle 0x1421f
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x18b38
movsd (%rax), %xmm0
divsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
incq %r13
jmp 0x141f7
incq %r15
jmp 0x141ed
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3b9a0
testb $0x1, %r14b
jne 0x142ee
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r15d, %r15d
cmpq %r15, 0x18(%rsp)
jle 0x142a9
xorl %r13d, %r13d
cmpq %r13, 0x20(%rsp)
jle 0x142a4
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x18b38
movsd (%rax), %xmm0
movapd %xmm0, 0x60(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x18b38
movapd 0x60(%rsp), %xmm1
subsd (%rax), %xmm1
andpd 0x2bea1(%rip), %xmm1    # 0x40130
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
incq %r13
jmp 0x14250
incq %r15
jmp 0x14246
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b9a0
movsd 0x2bdec(%rip), %xmm0    # 0x400a8
ucomisd 0x8(%rsp), %xmm0
jbe 0x142ee
movq 0x68ccd(%rip), %rdi     # 0x7cf98
movl %r14d, %esi
callq 0xe9d0
movq %rax, %rdi
leaq 0x2c6b0(%rip), %rsi     # 0x4098d
callq 0xe540
movb $0x1, %al
movq %rax, 0x30(%rsp)
xorl %r15d, %r15d
jmp 0x1431e
movq 0x68ca3(%rip), %rdi     # 0x7cf98
leaq 0x2c2a5(%rip), %rsi     # 0x405a1
callq 0xe540
movq %rax, %rdi
movl %r14d, %esi
callq 0xe9d0
movb $0x1, %r15b
movq %rax, %rdi
leaq 0x2c36a(%rip), %rsi     # 0x40683
callq 0xe540
movq 0xb0(%rsp), %rdi
callq 0xe670
incl %r14d
testb %r15b, %r15b
leaq 0x70(%rsp), %r15
jne 0x14102
xorl %ebx, %ebx
leaq 0x38(%rsp), %r14
leaq 0x2c57d(%rip), %r13     # 0x408c7
leaq 0x70(%rsp), %rbp
cmpq %rbx, 0x18(%rsp)
jle 0x14417
xorl %r12d, %r12d
cmpq %r12, 0x20(%rsp)
jle 0x1440f
movq %r14, %rdi
leaq 0x130(%rsp), %rsi
movl %r12d, %edx
callq 0x19ede
leaq 0x198(%rsp), %rdi
movq %r14, %rsi
callq 0xe4a0
movq %rax, %rdi
movq %r13, %rsi
callq 0xe540
movq %rax, %r15
movq %rbp, %rdi
leaq 0xc8(%rsp), %rsi
movl %ebx, %edx
callq 0x19ede
movq %r15, %rdi
movq %rbp, %rsi
callq 0xe4a0
movq %rax, %rdi
movq %r13, %rsi
callq 0xe540
movq %rax, %r15
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x18b38
movsd 0x2bc94(%rip), %xmm0    # 0x40070
subsd (%rax), %xmm0
movq %r15, %rdi
callq 0xe940
movq %rax, %rdi
leaq 0x2c291(%rip), %rsi     # 0x40683
callq 0xe540
movq %rbp, %rdi
callq 0xe290
movq %r14, %rdi
callq 0xe290
incq %r12
jmp 0x1435d
incq %rbx
jmp 0x1434f
leaq 0x198(%rsp), %rdi
callq 0xe7f0
testb $0x1, 0x30(%rsp)
jne 0x1443e
movq 0x68b66(%rip), %rdi     # 0x7cf98
leaq 0x2c561(%rip), %rsi     # 0x4099a
callq 0xe540
movq 0x98(%rsp), %rdi
callq 0xe670
movq 0x10(%rsp), %rdi
callq 0xe670
leaq 0xc8(%rsp), %rdi
callq 0x19efa
leaq 0x130(%rsp), %rdi
callq 0x19efa
leaq 0x198(%rsp), %rdi
callq 0xe850
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1451f
jmp 0x1451f
movq %rax, %rbx
jmp 0x14563
jmp 0x144f8
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0xe290
jmp 0x144b7
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xe290
jmp 0x144c9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xe290
jmp 0x144d8
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xe290
jmp 0x144e7
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xe290
jmp 0x14594
jmp 0x1451f
movq %rax, %rbx
jmp 0x1456d
jmp 0x1451f
movq %rax, %rbx
jmp 0x14511
movq %rax, %rbx
movq 0x48(%rsp), %rdi
callq 0xe670
movq 0x80(%rsp), %rdi
jmp 0x14551
jmp 0x14546
jmp 0x14524
movq %rax, %rbx
jmp 0x14556
movq %rax, %rbx
jmp 0x14536
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xe290
leaq 0x38(%rsp), %rdi
callq 0xe290
jmp 0x14556
jmp 0x14546
jmp 0x14546
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
callq 0xe670
movq 0x98(%rsp), %rdi
callq 0xe670
movq 0x10(%rsp), %rdi
callq 0xe670
leaq 0xc8(%rsp), %rdi
callq 0x19efa
leaq 0x130(%rsp), %rdi
callq 0x19efa
leaq 0x198(%rsp), %rdi
callq 0xe850
movq %rbx, %rdi
callq 0xe9f0