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

			if(!empty()) throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::rescale(): non-empty matrix called this method!");

            if(other.empty()){
                clear();
                return;
            }

			set_params(other.get_params());
            resize(other.nRows_orig,other.nCols_orig);

            if(other.lowest_level()){
                for(int i = 0; i < nRows * nCols; ++i) submatrix[i] = other.submatrix[i] * alpha;
                return;
            }

            for(int i = 0; i < 4; ++i){
                if(children[i] != NULL)
                    throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::rescale(): non-null child exist!");

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

            }

		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x230a0
testb $0x1, %al
jne 0x128e9
movl $0x10, %edi
callq 0x20d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x50(%rbp)
leaq 0x24a24(%rip), %rsi     # 0x372d5
callq 0x20a0
jmp 0x128b8
movq -0x50(%rbp), %rdi
movq 0x2e72d(%rip), %rsi     # 0x40ff0
movq 0x2e6f6(%rip), %rdx     # 0x40fc0
callq 0x2320
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x2150
jmp 0x12afe
movq -0x10(%rbp), %rdi
callq 0x230a0
testb $0x1, %al
jne 0x128f8
jmp 0x12906
movq -0x48(%rbp), %rdi
callq 0x23300
jmp 0x12af8
movq -0x10(%rbp), %rdi
callq 0x243e0
movq -0x48(%rbp), %rdi
movl %eax, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x8570
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x8600
movq -0x10(%rbp), %rdi
callq 0x23500
testb $0x1, %al
jne 0x12949
jmp 0x129aa
movl $0x0, -0x2c(%rbp)
movq -0x48(%rbp), %rdx
movl -0x2c(%rbp), %eax
movl (%rdx), %ecx
imull 0x4(%rdx), %ecx
cmpl %ecx, %eax
jge 0x129a5
movq -0x10(%rbp), %rdi
addq $0x70, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x245a0
movq -0x48(%rbp), %rdi
movsd (%rax), %xmm0
mulsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
addq $0x70, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x22b60
movsd -0x58(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x12950
jmp 0x12af8
movl $0x0, -0x30(%rbp)
cmpl $0x4, -0x30(%rbp)
jge 0x12af8
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x129dd
jmp 0x12a30
movl $0x10, %edi
callq 0x20d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x60(%rbp)
leaq 0x24935(%rip), %rsi     # 0x3732d
callq 0x20a0
jmp 0x129ff
movq -0x60(%rbp), %rdi
movq 0x2e5e6(%rip), %rsi     # 0x40ff0
movq 0x2e5af(%rip), %rdx     # 0x40fc0
callq 0x2320
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x2150
jmp 0x12afe
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x12a55
jmp 0x12ae8
leaq -0x40(%rbp), %rdi
callq 0x245c0
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
leaq -0x40(%rbp), %rsi
callq 0x235b0
leaq -0x40(%rbp), %rdi
callq 0x235e0
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x23570
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x24630
movq -0x68(%rbp), %rdi
movq %rax, %rsi
movsd -0x18(%rbp), %xmm0
callq 0x12870
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x23570
movq -0x48(%rbp), %rcx
movq %rcx, 0x68(%rax)
jmp 0x12aea
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x129b1
addq $0x70, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x2340
nopw (%rax,%rax)