// File: /workspace/github_cpp_makefile_star2_O1/toxaart[P]hierarchical_block_sparse_lib/source/HierarchicalBlockSparseMatrix.h
// Function: hbsm::HierarchicalBlockSparseMatrix<double>::add_scaled_identity(hbsm::HierarchicalBlockSparseMatrix<double> const&, double)
void HierarchicalBlockSparseMatrix<Treal>::add_scaled_identity(const HierarchicalBlockSparseMatrix<Treal> & other, Treal alpha) {

			if(other.empty()){
				throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::add_scaled_identity(): empty matrix as input!");
			}

			if(other.nRows != other.nCols)
				throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::add_scaled_identity(): non-square matrix as input!");

			this->clear();

			this->set_params(other.get_params());

			this->resize(other.nRows_orig,other.nCols_orig);

			if(other.lowest_level()){
				memcpy(&submatrix[0], &(other.submatrix[0]), sizeof(Treal) * other.submatrix.size());
				for(int i = 0; i < nRows; ++i){
					submatrix[i*nRows + i] += alpha;
				}

				return;
			}

			//non-leaf case
			if(other.children[1] != NULL){
				children[1] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				children[1]->parent = this;
				children[1]->copy(*(other.children[1]));
			}

			if(other.children[2] != NULL){
				children[2] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				children[2]->parent = this;
				children[2]->copy(*(other.children[2]));
			}


			if(other.children[0] != NULL){

				if(children[0] != NULL) throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::add_scaled_identity(): non-null child0 occured");
				children[0] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				children[0]->parent = this;
				children[0]->add_scaled_identity(*other.children[0],alpha);

			}
			else{

				if(children[0] != NULL) throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::add_scaled_identity(): non-null child0 occured");

				children[0] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				children[0]->parent = this;
				children[0]->set_params(get_params());
				children[0]->resize(nRows/2, nCols/2);

				std::vector<int> rows, cols;
				std::vector<Treal> vals;

				rows.resize(nRows/2);
				cols.resize(nRows/2);
				vals.resize(nRows/2);

				for(int i = 0; i < nRows/2; ++i){
					rows[i] = i;
					cols[i] = i;
					vals[i] = alpha;
				}

				children[0]->assign_from_vectors(rows, cols, vals);
			}


			if(other.children[3] != NULL){

				if(children[3] != NULL) throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::add_scaled_identity(): non-null child3 occured");

				children[3] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();

				children[3]->parent = this;

				children[3]->add_scaled_identity(*other.children[3],alpha);

			}
			else{

				if(children[3] != NULL) throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::add_scaled_identity(): non-null child3 occured");

				children[3] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				children[3]->parent = this;
				children[3]->set_params(get_params());
				children[3]->resize(nRows/2, nCols/2);

				std::vector<int> rows, cols;
				std::vector<Treal> vals;

				rows.resize(nRows/2);
				cols.resize(nRows/2);
				vals.resize(nRows/2);

				for(int i = 0; i < nRows/2; ++i){
					rows[i] = i;
					cols[i] = i;
					vals[i] = alpha;
				}

				children[3]->assign_from_vectors(rows, cols, vals);
			}


		}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
