// File: /workspace/github_cpp_makefile_star2_O3/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 0x42c4
testb %al, %al
jne 0x682b
movl (%r14), %eax
cmpl 0x4(%r14), %eax
jne 0x684c
movq %rbx, %rdi
callq 0x43c2
movl 0x10(%r14), %eax
leaq 0x40(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x425e
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x430c
movq %r14, %rdi
callq 0x6b0e
testb %al, %al
je 0x6253
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 0x681d
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 0x6236
jmp 0x681d
cmpq $0x0, 0x38(%r14)
movabsq $0x100000001, %r12      # imm = 0x100000001
je 0x62e2
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7a9f(%rip), %rcx      # 0xdd18
movq %rcx, (%rax)
leaq 0x10(%rax), %rdi
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 %rdi, 0x38(%rbx)
movq 0x40(%rbx), %rcx
movq %rax, 0x40(%rbx)
testq %rcx, %rcx
je 0x62d3
movq %rcx, %rdi
callq 0x6b3c
movq 0x38(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x38(%r14), %rsi
xorl %edx, %edx
callq 0x5f1a
cmpq $0x0, 0x48(%r14)
je 0x6367
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7a1a(%rip), %rcx      # 0xdd18
movq %rcx, (%rax)
leaq 0x10(%rax), %rdi
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 %rdi, 0x48(%rbx)
movq 0x50(%rbx), %rcx
movq %rax, 0x50(%rbx)
testq %rcx, %rcx
je 0x6358
movq %rcx, %rdi
callq 0x6b3c
movq 0x48(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x48(%r14), %rsi
xorl %edx, %edx
callq 0x5f1a
cmpq $0x0, 0x28(%r14)
movq 0x28(%rbx), %rax
je 0x6406
testq %rax, %rax
jne 0x686a
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7984(%rip), %rcx      # 0xdd18
movq %rcx, (%rax)
leaq 0x10(%rax), %rdi
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 %rdi, 0x28(%rbx)
movq 0x30(%rbx), %rcx
movq %rax, 0x30(%rbx)
testq %rcx, %rcx
je 0x63ee
movq %rcx, %rdi
callq 0x6b3c
movq 0x28(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x28(%r14), %rsi
movsd 0x18(%rsp), %xmm0
callq 0x6198
jmp 0x65c2
testq %rax, %rax
jne 0x68a6
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x78f4(%rip), %rcx      # 0xdd18
movq %rcx, (%rax)
leaq 0x10(%rax), %rdi
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 %rdi, 0x28(%rbx)
movq 0x30(%rbx), %rcx
movq %rax, 0x30(%rbx)
testq %rcx, %rcx
je 0x647e
movq %rcx, %rdi
callq 0x6b3c
movq 0x28(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movl 0x10(%rbx), %eax
leaq 0x40(%rsp), %r15
movl %eax, (%r15)
movq %r15, %rsi
callq 0x425e
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 0x430c
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 0x87c0
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
leaq 0x20(%rsp), %rdi
callq 0x87c0
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
movq %rsp, %rdi
callq 0x696e
cmpl $0x2, (%rbx)
movsd 0x18(%rsp), %xmm0
jl 0x6562
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 0x653d
movq 0x28(%rbx), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rsp, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x6bc8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6594
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x65ab
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x65c2
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
cmpq $0x0, 0x58(%r14)
movq 0x58(%rbx), %rax
je 0x6661
testq %rax, %rax
jne 0x6888
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7729(%rip), %rcx      # 0xdd18
movq %rcx, (%rax)
leaq 0x10(%rax), %rdi
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 %rdi, 0x58(%rbx)
movq 0x60(%rbx), %rcx
movq %rax, 0x60(%rbx)
testq %rcx, %rcx
je 0x6649
movq %rcx, %rdi
callq 0x6b3c
movq 0x58(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movq 0x58(%r14), %rsi
movsd 0x18(%rsp), %xmm0
callq 0x6198
jmp 0x681d
testq %rax, %rax
jne 0x68c4
movl $0x98, %edi
callq 0x2130
movq %r12, 0x8(%rax)
leaq 0x7699(%rip), %rcx      # 0xdd18
movq %rcx, (%rax)
leaq 0x10(%rax), %rdi
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 %rdi, 0x58(%rbx)
movq 0x60(%rbx), %rcx
movq %rax, 0x60(%rbx)
testq %rcx, %rcx
je 0x66d9
movq %rcx, %rdi
callq 0x6b3c
movq 0x58(%rbx), %rdi
movq %rbx, 0x68(%rdi)
movl 0x10(%rbx), %eax
leaq 0x40(%rsp), %r14
movl %eax, (%r14)
movq %r14, %rsi
callq 0x425e
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 0x430c
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 0x87c0
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
leaq 0x20(%rsp), %rdi
callq 0x87c0
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rsi
movq %rsp, %rdi
callq 0x696e
cmpl $0x2, (%rbx)
movsd 0x18(%rsp), %xmm0
jl 0x67bd
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 0x6798
movq 0x58(%rbx), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rsp, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x6bc8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x67ef
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x6806
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x681d
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 0x4925(%rip), %rsi      # 0xb164
movq %rax, %rdi
callq 0x2060
jmp 0x68e0
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x495a(%rip), %rsi      # 0xb1ba
movq %rax, %rdi
callq 0x2060
jmp 0x68e0
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x4997(%rip), %rsi      # 0xb215
movq %rax, %rdi
callq 0x2060
jmp 0x68e0
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x49d0(%rip), %rsi      # 0xb26c
movq %rax, %rdi
callq 0x2060
jmp 0x68e0
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x495b(%rip), %rsi      # 0xb215
movq %rax, %rdi
callq 0x2060
jmp 0x68e0
movl $0x10, %edi
callq 0x2070
movq %rax, %r14
leaq 0x4994(%rip), %rsi      # 0xb26c
movq %rax, %rdi
callq 0x2060
movq 0x7709(%rip), %rsi      # 0xdff0
movq 0x76d2(%rip), %rdx      # 0xdfc0
movq %r14, %rdi
callq 0x21a0
jmp 0x6900
jmp 0x6900
jmp 0x6900
jmp 0x6900
jmp 0x6900
movq %rax, %rbx
movq %r14, %rdi
callq 0x20e0
jmp 0x6965
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6926
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x226c
jmp 0x6965
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6953
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x223e
movq %rbx, %rdi
callq 0x21c0
nop