// File: /workspace/github_cpp_makefile_star2_O2/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), %r12d
movl 0x8(%rdx), %ebp
movq %rdx, 0x40(%rsp)
movl 0xc(%rdx), %edx
movl %ebp, %esi
imull %ebx, %esi
movl %edx, 0x10(%rsp)
imull %r12d, %edx
movq %rdi, 0x18(%rsp)
callq 0x285c
leaq 0x30(%rsp), %rdi
movl %ebx, %r14d
movl %ebx, %esi
callq 0x186c
leaq 0x20(%rsp), %rdi
movl %r12d, %esi
callq 0x186c
xorl %r13d, %r13d
testl %r14d, %r14d
cmovlel %r13d, %r14d
movl %r14d, 0xc(%rsp)
movl %r14d, %r15d
negl %r15d
pushq $0x1
popq %rbx
leaq 0x30(%rsp), %r14
leal (%r15,%rbx), %eax
cmpl $0x1, %eax
je 0x4ea7
movq %r14, %rdi
movl %ebx, %esi
callq 0x2030
cvtsi2sd %r13d, %xmm0
movsd %xmm0, (%rax)
incl %ebx
addl %ebp, %r13d
jmp 0x4e84
xorl %r13d, %r13d
testl %r12d, %r12d
cmovlel %r13d, %r12d
negl %r12d
pushq $0x1
popq %rbx
leaq 0x20(%rsp), %r14
leal (%r12,%rbx), %eax
cmpl $0x1, %eax
je 0x4ee1
movq %r14, %rdi
movl %ebx, %esi
callq 0x2030
cvtsi2sd %r13d, %xmm0
movsd %xmm0, (%rax)
incl %ebx
addl 0x10(%rsp), %r13d
jmp 0x4ebc
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x58(%rsp)
cvtsi2sdl 0x10(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
incl 0xc(%rsp)
pushq $0x1
popq %r14
leaq 0x30(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0x78(%rsp), %rbx
cmpl 0xc(%rsp), %r14d
je 0x4ffb
pushq $0x1
popq %rax
movl %eax, %r15d
leal (%r12,%r15), %eax
cmpl $0x1, %eax
je 0x4ff3
movq %r13, %rdi
movl %r14d, %esi
callq 0x2030
movsd (%rax), %xmm0
addsd 0x40e5(%rip), %xmm0     # 0x9028
movsd %xmm0, 0x10(%rsp)
movq %r13, %rdi
movl %r14d, %esi
callq 0x2030
movsd (%rax), %xmm0
addsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movq %rbp, %rdi
movl %r15d, %esi
callq 0x2030
movsd (%rax), %xmm0
addsd 0x40ad(%rip), %xmm0     # 0x9028
movsd %xmm0, 0x68(%rsp)
movq %rbp, %rdi
movl %r15d, %esi
callq 0x2030
movsd (%rax), %xmm0
addsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x50(%rsp), %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x3a1a
movsd (%rax), %xmm0
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0x36ec
cvttsd2si 0x10(%rsp), %esi
cvttsd2si 0x70(%rsp), %edx
cvttsd2si 0x68(%rsp), %ecx
cvttsd2si 0x60(%rsp), %r8d
movq 0x18(%rsp), %rdi
movq %rbx, %r9
callq 0x30c2
movq %rbx, %rdi
callq 0x2a78
incl %r15d
jmp 0x4f1f
incl %r14d
jmp 0x4f0e
leaq 0x20(%rsp), %rdi
callq 0x1908
leaq 0x30(%rsp), %rdi
callq 0x1908
movq 0x18(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5050
movq %rax, %rbx
jmp 0x505a
jmp 0x5043
jmp 0x5043
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x2a78
jmp 0x5046
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x1908
leaq 0x30(%rsp), %rdi
callq 0x1908
movq 0x18(%rsp), %rdi
callq 0x2a78
movq %rbx, %rdi
callq 0x1180