movsd %xmm0, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x4338
testb %al, %al
jne 0x6859
movl (%r14), %eax
cmpl 0x4(%r14), %eax
jne 0x687a
movq %rbx, %rdi
callq 0x4422
movl 0x10(%r14), %eax
leaq 0x40(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x42d2
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x436c
movq %r14, %rdi
callq 0x6b36
testb %al, %al
je 0x6293
movq 0x70(%rbx), %rdi
movq 0x70(%r14), %rsi
movq 0x78(%r14), %rdx
subq %rsi, %rdx
callq 0x2100
movslq (%rbx), %rax
testq %rax, %rax
movsd 0x18(%rsp), %xmm1
jle 0x684b
leal 0x1(%rax), %ecx
movq 0x70(%rbx), %rdx
xorl %esi, %esi
movslq %esi, %rsi
movsd (%rdx,%rsi,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%rsi,8)
addl %ecx, %esi
decq %rax
jne 0x6276
jmp 0x684b
cmpq $0x0, 0x38(%r14)
movabsq $0x100000001, %r12      # imm = 0x100000001
je 0x631f
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7a27(%rip), %rcx      # 0xdce0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x38(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movq %rcx, 0x38(%rbx)
movq 0x40(%rbx), %rdi
movq %rax, 0x40(%rbx)
testq %rdi, %rdi
je 0x630c
callq 0x6b64
movq 0x38(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x38(%r14), %rsi
xorl %edx, %edx
callq 0x5f58
cmpq $0x0, 0x48(%r14)
je 0x63a1
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x79a5(%rip), %rcx      # 0xdce0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x38(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movq %rcx, 0x48(%rbx)
movq 0x50(%rbx), %rdi
movq %rax, 0x50(%rbx)
testq %rdi, %rdi
je 0x638e
callq 0x6b64
movq 0x48(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x48(%r14), %rsi
xorl %edx, %edx
callq 0x5f58
cmpq $0x0, 0x28(%r14)
movq 0x28(%rbx), %rax
je 0x643d
testq %rax, %rax
jne 0x6898
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7912(%rip), %rcx      # 0xdce0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x38(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movq %rcx, 0x28(%rbx)
movq 0x30(%rbx), %rdi
movq %rax, 0x30(%rbx)
testq %rdi, %rdi
je 0x6421
callq 0x6b64
movq 0x28(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x28(%r14), %rsi
movsd 0x18(%rsp), %xmm0
callq 0x61d8
jmp 0x65f6
testq %rax, %rax
jne 0x68d4
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7885(%rip), %rcx      # 0xdce0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x38(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movq %rcx, 0x28(%rbx)
movq 0x30(%rbx), %rdi
movq %rax, 0x30(%rbx)
testq %rdi, %rdi
je 0x64ae
callq 0x6b64
movq 0x28(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movl 0x10(%rbx), %eax
leaq 0x40(%rsp), %r15
movl %eax, (%r15)
movq %r15, %rsi
callq 0x42d2
movq 0x28(%rbx), %rdi
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
xorl %r13d, %r13d
xorl %ecx, %ecx
callq 0x436c
movq %r13, 0x10(%r15)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r15)
movq %r13, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r13, 0x10(%rsp)
movapd %xmm0, (%rsp)
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
leaq 0x40(%rsp), %rdi
callq 0x8804
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
leaq 0x20(%rsp), %rdi
callq 0x8804
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
movq %rsp, %rdi
callq 0x699c
cmpl $0x2, (%rbx)
movsd 0x18(%rsp), %xmm0
jl 0x6596
movq 0x40(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rsp), %rdx
xorl %esi, %esi
movl %esi, (%rax,%rsi,4)
movl %esi, (%rcx,%rsi,4)
movsd %xmm0, (%rdx,%rsi,8)
incq %rsi
movl (%rbx), %edi
movl %edi, %r8d
shrl $0x1f, %r8d
addl %edi, %r8d
sarl %r8d
movslq %r8d, %rdi
cmpq %rdi, %rsi
jl 0x6571
movq 0x28(%rbx), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rsp, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x6bf0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x65c8
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x65df
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x65f6
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
cmpq $0x0, 0x58(%r14)
movq 0x58(%rbx), %rax
je 0x6692
testq %rax, %rax
jne 0x68b6
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x76bd(%rip), %rcx      # 0xdce0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x38(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movq %rcx, 0x58(%rbx)
movq 0x60(%rbx), %rdi
movq %rax, 0x60(%rbx)
testq %rdi, %rdi
je 0x6676
callq 0x6b64
movq 0x58(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x58(%r14), %rsi
movsd 0x18(%rsp), %xmm0
callq 0x61d8
jmp 0x684b
testq %rax, %rax
jne 0x68f2
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7630(%rip), %rcx      # 0xdce0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movupd %xmm0, 0x28(%rax)
movupd %xmm0, 0x38(%rax)
movupd %xmm0, 0x48(%rax)
movupd %xmm0, 0x58(%rax)
movupd %xmm0, 0x68(%rax)
movupd %xmm0, 0x78(%rax)
movupd %xmm0, 0x88(%rax)
movq %rcx, 0x58(%rbx)
movq 0x60(%rbx), %rdi
movq %rax, 0x60(%rbx)
testq %rdi, %rdi
je 0x6703
callq 0x6b64
movq 0x58(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movl 0x10(%rbx), %eax
leaq 0x40(%rsp), %r14
movl %eax, (%r14)
movq %r14, %rsi
callq 0x42d2
movq 0x58(%rbx), %rdi
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
xorl %r15d, %r15d
xorl %ecx, %ecx
callq 0x436c
movq %r15, 0x10(%r14)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq %r15, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %r15, 0x10(%rsp)
movapd %xmm0, (%rsp)
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
leaq 0x40(%rsp), %rdi
callq 0x8804
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
leaq 0x20(%rsp), %rdi
callq 0x8804
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
movq %rsp, %rdi
callq 0x699c
cmpl $0x2, (%rbx)
movsd 0x18(%rsp), %xmm0
jl 0x67eb
movq 0x40(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rsp), %rdx
xorl %esi, %esi
movl %esi, (%rax,%rsi,4)
movl %esi, (%rcx,%rsi,4)
movsd %xmm0, (%rdx,%rsi,8)
incq %rsi
movl (%rbx), %edi
movl %edi, %r8d
shrl $0x1f, %r8d
addl %edi, %r8d
sarl %r8d
movslq %r8d, %rdi
cmpq %rdi, %rsi
jl 0x67c6
movq 0x58(%rbx), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rsp, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x6bf0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x681d
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x6834
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x684b
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x48df(%rip), %rsi      # 0xb14c
movq %rax, %rdi
callq 0x2060
jmp 0x690e
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x4914(%rip), %rsi      # 0xb1a2
movq %rax, %rdi
callq 0x2060
jmp 0x690e
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x4951(%rip), %rsi      # 0xb1fd
movq %rax, %rdi
callq 0x2060
jmp 0x690e
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x498a(%rip), %rsi      # 0xb254
movq %rax, %rdi
callq 0x2060
jmp 0x690e
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x4915(%rip), %rsi      # 0xb1fd
movq %rax, %rdi
callq 0x2060
jmp 0x690e
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x494e(%rip), %rsi      # 0xb254
movq %rax, %rdi
callq 0x2060
movq 0x76db(%rip), %rsi      # 0xdff0
movq 0x76a4(%rip), %rdx      # 0xdfc0
movq %r14, %rdi
callq 0x21a0
jmp 0x692e
jmp 0x692e
jmp 0x692e
jmp 0x692e
jmp 0x692e
movq %rax, %rbx
movq %r14, %rdi
callq 0x20e0
jmp 0x6993
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6954
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x226e
jmp 0x6993
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6981
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x2240
movq %rbx, %rdi
callq 0x21c0
nop