// File: yukimasano[P]cpp_matrix/Matrix.cpp
// Function: floyd_war(Matrix&)
Matrix floyd_war(Matrix& A){
  assert(nrows(A)==ncols(A));
  int s = nrows(A);
  Matrix B(s,s);
  B= B + 999999999;
	for (int i=1; i<=s; i++){
    B.set_val(i,i,0);
  }
  for (int k=1; k<=s; k++){
		for (int i=1; i<=k; i++){
      if (A(k,i)!=0){
        B.set_val(k,i, A(k,i));
        B.set_val(i,k, A(k,i));
      }
    }
  }
  for (int k=1; k<=s; k++){
		for (int i=1; i<=s; i++){
      for (int j=1; j<=s; j++){
        if (B(i,j) > B(i,k) + B(k,j)){
          B.set_val(i,j,B(i,k)+B(k,j));
        }
      }
		}
	}
	return B;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0x78(%rsp)
movq %rdi, %rax
movq %rax, 0x80(%rsp)
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq 0xc8(%rsp), %rdi
callq 0x3ac0
movl %eax, 0x88(%rsp)
movq 0xc8(%rsp), %rdi
callq 0x3ad0
movl %eax, %ecx
movl 0x88(%rsp), %eax
cmpl %ecx, %eax
jne 0x5e07
jmp 0x5e26
leaq 0x9474(%rip), %rdi      # 0xf282
leaq 0x9334(%rip), %rsi      # 0xf149
movl $0x17b, %edx            # imm = 0x17B
leaq 0x94d6(%rip), %rcx      # 0xf2f7
callq 0x2090
movq 0xc8(%rsp), %rdi
callq 0x3ac0
movq 0x78(%rsp), %rdi
movl %eax, 0xc4(%rsp)
movb $0x0, 0xc3(%rsp)
movl 0xc4(%rsp), %edx
movl %edx, %esi
callq 0x3560
movq 0x78(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
movsd 0x9216(%rip), %xmm0     # 0xf080
callq 0x3e70
jmp 0x5e71
movq 0x78(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x41e0
jmp 0x5e85
leaq 0xb0(%rsp), %rdi
callq 0x3660
movl $0x1, 0xa0(%rsp)
movl 0xa0(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jg 0x5f1a
movq 0x78(%rsp), %rdi
movl 0xa0(%rsp), %esi
movl 0xa0(%rsp), %edx
xorps %xmm0, %xmm0
callq 0x47c0
movl 0xa0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0x5e9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0x6231
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x3660
jmp 0x6231
movl $0x1, 0x9c(%rsp)
movl 0x9c(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jg 0x604d
movl $0x1, 0x98(%rsp)
movl 0x98(%rsp), %eax
cmpl 0x9c(%rsp), %eax
jg 0x6035
movq 0xc8(%rsp), %rdi
movl 0x9c(%rsp), %esi
movl 0x98(%rsp), %edx
callq 0x36e0
movq %rax, 0x70(%rsp)
jmp 0x5f7a
movq 0x70(%rsp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x5f93
jp 0x5f93
jmp 0x601d
movl 0x9c(%rsp), %esi
movl %esi, 0x60(%rsp)
movl 0x98(%rsp), %edx
movl %edx, 0x64(%rsp)
movq 0xc8(%rsp), %rdi
callq 0x36e0
movq %rax, 0x68(%rsp)
jmp 0x5fbd
movl 0x64(%rsp), %edx
movl 0x60(%rsp), %esi
movq 0x78(%rsp), %rdi
movq 0x68(%rsp), %rax
movsd (%rax), %xmm0
callq 0x47c0
movl 0x98(%rsp), %edx
movl %edx, 0x50(%rsp)
movl 0x9c(%rsp), %esi
movl %esi, 0x54(%rsp)
movq 0xc8(%rsp), %rdi
callq 0x36e0
movq %rax, 0x58(%rsp)
jmp 0x6002
movl 0x54(%rsp), %edx
movl 0x50(%rsp), %esi
movq 0x78(%rsp), %rdi
movq 0x58(%rsp), %rax
movsd (%rax), %xmm0
callq 0x47c0
jmp 0x601f
movl 0x98(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x98(%rsp)
jmp 0x5f44
jmp 0x6037
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0x5f25
movl $0x1, 0x94(%rsp)
movl 0x94(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jg 0x6205
movl $0x1, 0x90(%rsp)
movl 0x90(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jg 0x61ed
movl $0x1, 0x8c(%rsp)
movl 0x8c(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jg 0x61d5
movq 0x78(%rsp), %rdi
movl 0x90(%rsp), %esi
movl 0x8c(%rsp), %edx
callq 0x36e0
movq %rax, 0x48(%rsp)
jmp 0x60c9
movq 0x78(%rsp), %rdi
movq 0x48(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movl 0x90(%rsp), %esi
movl 0x94(%rsp), %edx
callq 0x36e0
movq %rax, 0x40(%rsp)
jmp 0x60f7
movq 0x78(%rsp), %rdi
movq 0x40(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movl 0x94(%rsp), %esi
movl 0x8c(%rsp), %edx
callq 0x36e0
movq %rax, 0x30(%rsp)
jmp 0x6125
movsd 0x38(%rsp), %xmm0
movq 0x30(%rsp), %rax
movsd 0x28(%rsp), %xmm1
addsd (%rax), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x61bd
movq 0x78(%rsp), %rdi
movl 0x90(%rsp), %esi
movl %esi, 0x18(%rsp)
movl 0x8c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x94(%rsp), %edx
callq 0x36e0
movq %rax, 0x20(%rsp)
jmp 0x616e
movq 0x78(%rsp), %rdi
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x94(%rsp), %esi
movl 0x8c(%rsp), %edx
callq 0x36e0
movq %rax, 0x10(%rsp)
jmp 0x619c
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %esi
movq 0x78(%rsp), %rdi
movq 0x10(%rsp), %rax
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
callq 0x47c0
jmp 0x61bf
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x6096
jmp 0x61d7
movl 0x90(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x90(%rsp)
jmp 0x6077
jmp 0x61ef
movl 0x94(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x94(%rsp)
jmp 0x6058
movb $0x1, 0xc3(%rsp)
testb $0x1, 0xc3(%rsp)
jne 0x6221
movq 0x78(%rsp), %rdi
callq 0x3660
movq 0x80(%rsp), %rax
addq $0xd8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0x3660
movq 0xa8(%rsp), %rdi
callq 0x21e0
nopl (%rax,%rax)