// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]eigenmath/eigenmath.c
// Function: outer
void
outer(void)
{
	int i, j, k, n, ncol, nrow;
	struct atom *p1, *p2, *p3;

	p2 = pop();
	p1 = pop();

	if (!istensor(p1) || !istensor(p2)) {
		push(p1);
		push(p2);
		multiply();
		return;
	}

	if (p1->u.tensor->ndim + p2->u.tensor->ndim > MAXDIM)
		stopf("outer: rank exceeds max");

	// sync diffs

	nrow = p1->u.tensor->nelem;
	ncol = p2->u.tensor->nelem;

	p3 = alloc_tensor(nrow * ncol);

	for (i = 0; i < nrow; i++)
		for (j = 0; j < ncol; j++) {
			push(p1->u.tensor->elem[i]);
			push(p2->u.tensor->elem[j]);
			multiply();
			p3->u.tensor->elem[i * ncol + j] = pop();
		}

	// dim info

	p3->u.tensor->ndim = p1->u.tensor->ndim + p2->u.tensor->ndim;

	k = 0;

	n = p1->u.tensor->ndim;

	for (i = 0; i < n; i++)
		p3->u.tensor->dim[k++] = p1->u.tensor->dim[i];

	n = p2->u.tensor->ndim;

	for (i = 0; i < n; i++)
		p3->u.tensor->dim[k++] = p2->u.tensor->dim[i];

	push(p3);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
callq 0x91d0
movq %rax, -0x28(%rbp)
callq 0x91d0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x7, %eax
jne 0x29314
movq -0x28(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x7, %eax
je 0x29330
movq -0x20(%rbp), %rdi
callq 0x9110
movq -0x28(%rbp), %rdi
callq 0x9110
callq 0xc280
jmp 0x294ca
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
addl (%rcx), %eax
cmpl $0x18, %eax
jle 0x29353
leaq 0x20565(%rip), %rdi     # 0x498b3
callq 0x78d0
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl 0x64(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl 0x64(%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %edi
imull -0x14(%rbp), %edi
callq 0x79b0
movq %rax, -0x30(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x29403
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x293f6
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movq 0x68(%rax,%rcx,8), %rdi
callq 0x9110
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x8(%rbp), %rcx
movq 0x68(%rax,%rcx,8), %rdi
callq 0x9110
callq 0xc280
callq 0x91d0
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x4(%rbp), %ecx
imull -0x14(%rbp), %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movq %rdx, 0x68(%rax,%rcx,8)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x29393
jmp 0x293f8
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x29384
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
addl (%rax), %ecx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl %ecx, (%rax)
movl $0x0, -0xc(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x29473
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movl 0x4(%rax,%rcx,4), %edx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0xc(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xc(%rbp)
movslq %ecx, %rcx
movl %edx, 0x4(%rax,%rcx,4)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x29438
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x294c1
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movl 0x4(%rax,%rcx,4), %edx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0xc(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xc(%rbp)
movslq %ecx, %rcx
movl %edx, 0x4(%rax,%rcx,4)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x29486
movq -0x30(%rbp), %rdi
callq 0x9110
addq $0x30, %rsp
popq %rbp
retq