// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]eigenmath/eigenmath.c
// Function: power_sum
void
power_sum(struct atom *BASE, struct atom *EXPO)
{
	int h, i, n;
	struct atom *p1, *p2;

	if (iscomplexnumber(BASE) && isnum(EXPO)) {
		power_complex_number(BASE, EXPO);
		return;
	}

	if (expanding == 0 || !issmallinteger(EXPO) || isnegativenumber(EXPO)) {
		push_symbol(POWER);
		push(BASE);
		push(EXPO);
		list(3);
		return;
	}

	push(EXPO);
	n = pop_integer();

	// square the sum first (prevents infinite loop through multiply)

	h = tos;

	p1 = cdr(BASE);

	while (iscons(p1)) {
		p2 = cdr(BASE);
		while (iscons(p2)) {
			push(car(p1));
			push(car(p2));
			multiply();
			p2 = cdr(p2);
		}
		p1 = cdr(p1);
	}

	add_terms(tos - h);

	// continue up to power n

	for (i = 2; i < n; i++) {
		push(BASE);
		multiply();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2c4b0
cmpl $0x0, %eax
je 0x2a63a
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x4, %eax
je 0x2a628
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0x2a63a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2c770
jmp 0x2a821
cmpl $0x0, 0xfa48f(%rip)     # 0x124ad0
je 0x2a65f
movq -0x10(%rbp), %rdi
callq 0x1dec0
cmpl $0x0, %eax
je 0x2a65f
movq -0x10(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x2a68c
movq 0x36c4a(%rip), %rdi     # 0x612b0
callq 0x9110
movq -0x8(%rbp), %rdi
callq 0x9110
movq -0x10(%rbp), %rdi
callq 0x9110
movl $0x3, %edi
callq 0x90d0
jmp 0x2a821
movq -0x10(%rbp), %rdi
callq 0x9110
callq 0x13520
movl %eax, -0x1c(%rbp)
movl 0x2dc15(%rip), %eax     # 0x582b8
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a6c1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x2a6cc
movq 0x34338(%rip), %rax     # 0x5ea00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a7eb
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a700
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x2a70b
movq 0x342f9(%rip), %rax     # 0x5ea00
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a7b8
movq -0x28(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a73e
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2a749
movq 0x342bb(%rip), %rax     # 0x5ea00
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x9110
movq -0x30(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a76c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x2a777
movq 0x3428d(%rip), %rax     # 0x5ea00
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x9110
callq 0xc280
movq -0x30(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a7a0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x2a7ab
movq 0x34259(%rip), %rax     # 0x5ea00
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x2a713
movq -0x28(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x2a7d3
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x2a7de
movq 0x34226(%rip), %rax     # 0x5ea00
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x2a6d4
movl 0x2dac7(%rip), %edi     # 0x582b8
subl -0x14(%rbp), %edi
callq 0xc520
movl $0x2, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2a821
movq -0x8(%rbp), %rdi
callq 0x9110
callq 0xc280
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2a800
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)