// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/src/algebra/MatrixBase.cpp
// Function: abcdl::algebra::Matrix<int>::insert_row(unsigned long, abcdl::algebra::Matrix<int> const&)
void Matrix<T>::insert_row(const size_t row_id, const Matrix<T>& mat){  
    if(get_size() == 0){
        set_data(mat.data(), mat.rows(), mat.cols());
        return;
    }

    CHECK(_cols == mat.cols());

    T* data = new T[(_rows + mat.rows()) * _cols];

    if(row_id > 0){
        memcpy(data, _data, sizeof(T) * row_id * _cols);
    }
    memcpy(&data[row_id * _cols], mat.data(), sizeof(T) * mat.get_size());
    if(row_id < _rows){
        memcpy(&data[(row_id + mat.rows()) * _cols], &_data[row_id * _cols], sizeof(T) * (_rows - row_id) * _cols);
    }
    set_shallow_data(data, _rows + mat.rows(), _cols);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, %r15
movq %rdi, %rbx
movq (%rdi), %r12
movq 0x8(%rdi), %r13
movq %r13, %rax
imulq %r12, %rax
testq %rax, %rax
je 0x18b81
movq %rsi, %rbp
cmpq 0x8(%r15), %r13
jne 0x18c30
movq (%r15), %r14
leaq (%r14,%r12), %rax
movq %rax, 0x10(%rsp)
imulq %r13, %rax
movq %rax, %rcx
shrq $0x3e, %rcx
shlq $0x2, %rax
xorl %edi, %edi
negq %rcx
sbbq %rdi, %rdi
orq %rax, %rdi
callq 0x9030
testq %rbp, %rbp
je 0x18b1e
movq 0x10(%rbx), %rsi
movq %rbp, %rdx
imulq %r13, %rdx
shlq $0x2, %rdx
movq %rax, %rdi
movq %rbp, 0x8(%rsp)
movq %rax, %rbp
callq 0x92b0
movq %rbp, %rax
movq 0x8(%rsp), %rbp
movq %rbx, 0x8(%rsp)
movq %rbp, %rbx
movq %r13, %rbp
imulq %rbx, %rbp
leaq (%rax,%rbp,4), %rdi
movq 0x10(%r15), %rsi
movq 0x8(%r15), %rdx
imulq %r14, %rdx
shlq $0x2, %rdx
movq %rax, %r15
callq 0x92b0
subq %rbx, %r12
movq %r15, 0x18(%rsp)
jbe 0x18bf3
addq %rbx, %r14
imulq %r13, %r14
leaq (%r15,%r14,4), %rdi
movq 0x8(%rsp), %rbx
movq 0x10(%rbx), %r14
leaq (%r14,%rbp,4), %rsi
imulq %r13, %r12
shlq $0x2, %r12
movq %r12, %rdx
callq 0x92b0
jmp 0x18bfc
movq 0x10(%r15), %r14
movq (%r15), %r12
movq 0x8(%r15), %r13
movq %r13, %r15
imulq %r12, %r15
movq 0x10(%rbx), %rdi
testq %r15, %r15
je 0x18bcc
testq %rdi, %rdi
je 0x18ba6
callq 0x9420
movq %r15, %rax
shrq $0x3e, %rax
leaq (,%r15,4), %rcx
xorl %edi, %edi
negq %rax
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x9030
movq %rax, %rdi
movq %rax, 0x10(%rbx)
movq %r12, (%rbx)
movq %r13, 0x8(%rbx)
shlq $0x2, %r15
movq %r14, %rsi
movq %r15, %rdx
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x92b0
movq 0x8(%rsp), %rbx
movq 0x10(%rbx), %r14
movq 0x10(%rsp), %r15
testq %r14, %r14
je 0x18c0e
movq %r14, %rdi
callq 0x9420
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rbx)
movq %r15, (%rbx)
movq %r13, 0x8(%rbx)
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23909(%rip), %rsi     # 0x3c540
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movl $0x77, %edx
movl $0x3, %ecx
callq 0x387b6
leaq 0x2392f(%rip), %rsi     # 0x3c584
movl $0x21, %edx
movq %r12, %rdi
callq 0x93b0
leaq 0x20(%rsp), %rdi
callq 0x389de
movq (%rbx), %r12
movq 0x8(%rbx), %r13
jmp 0x18ac7
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x389de
movq %rbx, %rdi
callq 0x95d0
nop