// File: toxaart[P]hierarchical_block_sparse_lib/source/HierarchicalBlockSparseMatrix.h
// Function: hbsm::HierarchicalBlockSparseMatrix<double>::add_to_first(hbsm::HierarchicalBlockSparseMatrix<double>&, hbsm::HierarchicalBlockSparseMatrix<double>&, unsigned long*)
void HierarchicalBlockSparseMatrix<Treal>::add_to_first(HierarchicalBlockSparseMatrix<Treal> & first, HierarchicalBlockSparseMatrix<Treal> & second,
													size_t* no_of_resizes){

			// at this point we are 100% sure that both matrices are non-empty!

			if(first.nRows_orig != second.nRows_orig || first.nCols_orig != second.nCols_orig ){
				throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::add_to_first(): matrices to add have different sizes!");
			}

			if(first.lowest_level()){
				int blocksize = first.blocksize;
				int noOfElements = blocksize*blocksize;
				Treal const ONEreal = 1.0;
				int  const ONEint  = 1;

				// Add 1.0 * second to first.
				axpy(&noOfElements, &ONEreal, &second.submatrix[0], &ONEint, &first.submatrix[0], &ONEint);
				return;
			}

			for(int i = 0; i < 4; ++i){
				if(first.children[i] != NULL && second.children[i] == NULL){
					continue;
				}
				if(first.children[i] == NULL && second.children[i] != NULL) {
					first.children[i] = second.children[i];
					first.children[i]->parent = &first;
					continue;
				}
				if(first.children[i] != NULL && second.children[i] != NULL){
					add_to_first(*first.children[i],  *second.children[i]);
				}

			}


		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x27754
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
je 0x277a7
movl $0x10, %edi
callq 0x20d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
leaq 0xf75a(%rip), %rsi      # 0x36ec9
callq 0x20a0
jmp 0x27776
movq -0x48(%rbp), %rdi
movq 0x1986f(%rip), %rsi     # 0x40ff0
movq 0x19838(%rip), %rdx     # 0x40fc0
callq 0x2320
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x2150
jmp 0x279b8
movq -0x8(%rbp), %rdi
callq 0x23500
testb $0x1, %al
jne 0x277b6
jmp 0x27824
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
imull -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movsd 0xe84e(%rip), %xmm0     # 0x36020
movsd %xmm0, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x70, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22b60
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22b60
movq -0x50(%rbp), %rdx
movq %rax, %r8
leaq -0x2c(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x3c(%rbp), %r9
movq %r9, %rcx
callq 0x27330
jmp 0x279b2
movl $0x0, -0x40(%rbp)
cmpl $0x4, -0x40(%rbp)
jge 0x279b2
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x27857
jmp 0x2787e
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x27380
testb $0x1, %al
jne 0x27879
jmp 0x2787e
jmp 0x279a4
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x27380
testb $0x1, %al
jne 0x278a0
jmp 0x2791a
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x278c2
jmp 0x2791a
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x273b0
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x23570
movq -0x58(%rbp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x279a4
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x2793c
jmp 0x279a2
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x2795e
jmp 0x279a2
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x24630
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x24630
movq -0x60(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x27720
jmp 0x279a4
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x2782b
addq $0x60, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)