// File: /workspace/github_cpp_makefile_star2_O2/toxaart[P]hierarchical_block_sparse_lib/source/HierarchicalBlockSparseMatrix.h
// Function: hbsm::HierarchicalBlockSparseMatrix<double>::get_upper_triangle(hbsm::HierarchicalBlockSparseMatrix<double>&) const
void HierarchicalBlockSparseMatrix<Treal>::get_upper_triangle(HierarchicalBlockSparseMatrix<Treal> & A) const {

			if(get_n_rows() != get_n_cols()) throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::get_upper_triangle(): call for non-square matrix!");

			if(!A.empty())A.clear();

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

			if(lowest_level()){

				int blocksize = A.nRows;
				int M = A.nRows;
				if(A.on_bottom_boundary()) M = A.get_n_rows() % A.blocksize; // fill only necessary elements

				for (int col = 0; col < M; col++){
					for (int row = 0; row <= col; row++) {
						 A.submatrix[col * nRows + row] = submatrix[col * nRows + row];
					}
			   }

			   return;
			}

			// children 0 and 3 are recursive, child 2 is just a copy
			if(children[0] != NULL){
				A.children[0] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				A.children[0]->parent = &A;
				children[0]->get_upper_triangle(*A.children[0]);
			}

			// child2
			if(children[2] != NULL){
				A.children[2] = children[2];
				A.children[2]->parent = &A;
			}

			if(children[3] != NULL){
				A.children[3] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				A.children[3]->parent = &A;
				children[3]->get_upper_triangle(*A.children[3]);
			}

			return;
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x15274
movl %eax, %ebp
movq %r14, %rdi
callq 0x152d0
cmpl %eax, %ebp
jne 0x18da8
movq %rbx, %rdi
callq 0x14e3a
testb %al, %al
jne 0x18c71
movq %rbx, %rdi
callq 0x14e82
movl 0x10(%r14), %eax
leaq 0x8(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x7cc0
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x7d24
movq %r14, %rdi
callq 0x14f94
testb %al, %al
je 0x18d0b
movl (%rbx), %r15d
movq %rbx, %rdi
callq 0x15236
testb %al, %al
je 0x18cc0
movq %rbx, %rdi
callq 0x15274
cltd
idivl 0x10(%rbx)
movl %edx, %r15d
movslq (%r14), %rax
movq 0x70(%r14), %rcx
movq 0x70(%rbx), %rdx
xorl %esi, %esi
testl %r15d, %r15d
cmovlel %esi, %r15d
shlq $0x3, %rax
pushq $0x1
popq %rdi
cmpq %r15, %rsi
je 0x18d9d
xorl %r8d, %r8d
cmpq %r8, %rdi
je 0x18cfd
movsd (%rcx,%r8,8), %xmm0
movsd %xmm0, (%rdx,%r8,8)
incq %r8
jmp 0x18ce7
incq %rsi
incq %rdi
addq %rax, %rcx
addq %rax, %rdx
jmp 0x18cdb
cmpq $0x0, 0x28(%r14)
je 0x18d46
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x152ec
leaq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x14fba
leaq 0x10(%rsp), %rdi
callq 0x14fe8
movq 0x28(%rbx), %rsi
movq %rbx, 0x68(%rsi)
movq 0x28(%r14), %rdi
callq 0x18c36
cmpq $0x0, 0x48(%r14)
je 0x18d62
leaq 0x48(%r14), %rsi
leaq 0x48(%rbx), %rdi
callq 0x162fc
movq 0x48(%rbx), %rax
movq %rbx, 0x68(%rax)
cmpq $0x0, 0x58(%r14)
je 0x18d9d
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x152ec
leaq 0x58(%rbx), %rdi
movq %r15, %rsi
callq 0x14fba
leaq 0x10(%rsp), %rdi
callq 0x14fe8
movq 0x58(%rbx), %rsi
movq %rbx, 0x68(%rsi)
movq 0x58(%r14), %rdi
callq 0x18c36
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x20d0
movq %rax, %rbx
leaq 0x4b8b(%rip), %rsi      # 0x1d945
movq %rax, %rdi
callq 0x2080
movq 0xd227(%rip), %rsi      # 0x25ff0
movq 0xd1f0(%rip), %rdx      # 0x25fc0
movq %rbx, %rdi
callq 0x2270
movq %rax, %r14
movq %rbx, %rdi
callq 0x2130
movq %r14, %rdi
callq 0x2290
nop