// File: /workspace/github_cpp_makefile_star2_O1/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: kron(Matrix const&, Matrix const&)
Matrix kron(const Matrix& A, const Matrix& B)
{
	int m = A.mRows; int n = A.mColumns;
	int p = B.mRows; int q = B.mColumns;
	int r = m*p; int c = n*q;
	Matrix M(r,c);
	Vector rowpos(m);
	Vector colpos(n);
	for (int i=0;i<m;i++)
	{
		rowpos(i+1) = i*p;
	}
	for (int i=0;i<n;i++)
	{
		colpos(i+1) = i*q;
	}
	for (int i=1;i<=m;i++)
	{
		for (int j = 1;j<=n;j++)
		{
			M.setElements(rowpos(i)+1, rowpos(i)+p, colpos(j)+1, colpos(j)+q, A(i,j)*B);
		}
	}
	return M;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl 0x8(%rsi), %ebx
movq %rsi, 0x50(%rsp)
movl 0xc(%rsi), %r14d
movl 0x8(%rdx), %ebp
movq %rdx, 0x48(%rsp)
movl 0xc(%rdx), %r15d
movl %ebp, %esi
imull %ebx, %esi
movl %r15d, %edx
imull %r14d, %edx
movq %rdi, 0x10(%rsp)
callq 0x3df8
leaq 0x28(%rsp), %rdi
movl %ebx, 0xc(%rsp)
movl %ebx, %esi
callq 0x28c8
leaq 0x18(%rsp), %rdi
movl %r14d, 0x8(%rsp)
movl %r14d, %esi
callq 0x28c8
cmpl $0x0, 0xc(%rsp)
jle 0x6a92
movl 0xc(%rsp), %eax
movl %eax, %r12d
negl %r12d
movl $0x1, %r14d
xorl %r13d, %r13d
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3354
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd %xmm0, (%rax)
leal (%r12,%r14), %eax
incl %eax
movl %r14d, %ecx
incl %ecx
addl %ebp, %r13d
movl %ecx, %r14d
cmpl $0x1, %eax
jne 0x6a65
cmpl $0x0, 0x8(%rsp)
jle 0x6ade
movl 0x8(%rsp), %eax
movl %eax, %r12d
negl %r12d
movl $0x1, %r14d
xorl %r13d, %r13d
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3354
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd %xmm0, (%rax)
leal (%r12,%r14), %eax
incl %eax
movl %r14d, %ecx
incl %ecx
addl %r15d, %r13d
movl %ecx, %r14d
cmpl $0x1, %eax
jne 0x6ab1
cmpl $0x0, 0xc(%rsp)
jle 0x6c1d
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x40(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x38(%rsp)
movl 0x8(%rsp), %eax
movl %eax, %r15d
negl %r15d
movl $0x1, %r12d
leaq 0x28(%rsp), %r13
leaq 0x18(%rsp), %rbp
leaq 0x78(%rsp), %rbx
cmpl $0x0, 0x8(%rsp)
jle 0x6c0a
movl $0x1, %r14d
movq %r13, %rdi
movl %r12d, %esi
callq 0x3354
movsd (%rax), %xmm0
addsd 0x54dd(%rip), %xmm0     # 0xc028
movsd %xmm0, 0x70(%rsp)
movq %r13, %rdi
movl %r12d, %esi
callq 0x3354
movsd (%rax), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movq %rbp, %rdi
movl %r14d, %esi
callq 0x3354
movsd (%rax), %xmm0
addsd 0x54a5(%rip), %xmm0     # 0xc028
movsd %xmm0, 0x60(%rsp)
movq %rbp, %rdi
movl %r14d, %esi
callq 0x3354
movsd (%rax), %xmm0
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x50(%rsp), %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x51ec
movsd (%rax), %xmm0
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0x4e71
cvttsd2si 0x70(%rsp), %esi
cvttsd2si 0x68(%rsp), %edx
cvttsd2si 0x60(%rsp), %ecx
cvttsd2si 0x58(%rsp), %r8d
movq 0x10(%rsp), %rdi
movq %rbx, %r9
callq 0x4768
movq %rbx, %rdi
callq 0x4016
leal (%r15,%r14), %eax
incl %eax
movl %r14d, %ecx
incl %ecx
movl %ecx, %r14d
cmpl $0x1, %eax
jne 0x6b34
leal 0x1(%r12), %eax
cmpl 0xc(%rsp), %r12d
movl %eax, %r12d
jne 0x6b23
leaq 0x18(%rsp), %rdi
callq 0x2970
leaq 0x28(%rsp), %rdi
callq 0x2970
movq 0x10(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x6c72
movq %rax, %rbx
jmp 0x6c7c
jmp 0x6c65
jmp 0x6c65
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4016
jmp 0x6c68
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2970
leaq 0x28(%rsp), %rdi
callq 0x2970
movq 0x10(%rsp), %rdi
callq 0x4016
movq %rbx, %rdi
callq 0x21c0