// File: 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 %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x230a0
testb $0x1, %al
jne 0x8883
movl $0x10, %edi
callq 0x20d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
leaq 0x2e017(%rip), %rsi     # 0x36862
callq 0x20a0
jmp 0x8852
movq -0x80(%rbp), %rdi
movq 0x38793(%rip), %rsi     # 0x40ff0
movq 0x3875c(%rip), %rdx     # 0x40fc0
callq 0x2320
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x2150
jmp 0x8ba4
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x243e0
movq -0x88(%rbp), %rdi
movl %eax, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x8570
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x8600
movq -0x8(%rbp), %rdi
callq 0x23500
testb $0x1, %al
jne 0x88d7
jmp 0x89c1
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x24400
testb $0x1, %al
jne 0x8903
jmp 0x8917
movq -0x8(%rbp), %rdi
callq 0x24470
movq -0x8(%rbp), %rcx
cltd
idivl 0x10(%rcx)
movl %edx, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x244d0
testb $0x1, %al
jne 0x8926
jmp 0x893a
movq -0x8(%rbp), %rdi
callq 0x24540
movq -0x8(%rbp), %rcx
cltd
idivl 0x10(%rcx)
movl %edx, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x89bc
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x89af
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movl -0x30(%rbp), %eax
imull -0x24(%rbp), %eax
addl -0x34(%rbp), %eax
movslq %eax, %rsi
callq 0x245a0
movsd (%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x10(%rbp), %rdi
addq $0x70, %rdi
movl -0x34(%rbp), %eax
imull -0x24(%rbp), %eax
addl -0x30(%rbp), %eax
movslq %eax, %rsi
callq 0x22b60
movsd -0x90(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x8950
jmp 0x89b1
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x8941
jmp 0x8b9b
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x89d8
jmp 0x8a2b
leaq -0x48(%rbp), %rdi
callq 0x245c0
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
leaq -0x48(%rbp), %rsi
callq 0x235b0
leaq -0x48(%rbp), %rdi
callq 0x235e0
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0x24630
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x24630
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x8810
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x8a46
jmp 0x8aa5
leaq -0x58(%rbp), %rdi
callq 0x245c0
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
addq $0x20, %rdi
leaq -0x58(%rbp), %rsi
callq 0x235b0
leaq -0x58(%rbp), %rdi
callq 0x235e0
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
addq $0x10, %rdi
callq 0x24630
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
addq $0x20, %rdi
callq 0x24630
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x8810
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x8ac0
jmp 0x8b1f
leaq -0x68(%rbp), %rdi
callq 0x245c0
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
addq $0x10, %rdi
leaq -0x68(%rbp), %rsi
callq 0x235b0
leaq -0x68(%rbp), %rdi
callq 0x235e0
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
addq $0x20, %rdi
callq 0x24630
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
addq $0x10, %rdi
callq 0x24630
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
callq 0x8810
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x232b0
testb $0x1, %al
jne 0x8b3a
jmp 0x8b99
leaq -0x78(%rbp), %rdi
callq 0x245c0
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
addq $0x30, %rdi
leaq -0x78(%rbp), %rsi
callq 0x235b0
leaq -0x78(%rbp), %rdi
callq 0x235e0
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
addq $0x30, %rdi
callq 0x24630
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
addq $0x30, %rdi
callq 0x24630
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x8810
jmp 0x8b9b
addq $0xb0, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x2340
nopl (%rax)