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

	// product of tensor elements?

	if (lengthf(p1) == 2) {
		push(cadr(p1));
		evalf();
		p1 = pop();
		if (!istensor(p1)) {
			push(p1);
			return;
		}
		n = p1->u.tensor->nelem;
		for (i = 0; i < n; i++)
			push(p1->u.tensor->elem[i]);
		multiply_factors(n);
		return;
	}

	p2 = cadr(p1);
	if (!isusersymbol(p2))
		stopf("product: index symbol err");

	push(caddr(p1));
	evalf();
	p3 = pop();
	if (!issmallinteger(p3))
		stopf("product: index range err");
	push(p3);
	j = pop_integer();

	push(cadddr(p1));
	evalf();
	p3 = pop();
	if (!issmallinteger(p3))
		stopf("product: index range err");
	push(p3);
	k = pop_integer();

	p1 = caddddr(p1);

	save_symbol(p2);

	h = tos;

	for (;;) {
		push_integer(j);
		p3 = pop();
		set_symbol(p2, p3, symbol(NIL));
		push(p1);
		evalg();
		if (j == k)
			break;
		if (j < k)
			j++;
		else
			j--;
		if (tos - h == 1000)
			multiply_factors(1000); // to prevent stack overflow
	}

	multiply_factors(tos - h);

	p1 = pop();
	restore_symbol();
	push(p1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
callq 0x86c3
leaq 0x8(%r15), %r13
cmpb $0x1, 0x10(%r15)
leaq 0x24f9a(%rip), %rcx     # 0x3e9f0
movq %rcx, %rdx
cmoveq %r13, %rdx
movq (%rdx), %rdx
movb 0x10(%rdx), %sil
cmpb $0x1, %sil
movq %rcx, %rdi
cmoveq %rdx, %rdi
movq (%rdi), %rbx
cmpl $0x2, %eax
jne 0x19ac4
movq %rbx, %rdi
callq 0x861b
callq 0x8fbb
callq 0x868d
movq %rax, %rbx
cmpb $0x7, 0x10(%rax)
jne 0x19db4
movq (%rbx), %rax
movl 0x64(%rax), %r14d
xorl %r15d, %r15d
testl %r14d, %r14d
movl $0x0, %r12d
cmovgl %r14d, %r12d
cmpq %r15, %r12
je 0x19ada
movq (%rbx), %rax
movq 0x68(%rax,%r15,8), %rdi
callq 0x861b
incq %r15
jmp 0x19aad
cmpb $0x3, 0x10(%rbx)
jne 0x19de2
cmpb $0x1, %sil
jne 0x19af0
movq 0x8(%rdx), %rax
jmp 0x19af7
movl %r14d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa04c
movq 0x24ef9(%rip), %rax     # 0x3e9f0
cmpb $0x1, 0x10(%rax)
jne 0x19b00
movq %rax, %rcx
movq (%rcx), %rdi
callq 0x861b
callq 0x8fbb
callq 0x868d
movq %rax, %r14
movq %rax, %rdi
callq 0x126ab
testl %eax, %eax
je 0x19dd6
movq %r14, %rdi
callq 0x861b
callq 0xd9d9
cmpb $0x1, 0x10(%r15)
leaq 0x24eb2(%rip), %rcx     # 0x3e9f0
movq %rcx, %rdx
cmoveq %r13, %rdx
movl %eax, %r14d
movq (%rdx), %rax
cmpb $0x1, 0x10(%rax)
jne 0x19b61
movq 0x8(%rax), %rdx
cmpb $0x1, 0x10(%rdx)
jne 0x19b81
movq 0x8(%rdx), %rdx
jmp 0x19b88
movq 0x24e88(%rip), %rax     # 0x3e9f0
cmpb $0x1, 0x10(%rax)
jne 0x19ba8
movq 0x8(%rax), %rax
cmpb $0x1, 0x10(%rax)
jne 0x19ba8
movq 0x24e71(%rip), %rax     # 0x3e9f0
jmp 0x19b92
movq 0x24e68(%rip), %rdx     # 0x3e9f0
cmpb $0x1, 0x10(%rdx)
jne 0x19ba8
movq 0x8(%rax), %rax
cmpb $0x1, 0x10(%rax)
jne 0x19b9e
addq $0x8, %rax
jmp 0x19ba5
leaq 0x24e4b(%rip), %rax     # 0x3e9f0
movq (%rax), %rcx
movq (%rcx), %rdi
callq 0x861b
callq 0x8fbb
callq 0x868d
movq %rax, %r12
movq %rax, %rdi
callq 0x126ab
testl %eax, %eax
je 0x19dd6
movq %r12, %rdi
callq 0x861b
callq 0xd9d9
cmpb $0x1, 0x10(%r15)
leaq 0x24e0a(%rip), %rcx     # 0x3e9f0
cmovneq %rcx, %r13
movl %eax, %r15d
movq (%r13), %rax
movb 0x10(%rax), %dl
cmpb $0x1, %dl
jne 0x19c16
movq 0x8(%rax), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x19c4b
movq 0x8(%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
je 0x19c58
leaq 0x24ddc(%rip), %rsi     # 0x3e9f0
jmp 0x19c6d
movq 0x24dd3(%rip), %rsi     # 0x3e9f0
cmpb $0x1, 0x10(%rsi)
jne 0x19d2d
movq 0x8(%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
movq 0x24dba(%rip), %rsi     # 0x3e9f0
movb 0x10(%rsi), %dil
jne 0x19c81
cmpb $0x1, %dil
je 0x19c62
leaq 0x24da7(%rip), %rsi     # 0x3e9f0
jmp 0x19c66
movq 0x24d9e(%rip), %rsi     # 0x3e9f0
cmpb $0x1, 0x10(%rsi)
jne 0x19caf
movq 0x8(%rax), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x19c42
addq $0x8, %rsi
movq (%rsi), %rsi
addq $0x8, %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x19d2d
cmpb $0x1, %dl
jne 0x19c8b
jmp 0x19cbc
cmpb $0x1, %dil
jne 0x19d2d
movq 0x24d5e(%rip), %rcx     # 0x3e9f0
leaq 0x24d57(%rip), %rax     # 0x3e9f0
cmpb $0x1, 0x10(%rcx)
jne 0x19d2a
movq 0x8(%rcx), %rcx
cmpb $0x1, 0x10(%rcx)
je 0x19cff
jmp 0x19d2a
movq 0x24d3a(%rip), %rsi     # 0x3e9f0
cmpb $0x1, 0x10(%rsi)
jne 0x19d2d
movq 0x8(%rax), %rcx
cmpb $0x1, 0x10(%rcx)
jne 0x19ce9
movq 0x8(%rcx), %rcx
cmpb $0x1, 0x10(%rcx)
jne 0x19d23
cmpb $0x1, %dl
jne 0x19cff
movq 0x8(%rax), %rcx
cmpb $0x1, 0x10(%rcx)
jne 0x19dca
addq $0x8, %rax
jmp 0x19d13
leaq 0x24d00(%rip), %rax     # 0x3e9f0
movq 0x24cf9(%rip), %rcx     # 0x3e9f0
cmpb $0x1, 0x10(%rcx)
je 0x19d1a
jmp 0x19d2a
leaq 0x24cea(%rip), %rax     # 0x3e9f0
movq 0x24ce3(%rip), %rcx     # 0x3e9f0
cmpb $0x1, 0x10(%rcx)
jne 0x19d1a
movq (%rax), %rax
addq $0x8, %rax
movq (%rax), %rax
addq $0x8, %rax
jmp 0x19d2a
leaq 0x24cc6(%rip), %rax     # 0x3e9f0
movq (%rax), %rcx
movq (%rcx), %r12
movq %rbx, %rdi
callq 0xd63f
movl 0x1e569(%rip), %r13d    # 0x382a8
movl %r14d, %edi
callq 0xa426
callq 0x868d
movq 0x24c9d(%rip), %rdx     # 0x3e9f0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x12721
movq %r12, %rdi
callq 0x861b
callq 0x8f7d
cmpl %r15d, %r14d
je 0x19d99
setl %al
movzbl %al, %eax
leal (%r14,%rax,2), %r14d
decl %r14d
movl 0x1e525(%rip), %eax     # 0x382a8
subl %r13d, %eax
cmpl $0x3e8, %eax            # imm = 0x3E8
jne 0x19d3f
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xa04c
jmp 0x19d3f
movl 0x1e509(%rip), %edi     # 0x382a8
subl %r13d, %edi
callq 0xa04c
callq 0x868d
movq %rax, %rbx
callq 0xd684
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x861b
leaq 0x24c1f(%rip), %rax     # 0x3e9f0
jmp 0x19d1a
leaq 0xdba6(%rip), %rdi      # 0x27983
callq 0x7756
leaq 0xdb80(%rip), %rdi      # 0x27969
callq 0x7756