// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl 0x235c7(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %ecx       # imm = 0xFFFE795F
leal (%rax,%rcx), %edx
cmpl %ecx, %edx
jbe 0x1bec2
leal -0x1(%rax), %ecx
movl %ecx, 0x235ae(%rip)     # 0x3f2b8
cmpl $0x1, %eax
jbe 0x1bec2
leaq 0x2c8a6(%rip), %rdx     # 0x485c0
movq (%rdx,%rcx,8), %rbx
addl $-0x2, %eax
movl %eax, 0x23591(%rip)     # 0x3f2b8
movq (%rdx,%rax,8), %rdi
cmpb $0x7, 0x10(%rdi)
jne 0x1be57
cmpb $0x7, 0x10(%rbx)
jne 0x1be57
movq %rdi, -0x40(%rbp)
movq (%rdi), %rcx
movq %rbx, -0x38(%rbp)
movq (%rbx), %rax
movl (%rax), %edx
addl (%rcx), %edx
cmpl $0x19, %edx
jge 0x1bece
movslq 0x64(%rcx), %rbx
movl 0x64(%rax), %ecx
movq %rcx, -0x30(%rbp)
movl %ecx, %edi
imull %ebx, %edi
callq 0x7893
movq %rax, %r13
movq %rbx, -0x50(%rbp)
testq %rbx, %rbx
movq -0x40(%rbp), %r9
jle 0x1be1d
movq -0x30(%rbp), %rcx
leaq (,%rcx,8), %rcx
movq %rcx, -0x48(%rbp)
movl $0x68, %r12d
xorl %ebx, %ebx
movl $0xfffe795f, %r14d      # imm = 0xFFFE795F
cmpl $0x0, -0x30(%rbp)
jle 0x1be10
xorl %r15d, %r15d
movq (%r9), %rax
movq 0x68(%rax,%rbx,8), %rdi
callq 0x8ba5
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x68(%rax,%r15,8), %rdi
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movl 0x234e0(%rip), %eax     # 0x3f2b8
leal (%rax,%r14), %ecx
cmpl %r14d, %ecx
jbe 0x1bec2
decl %eax
movl %eax, 0x234cb(%rip)     # 0x3f2b8
leaq 0x2c7cc(%rip), %rcx     # 0x485c0
movq (%rcx,%rax,8), %rdx
movq (%r13), %rcx
addq %r12, %rcx
movq %rdx, (%rcx,%r15,8)
incq %r15
cmpq %r15, -0x30(%rbp)
movq -0x40(%rbp), %r9
jne 0x1bdaa
incq %rbx
addq -0x48(%rbp), %r12
cmpq -0x50(%rbp), %rbx
jne 0x1bda1
movq (%r9), %rdx
movq -0x38(%rbp), %r8
movq (%r8), %rcx
movl (%rcx), %ecx
addl (%rdx), %ecx
movq (%r13), %rdx
movl %ecx, (%rdx)
movq (%r9), %rcx
movslq (%rcx), %rdi
testq %rdi, %rdi
jle 0x1be7c
xorl %ecx, %ecx
movq (%r9), %rdx
movl 0x4(%rdx,%rcx,4), %edx
movq (%r13), %rsi
movl %edx, 0x4(%rsi,%rcx,4)
incq %rcx
cmpq %rcx, %rdi
jne 0x1be3e
jmp 0x1be7e
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movl $0x2, %edi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xacef
xorl %edi, %edi
movq (%r8), %rcx
movslq (%rcx), %rcx
testq %rcx, %rcx
jle 0x1beac
leaq 0x4(,%rdi,4), %r9
xorl %edx, %edx
movq (%r8), %rsi
movl 0x4(%rsi,%rdx,4), %esi
movq (%r13), %rdi
addq %r9, %rdi
movl %esi, (%rdi,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x1be93
movq %r13, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8ba5
leaq 0x13078(%rip), %rdi     # 0x2ef41
callq 0x780b
leaq 0x12a2e(%rip), %rdi     # 0x2e903
callq 0x780b