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

			if(!C.empty()) throw std::runtime_error("Error in HierarchicalBlockSparseMatrix::transpose(): non-empty matrix to write result!");

			C.set_params(A.get_params());

			C.resize(A.nCols_orig,A.nRows_orig); // reverse order

			if(A.lowest_level()){
				int blocksize = A.blocksize;
				int M = A.nRows;
				int N = A.nCols;
				if(A.on_bottom_boundary()) M = A.get_n_rows() % A.blocksize; // fill only necessary elements
				if(A.on_right_boundary()) N = A.get_n_cols() % A.blocksize; // fill only necessary elements

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

				return;
			}

			if(A.children[0] != NULL) {
				C.children[0] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				transpose(*A.children[0], *C.children[0]);
			}

			if(A.children[1] != NULL){
				C.children[2] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				transpose(*A.children[1], *C.children[2]);
			}

			if(A.children[2] != NULL){
				C.children[1] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				transpose(*A.children[2], *C.children[1]);
			}

			if(A.children[3] != NULL){
				C.children[3] = std::make_shared<HierarchicalBlockSparseMatrix<Treal> >();
				transpose(*A.children[3], *C.children[3]);
			}

			return;

		}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x14e3a
testb %al, %al
je 0x7fde
movl 0x10(%r14), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x7cc0
movl 0x8(%r14), %edx
movl 0xc(%r14), %esi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x7d24
movq %r14, %rdi
callq 0x14f94
testb %al, %al
je 0x7efc
movslq 0x10(%r14), %r13
movl (%r14), %r15d
movl 0x4(%r14), %r12d
movq %r14, %rdi
callq 0x15236
testb %al, %al
je 0x7e8b
movq %r14, %rdi
callq 0x15274
cltd
idivl 0x10(%r14)
movl %edx, %r15d
movq %r14, %rdi
callq 0x15290
testb %al, %al
je 0x7ea7
movq %r14, %rdi
callq 0x152d0
cltd
idivl 0x10(%r14)
movl %edx, %r12d
xorl %eax, %eax
testl %r15d, %r15d
cmovlel %eax, %r15d
testl %r12d, %r12d
cmovlel %eax, %r12d
shlq $0x3, %r13
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %r12, %rdx
je 0x7fd0
movq 0x70(%r14), %rsi
addq %rcx, %rsi
movq 0x70(%rbx), %rdi
addq %rax, %rdi
xorl %r8d, %r8d
cmpq %r8, %r15
je 0x7ef0
movsd (%rsi,%r8,8), %xmm0
movsd %xmm0, (%rdi)
incq %r8
addq %r13, %rdi
jmp 0x7ed9
incq %rdx
addq %r13, %rcx
addq $0x8, %rax
jmp 0x7ebf
cmpq $0x0, 0x28(%r14)
je 0x7f31
movq %rsp, %r15
movq %r15, %rdi
callq 0x152ec
leaq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x14fba
leaq 0x8(%rsp), %rdi
callq 0x14fe8
movq 0x28(%r14), %rdi
movq 0x28(%rbx), %rsi
callq 0x7e0e
cmpq $0x0, 0x38(%r14)
je 0x7f66
movq %rsp, %r15
movq %r15, %rdi
callq 0x152ec
leaq 0x48(%rbx), %rdi
movq %r15, %rsi
callq 0x14fba
leaq 0x8(%rsp), %rdi
callq 0x14fe8
movq 0x38(%r14), %rdi
movq 0x48(%rbx), %rsi
callq 0x7e0e
cmpq $0x0, 0x48(%r14)
je 0x7f9b
movq %rsp, %r15
movq %r15, %rdi
callq 0x152ec
leaq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x14fba
leaq 0x8(%rsp), %rdi
callq 0x14fe8
movq 0x48(%r14), %rdi
movq 0x38(%rbx), %rsi
callq 0x7e0e
cmpq $0x0, 0x58(%r14)
je 0x7fd0
movq %rsp, %r15
movq %r15, %rdi
callq 0x152ec
leaq 0x58(%rbx), %rdi
movq %r15, %rsi
callq 0x14fba
leaq 0x8(%rsp), %rdi
callq 0x14fe8
movq 0x58(%r14), %rdi
movq 0x58(%rbx), %rsi
callq 0x7e0e
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x20d0
movq %rax, %rbx
leaq 0x148a2(%rip), %rsi     # 0x1c892
movq %rax, %rdi
callq 0x2080
movq 0x1dff1(%rip), %rsi     # 0x25ff0
movq 0x1dfba(%rip), %rdx     # 0x25fc0
movq %rbx, %rdi
callq 0x2270
movq %rax, %r14
movq %rbx, %rdi
callq 0x2130
movq %r14, %rdi
callq 0x2290