// File: xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::ConcatenateMatrixByI(std::vector<Matrix, std::allocator<Matrix>>*)
Matrix Matrix::ConcatenateMatrixByI(std::vector<Matrix> *A)
{
    // vertically place a vector of matrix together, 
    // method 2
    auto dim = (*A)[0].Dimension();
    size_t length = A->size();

    Matrix C(dim.first*length, dim.second, 0);

    for(size_t i=0;i<length;i++)
    {
        assert(dim.second == (*A)[i].Dimension().second);
        assert(dim.first == (*A)[i].Dimension().first);

        for(size_t ii=0;ii<dim.first;ii++)
            for(size_t jj=0;jj<dim.second;jj++)
                C[i*dim.first + ii][jj] = ((*A)[i])[ii][jj];
    }

    return C;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0x48(%rsp)
movq %rdi, %rax
movq %rax, 0x40(%rsp)
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq 0xb8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1f9e0
movq %rax, %rdi
callq 0x3bae0
movq %rax, 0xa8(%rsp)
movq %rdx, 0xb0(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x1f9c0
movq 0x48(%rsp), %rdi
movq %rax, 0xa0(%rsp)
movb $0x0, 0x9f(%rsp)
movq 0xa8(%rsp), %rsi
imulq 0xa0(%rsp), %rsi
movq 0xb0(%rsp), %rdx
xorps %xmm0, %xmm0
callq 0x3b590
movq $0x0, 0x90(%rsp)
movq 0x90(%rsp), %rax
cmpq 0xa0(%rsp), %rax
jae 0x40061
movq 0xb0(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x1f9e0
movq %rax, %rdi
callq 0x3bae0
movq %rdx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
jmp 0x3fe98
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
movq %rdx, 0x80(%rsp)
movq %rcx, 0x88(%rsp)
cmpq 0x88(%rsp), %rax
jne 0x3fec3
jmp 0x3feff
leaq 0x153bb(%rip), %rdi     # 0x55285
leaq 0x14fba(%rip), %rsi     # 0x54e8b
movl $0x3dc, %edx            # imm = 0x3DC
leaq 0x153d1(%rip), %rcx     # 0x552ae
callq 0x4170
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x3bb80
jmp 0x4008a
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x1f9e0
movq %rax, %rdi
callq 0x3bae0
movq %rdx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
jmp 0x3ff35
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
cmpq 0x60(%rsp), %rax
jne 0x3ff57
jmp 0x3ff76
leaq 0x15392(%rip), %rdi     # 0x552f0
leaq 0x14f26(%rip), %rsi     # 0x54e8b
movl $0x3dd, %edx            # imm = 0x3DD
leaq 0x1533d(%rip), %rcx     # 0x552ae
callq 0x4170
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
cmpq 0xa8(%rsp), %rax
jae 0x40046
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0xb0(%rsp), %rax
jae 0x40031
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x1f9e0
movq %rax, %rdi
movq 0x58(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x50(%rsp), %rsi
callq 0x1fd60
movq 0x48(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x90(%rsp), %rsi
imulq 0xa8(%rsp), %rsi
addq 0x58(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x50(%rsp), %rsi
callq 0x1fd60
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x3ff9b
jmp 0x40033
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x3ff7f
jmp 0x40048
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0x3fe4c
movb $0x1, 0x9f(%rsp)
testb $0x1, 0x9f(%rsp)
jne 0x4007d
movq 0x48(%rsp), %rdi
callq 0x3bb80
movq 0x40(%rsp), %rax
addq $0xc8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0x43f0
nopw %cs:(%rax,%rax)