// File: /workspace/github_cpp_makefile_star2_O1/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 0x1016b
movq %r14, %rdx
movq %rdx, %rcx
movq 0x68(%rdx), %rdx
testq %rdx, %rdx
jne 0x1015f
movl 0x8(%rcx), %edx
movq 0x68(%rbx), %rcx
movq %rbx, %rsi
testq %rcx, %rcx
je 0x10189
movq %rbx, %rdi
movq %rdi, %rsi
movq 0x68(%rdi), %rdi
testq %rdi, %rdi
jne 0x1017d
cmpl 0x8(%rsi), %edx
jne 0x10461
movq %r14, %rdx
testq %rax, %rax
je 0x101a9
movq %r14, %rax
movq %rax, %rdx
movq 0x68(%rax), %rax
testq %rax, %rax
jne 0x1019d
movl 0xc(%rdx), %eax
movq %rbx, %rdx
testq %rcx, %rcx
je 0x101c3
movq %rbx, %rcx
movq %rcx, %rdx
movq 0x68(%rcx), %rcx
testq %rcx, %rcx
jne 0x101b7
cmpl 0xc(%rdx), %eax
jne 0x10461
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 0x1b560
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x68(%r14), %rax
movq %r14, %rcx
testq %rax, %rax
je 0x1023e
movq %r14, %rdx
movq %rdx, %rcx
movq 0x68(%rdx), %rdx
testq %rdx, %rdx
jne 0x10232
movl 0x8(%rcx), %edx
testq %rax, %rax
je 0x10254
movq %r14, %rax
movq 0x68(%r14), %r14
testq %r14, %r14
jne 0x10246
jmp 0x10257
movq %r14, %rax
movl 0xc(%rax), %ecx
leaq 0x90(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bfbe
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 0x1b560
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x68(%rbx), %rax
movq %rbx, %rcx
testq %rax, %rax
je 0x102ce
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x68(%rdx), %rdx
testq %rdx, %rdx
jne 0x102c2
movl 0x8(%rcx), %edx
testq %rax, %rax
je 0x102e4
movq %rbx, %rax
movq 0x68(%rbx), %rbx
testq %rbx, %rbx
jne 0x102d6
jmp 0x102e7
movq %rbx, %rax
movl 0xc(%rax), %ecx
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x1bfbe
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 0x10493
cmpq %rax, %rdx
je 0x1035d
sarq $0x3, %rcx
movl $0x1, %edx
xorl %esi, %esi
movapd 0x12fb4(%rip), %xmm0    # 0x232f0
movsd (%rax,%rsi,8), %xmm1
subsd (%rdi,%rsi,8), %xmm1
andpd %xmm0, %xmm1
ucomisd %xmm2, %xmm1
ja 0x1042f
movl %edx, %esi
incl %edx
cmpq %rsi, %rcx
ja 0x1033c
testq %rdi, %rdi
je 0x1036f
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x10389
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x103a0
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x103b7
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x103cd
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x103ea
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x10407
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x10424
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 0x14260(%rip), %rsi     # 0x246a3
movq %rax, %rdi
callq 0x20a0
movq 0x1ab9e(%rip), %rsi     # 0x2aff0
movq 0x1ab67(%rip), %rdx     # 0x2afc0
movq %r14, %rdi
callq 0x2290
movl $0x10, %edi
callq 0x20c0
movq %rax, %r14
leaq 0x13494(%rip), %rsi     # 0x23909
movq %rax, %rdi
callq 0x20a0
movq 0x1ab6c(%rip), %rsi     # 0x2aff0
movq 0x1ab35(%rip), %rdx     # 0x2afc0
movq %r14, %rdi
callq 0x2290
leaq 0x1349c(%rip), %rdi     # 0x23936
leaq 0x134be(%rip), %rsi     # 0x2395f
leaq 0x14165(%rip), %rcx     # 0x2460d
movl $0x5b, %edx
callq 0x2100
jmp 0x104d0
movq %rax, %rbx
jmp 0x104f7
movq %rax, %rbx
jmp 0x10501
movq %rax, %rbx
jmp 0x10517
movq %rax, %rbx
movq %r14, %rdi
callq 0x2140
jmp 0x10524
movq %rax, %rbx
jmp 0x104e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x2140
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x104f7
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x40(%rsp), %rdi
callq 0x9a90
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x10517
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x90(%rsp), %rdi
callq 0x9a90
movq %rbx, %rdi
callq 0x22b0