// File: /workspace/github_cpp_makefile_star2_O3/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 0x3dd4
leaq 0x28(%rsp), %rdi
movl %ebx, 0xc(%rsp)
movl %ebx, %esi
callq 0x28b8
leaq 0x18(%rsp), %rdi
movl %r14d, 0x8(%rsp)
movl %r14d, %esi
callq 0x28b8
cmpl $0x0, 0xc(%rsp)
jle 0x6ac1
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 0x3330
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 0x6a94
cmpl $0x0, 0x8(%rsp)
jle 0x6b0d
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 0x3330
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 0x6ae0
cmpl $0x0, 0xc(%rsp)
jle 0x6c4c
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 0x6c39
movl $0x1, %r14d
movq %r13, %rdi
movl %r12d, %esi
callq 0x3330
movsd (%rax), %xmm0
addsd 0x54ae(%rip), %xmm0     # 0xc028
movsd %xmm0, 0x70(%rsp)
movq %r13, %rdi
movl %r12d, %esi
callq 0x3330
movsd (%rax), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movq %rbp, %rdi
movl %r14d, %esi
callq 0x3330
movsd (%rax), %xmm0
addsd 0x5476(%rip), %xmm0     # 0xc028
movsd %xmm0, 0x60(%rsp)
movq %rbp, %rdi
movl %r14d, %esi
callq 0x3330
movsd (%rax), %xmm0
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x50(%rsp), %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x5202
movsd (%rax), %xmm0
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0x4e7a
cvttsd2si 0x70(%rsp), %esi
cvttsd2si 0x68(%rsp), %edx
cvttsd2si 0x60(%rsp), %ecx
cvttsd2si 0x58(%rsp), %r8d
movq 0x10(%rsp), %rdi
movq %rbx, %r9
callq 0x475c
movq %rbx, %rdi
callq 0x3fe2
leal (%r15,%r14), %eax
incl %eax
movl %r14d, %ecx
incl %ecx
movl %ecx, %r14d
cmpl $0x1, %eax
jne 0x6b63
leal 0x1(%r12), %eax
cmpl 0xc(%rsp), %r12d
movl %eax, %r12d
jne 0x6b52
leaq 0x18(%rsp), %rdi
callq 0x294e
leaq 0x28(%rsp), %rdi
callq 0x294e
movq 0x10(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x6ca1
movq %rax, %rbx
jmp 0x6cab
jmp 0x6c94
jmp 0x6c94
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x3fe2
jmp 0x6c97
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x294e
leaq 0x28(%rsp), %rdi
callq 0x294e
movq 0x10(%rsp), %rdi
callq 0x3fe2
movq %rbx, %rdi
callq 0x21b0