// File: /workspace/github_cpp_makefile_star2_O3/toxaart[P]hierarchical_block_sparse_lib/test_source/./test_utils.h
// Function: void verify_that_matrices_are_almost_equal<hbsm::HierarchicalBlockSparseMatrix<double>>(hbsm::HierarchicalBlockSparseMatrix<double> const&, hbsm::HierarchicalBlockSparseMatrix<double> const&, double)
void verify_that_matrices_are_almost_equal(const MatrixType & A,
					   const MatrixType & B,
					   double tolerance) {
  if(A.get_n_rows() != B.get_n_rows() || A.get_n_cols() != B.get_n_cols())
    throw std::runtime_error("Error: matrices do not have same dimensions.");
  SparseMatrix spA;
  A.get_all_values(spA.rows, spA.cols, spA.values);
  std::vector<double> fullMatrixA;
  spA.to_full(fullMatrixA, A.get_n_rows(), A.get_n_cols());
  SparseMatrix spB;
  B.get_all_values(spB.rows, spB.cols, spB.values);
  std::vector<double> fullMatrixB;
  spB.to_full(fullMatrixB, B.get_n_rows(), B.get_n_cols());

  assert( fullMatrixA.size() == fullMatrixB.size() );
  for(unsigned int ind=0; ind<fullMatrixA.size(); ind++) {
    if (verbose)
      std::cout << std::setw(5) << ind << "  " 
		<< std::setw(14) << fullMatrixA[ind] << "  " 
		<< std::setw(14) << fullMatrixB[ind] 
		<< std::endl;
    if(std::fabs(fullMatrixA[ind] - fullMatrixB[ind]) > tolerance)
      throw std::runtime_error("Error: matrices not almost equal.");
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x68(%rdi), %rax
movq %rdi, %rcx
testq %rax, %rax
je 0x102c5
movq %r14, %rdx
movq %rdx, %rcx
movq 0x68(%rdx), %rdx
testq %rdx, %rdx
jne 0x102b9
movl 0x8(%rcx), %edx
movq 0x68(%rbx), %rcx
movq %rbx, %rsi
testq %rcx, %rcx
je 0x102e3
movq %rbx, %rdi
movq %rdi, %rsi
movq 0x68(%rdi), %rdi
testq %rdi, %rdi
jne 0x102d7
cmpl 0x8(%rsi), %edx
jne 0x105b1
movq %r14, %rdx
testq %rax, %rax
je 0x10303
movq %r14, %rax
movq %rax, %rdx
movq 0x68(%rax), %rax
testq %rax, %rax
jne 0x102f7
movl 0xc(%rdx), %eax
movq %rbx, %rdx
testq %rcx, %rcx
je 0x1031d
movq %rbx, %rcx
movq %rcx, %rdx
movq 0x68(%rcx), %rcx
testq %rcx, %rcx
jne 0x10311
cmpl 0xc(%rdx), %eax
jne 0x105b1
movsd %xmm0, 0x38(%rsp)
xorpd %xmm0, %xmm0
leaq 0xc0(%rsp), %rcx
movapd %xmm0, (%rcx)
movapd %xmm0, -0x10(%rcx)
movapd %xmm0, -0x20(%rcx)
movapd %xmm0, -0x30(%rcx)
movq $0x0, 0x10(%rcx)
leaq 0xa8(%rsp), %rdx
leaq 0x90(%rsp), %rsi
movq %r14, %rdi
callq 0x1baba
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x68(%r14)
je 0x103a7
movq %r14, %rax
movq %rax, %rcx
movq 0x68(%rax), %rax
testq %rax, %rax
jne 0x10387
movl 0x8(%rcx), %edx
movq %r14, %rax
movq 0x68(%r14), %r14
testq %r14, %r14
jne 0x10396
movq %rax, %r14
jmp 0x103ab
movl 0x8(%r14), %edx
movl 0xc(%r14), %ecx
leaq 0x90(%rsp), %rdi
movq %rsp, %rsi
callq 0x1c50e
xorpd %xmm0, %xmm0
leaq 0x70(%rsp), %rcx
movapd %xmm0, (%rcx)
movapd %xmm0, -0x10(%rcx)
movapd %xmm0, -0x20(%rcx)
movapd %xmm0, -0x30(%rcx)
movq $0x0, 0x10(%rcx)
leaq 0x58(%rsp), %rdx
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x1baba
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
cmpq $0x0, 0x68(%rbx)
je 0x10432
movq %rbx, %rax
movq %rax, %rcx
movq 0x68(%rax), %rax
testq %rax, %rax
jne 0x10412
movl 0x8(%rcx), %edx
movq %rbx, %rax
movq 0x68(%rbx), %rbx
testq %rbx, %rbx
jne 0x10421
movq %rax, %rbx
jmp 0x10435
movl 0x8(%rbx), %edx
movl 0xc(%rbx), %ecx
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x1c50e
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
movq %rdx, %rcx
subq %rax, %rcx
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
cmpq %rsi, %rcx
movsd 0x38(%rsp), %xmm2
jne 0x105e3
cmpq %rax, %rdx
je 0x104ad
sarq $0x3, %rcx
movl $0x1, %edx
xorl %esi, %esi
movapd 0x13e66(%rip), %xmm0    # 0x242f0
movsd (%rax,%rsi,8), %xmm1
subsd (%rdi,%rsi,8), %xmm1
andpd %xmm0, %xmm1
ucomisd %xmm2, %xmm1
ja 0x1057f
movl %edx, %esi
incl %edx
cmpq %rsi, %rcx
ja 0x1048a
jmp 0x104b2
testq %rdi, %rdi
je 0x104bf
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x104d9
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x104f0
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x10507
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1051d
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x1053a
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x10557
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x10574
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %r14
leaq 0x15170(%rip), %rsi     # 0x25703
movq %rax, %rdi
callq 0x20a0
movq 0x1ba4e(%rip), %rsi     # 0x2bff0
movq 0x1ba17(%rip), %rdx     # 0x2bfc0
movq %r14, %rdi
callq 0x2290
movl $0x10, %edi
callq 0x20c0
movq %rax, %r14
leaq 0x143a4(%rip), %rsi     # 0x24969
movq %rax, %rdi
callq 0x20a0
movq 0x1ba1c(%rip), %rsi     # 0x2bff0
movq 0x1b9e5(%rip), %rdx     # 0x2bfc0
movq %r14, %rdi
callq 0x2290
leaq 0x143ac(%rip), %rdi     # 0x24996
leaq 0x143ce(%rip), %rsi     # 0x249bf
leaq 0x15075(%rip), %rcx     # 0x2566d
movl $0x5b, %edx
callq 0x2100
jmp 0x10620
movq %rax, %rbx
jmp 0x10647
movq %rax, %rbx
jmp 0x10651
movq %rax, %rbx
jmp 0x10667
movq %rax, %rbx
movq %r14, %rdi
callq 0x2140
jmp 0x10674
movq %rax, %rbx
jmp 0x10630
movq %rax, %rbx
movq %r14, %rdi
callq 0x2140
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x10647
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x40(%rsp), %rdi
callq 0x9a3c
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x10667
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x90(%rsp), %rdi
callq 0x9a3c
movq %rbx, %rdi
callq 0x22b0