// File: toxaart[P]hierarchical_block_sparse_lib/source/HierarchicalBlockSparseMatrix.h
// Function: hbsm::HierarchicalBlockSparseMatrix<double>::get_errors_of_approx_multiplication(hbsm::HierarchicalBlockSparseMatrix<double> const&, bool, hbsm::HierarchicalBlockSparseMatrix<double> const&, bool, std::vector<double, std::allocator<double>> const&, bool const&, bool const&)
std::vector<Treal> HierarchicalBlockSparseMatrix<Treal>::get_errors_of_approx_multiplication(HierarchicalBlockSparseMatrix<Treal> const & A, const bool tA, HierarchicalBlockSparseMatrix<Treal> const & B, const bool tB, std::vector<Treal> const & taus, const bool & apply_truncation, const bool & apply_spamm){

			std::vector<unsigned long int> skips = count_skips(A, tA, B, tB, taus, apply_truncation, apply_spamm);

			assert(skips.size() == taus.size());

			std::vector<Treal> errors;
			errors.resize(skips.size());

			Treal c1 = A.get_max_abs_value();
			Treal c2 = B.get_max_abs_value();

			//truncmul
			if(apply_truncation && !apply_spamm){
				for(int i = 0; i < errors.size(); ++i){
					errors[i] = std::max(c1,c2) * std::sqrt(taus[i] * taus[i] * skips[i]);
				}
			}

			//spamm
			if(!apply_truncation && apply_spamm){
				for(int i = 0; i < errors.size(); ++i){
					errors[i] = std::sqrt(taus[i] * taus[i] * skips[i]);
				}
			}

			//hybrid
			if(apply_truncation	&& apply_spamm){
				for(int i = 0; i < errors.size(); ++i){
					errors[i] = std::max(1.0,std::max(c1,c2)) * std::sqrt(taus[i] * taus[i] * skips[i]);
				}
			}

			//regular multiplication - do nothing
			if(!apply_truncation && !apply_spamm){

			}

			return errors;

		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0xa0(%rbp)
movb %r8b, %al
movq %rdi, %r8
movq %r8, -0x98(%rbp)
movq 0x18(%rbp), %r8
movq 0x10(%rbp), %r8
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %dl
movb %dl, -0x11(%rbp)
movq %rcx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rsi
movb -0x11(%rbp), %dl
movq -0x20(%rbp), %rcx
movb -0x21(%rbp), %r8b
movq -0x30(%rbp), %r9
movq 0x10(%rbp), %r10
movq 0x18(%rbp), %rax
leaq -0x48(%rbp), %rdi
andb $0x1, %dl
andb $0x1, %r8b
movzbl %dl, %edx
movzbl %r8b, %r8d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1d2a0
leaq -0x48(%rbp), %rdi
callq 0x1ff30
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rdi
callq 0x22b40
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jne 0x20017
jmp 0x20036
leaq 0x17c80(%rip), %rdi     # 0x37c9e
leaq 0x166fa(%rip), %rsi     # 0x3671f
movl $0x144d, %edx           # imm = 0x144D
leaq 0x17c89(%rip), %rcx     # 0x37cba
callq 0x2120
movq -0xa0(%rbp), %rdi
movb $0x0, -0x49(%rbp)
callq 0x10e80
leaq -0x48(%rbp), %rdi
callq 0x1ff30
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x23470
jmp 0x20060
movq -0x10(%rbp), %rdi
callq 0x31f50
movsd %xmm0, -0xa8(%rbp)
jmp 0x20073
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x20(%rbp), %rdi
callq 0x31f50
movsd %xmm0, -0xb0(%rbp)
jmp 0x20093
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movq 0x10(%rbp), %rax
testb $0x1, (%rax)
je 0x201ff
movq 0x18(%rbp), %rax
testb $0x1, (%rax)
jne 0x201ff
movl $0x0, -0x74(%rbp)
movq -0xa0(%rbp), %rdi
movslq -0x74(%rbp), %rax
movq %rax, -0xb8(%rbp)
callq 0x22b40
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
jae 0x201fd
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x320a0
movq %rax, -0xc0(%rbp)
jmp 0x20101
movq -0xc0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xd0(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x74(%rbp), %rsi
callq 0x245a0
movsd (%rax), %xmm0
movsd %xmm0, -0xe0(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x74(%rbp), %rsi
callq 0x245a0
movsd -0xe0(%rbp), %xmm0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movslq -0x74(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x1ff50
movsd -0xd8(%rbp), %xmm0
movq (%rax), %xmm1
movaps 0x1616e(%rip), %xmm2    # 0x362e0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x16172(%rip), %xmm2    # 0x362f0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
callq 0x2180
movq -0xa0(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0xd0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movslq -0x74(%rbp), %rsi
callq 0x22b60
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x200c1
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x112e0
leaq -0x48(%rbp), %rdi
callq 0x22d20
jmp 0x204a9
jmp 0x201ff
movq 0x10(%rbp), %rax
testb $0x1, (%rax)
jne 0x20300
movq 0x18(%rbp), %rax
testb $0x1, (%rax)
je 0x20300
movl $0x0, -0x78(%rbp)
movq -0xa0(%rbp), %rdi
movslq -0x78(%rbp), %rax
movq %rax, -0xe8(%rbp)
callq 0x22b40
movq %rax, %rcx
movq -0xe8(%rbp), %rax
cmpq %rcx, %rax
jae 0x202fe
movq -0x30(%rbp), %rdi
movslq -0x78(%rbp), %rsi
callq 0x245a0
movsd (%rax), %xmm0
movsd %xmm0, -0x100(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x78(%rbp), %rsi
callq 0x245a0
movsd -0x100(%rbp), %xmm0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
movslq -0x78(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x1ff50
movsd -0xf8(%rbp), %xmm0
movq (%rax), %xmm1
movaps 0x16038(%rip), %xmm2    # 0x362e0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x1603c(%rip), %xmm2    # 0x362f0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
callq 0x2180
movq -0xa0(%rbp), %rdi
movsd %xmm0, -0xf0(%rbp)
movslq -0x78(%rbp), %rsi
callq 0x22b60
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x20220
jmp 0x20300
movq 0x10(%rbp), %rax
testb $0x1, (%rax)
je 0x20466
movq 0x18(%rbp), %rax
testb $0x1, (%rax)
je 0x20466
movl $0x0, -0x7c(%rbp)
movq -0xa0(%rbp), %rdi
movslq -0x7c(%rbp), %rax
movq %rax, -0x108(%rbp)
callq 0x22b40
movq %rax, %rcx
movq -0x108(%rbp), %rax
cmpq %rcx, %rax
jae 0x20464
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x88(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x320a0
movq %rax, -0x110(%rbp)
jmp 0x20372
movq -0x110(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x320a0
movq %rax, -0x118(%rbp)
jmp 0x2038e
movq -0x118(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x128(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
callq 0x245a0
movsd (%rax), %xmm0
movsd %xmm0, -0x138(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
callq 0x245a0
movsd -0x138(%rbp), %xmm0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x130(%rbp)
movslq -0x7c(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x1ff50
movsd -0x130(%rbp), %xmm0
movq (%rax), %xmm1
movaps 0x15ee1(%rip), %xmm2    # 0x362e0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x15ee5(%rip), %xmm2    # 0x362f0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
callq 0x2180
movq -0xa0(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x128(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
movslq -0x7c(%rbp), %rsi
callq 0x22b60
movsd -0x120(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x20321
jmp 0x20466
movq 0x10(%rbp), %rax
testb $0x1, (%rax)
jne 0x2047a
movq 0x18(%rbp), %rax
testb $0x1, (%rax)
jne 0x2047a
jmp 0x2047a
movb $0x1, -0x49(%rbp)
testb $0x1, -0x49(%rbp)
jne 0x20490
movq -0xa0(%rbp), %rdi
callq 0x112e0
leaq -0x48(%rbp), %rdi
callq 0x22d20
movq -0x98(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)
nopl (%rax)