// File: /workspace/github_c_makefile_star2_O2/georgeweigt[P]eigenmath/eigenmath.c
// Function: power_complex_number
void
power_complex_number(struct atom *BASE, struct atom *EXPO)
{
	int n;
	struct atom *X, *Y;

	// prefixform(2+3*i) = (add 2 (multiply 3 (power -1 1/2)))

	// prefixform(1+i) = (add 1 (power -1 1/2))

	// prefixform(3*i) = (multiply 3 (power -1 1/2))

	// prefixform(i) = (power -1 1/2)

	if (car(BASE) == symbol(ADD)) {
		X = cadr(BASE);
		if (caaddr(BASE) == symbol(MULTIPLY))
			Y = cadaddr(BASE);
		else
			Y = one;
	} else if (car(BASE) == symbol(MULTIPLY)) {
		X = zero;
		Y = cadr(BASE);
	} else {
		X = zero;
		Y = one;
	}

	if (isdouble(X) || isdouble(Y) || isdouble(EXPO)) {
		power_complex_double(X, Y, EXPO);
		return;
	}

	if (!isinteger(EXPO)) {
		power_complex_rational(X, Y, EXPO);
		return;
	}

	if (!issmallinteger(EXPO)) {
		push_symbol(POWER);
		push(BASE);
		push(EXPO);
		list(3);
		return;
	}

	push(EXPO);
	n = pop_integer();

	if (n > 0)
		power_complex_plus(X, Y, n);
	else if (n < 0)
		power_complex_minus(X, Y, -n);
	else
		push_integer(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movb 0x10(%rdi), %al
cmpb $0x1, %al
leaq 0x259a9(%rip), %rcx     # 0x3e9f0
movq %rcx, %rdx
cmoveq %rdi, %rdx
movq %rsi, %rbx
movq (%rdx), %rdx
cmpq 0x28235(%rip), %rdx     # 0x41290
je 0x1908b
movq 0x230cc(%rip), %r15     # 0x3c130
cmpq 0x2822d(%rip), %rdx     # 0x41298
jne 0x1915d
leaq 0x8(%r14), %rdx
cmpb $0x1, %al
cmovneq %rcx, %rdx
movq (%rdx), %rax
cmpb $0x1, 0x10(%rax)
cmoveq %rax, %rcx
jmp 0x191ea
leaq 0x8(%r14), %rdx
cmpb $0x1, %al
cmovneq %rcx, %rdx
movq (%rdx), %rax
movb 0x10(%rax), %dl
cmpb $0x1, %dl
jne 0x190ca
movq 0x8(%rax), %rdi
cmpb $0x1, 0x10(%rdi)
leaq 0x25941(%rip), %rsi     # 0x3e9f0
cmovneq %rsi, %rdi
movq (%rax), %r15
movq (%rdi), %rdi
cmpb $0x1, 0x10(%rdi)
jne 0x190f8
cmpb $0x1, %dl
jne 0x190e1
movq 0x8(%rax), %rsi
jmp 0x190e8
movq 0x2591f(%rip), %r15     # 0x3e9f0
cmpb $0x1, 0x10(%r15)
jne 0x19142
movq (%r15), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1914d
movq 0x25908(%rip), %rsi     # 0x3e9f0
cmpb $0x1, 0x10(%rsi)
je 0x190f5
leaq 0x258fb(%rip), %rsi     # 0x3e9f0
movq (%rsi), %rsi
movq (%rsi), %rsi
cmpq 0x28196(%rip), %rsi     # 0x41298
jne 0x1915d
cmpb $0x1, %dl
jne 0x19169
movq 0x8(%rax), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1919d
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x19198
movq 0x8(%rax), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x191b3
leaq 0x8(%rax), %rdi
cmpb $0x1, %dl
leaq 0x258b4(%rip), %rsi     # 0x3e9f0
cmoveq %rdi, %rsi
jmp 0x19193
cmpq 0x2814f(%rip), %r15     # 0x41298
jne 0x1915d
jmp 0x19198
movq 0x2589c(%rip), %rsi     # 0x3e9f0
cmpq 0x2813d(%rip), %rsi     # 0x41298
je 0x19169
leaq 0xeb964(%rip), %rsi     # 0x104ac8
jmp 0x191ed
movq 0x25880(%rip), %rsi     # 0x3e9f0
cmpb $0x1, 0x10(%rsi)
jne 0x19198
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x19198
leaq 0x2586a(%rip), %rsi     # 0x3e9f0
movq 0x25863(%rip), %rdi     # 0x3e9f0
cmpb $0x1, 0x10(%rdi)
jne 0x191ba
movq (%rsi), %rsi
jmp 0x191ba
movq %rcx, %rsi
jmp 0x191c1
leaq 0x2584c(%rip), %rsi     # 0x3e9f0
movq 0x25845(%rip), %rdi     # 0x3e9f0
cmpb $0x1, 0x10(%rdi)
je 0x191ba
jmp 0x191ed
leaq 0x25836(%rip), %rsi     # 0x3e9f0
movq (%rsi), %rsi
addq $0x8, %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x191ea
cmpb $0x1, %dl
jne 0x19273
movq 0x8(%rax), %rcx
cmpb $0x1, 0x10(%rcx)
jne 0x192e3
leaq 0x8(%rax), %rcx
jmp 0x1928b
movq %rcx, %rsi
movq (%rsi), %r12
cmpb $0x5, 0x10(%r15)
je 0x19205
cmpb $0x5, 0x10(%r12)
je 0x19205
cmpb $0x5, 0x10(%rbx)
jne 0x1921b
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x19330
movq %rbx, %rdi
callq 0x8b5d
testl %eax, %eax
je 0x1925d
movq %rbx, %rdi
callq 0x126ab
testl %eax, %eax
je 0x192a5
movq %rbx, %rdi
callq 0x861b
callq 0xd9d9
testl %eax, %eax
jle 0x192d1
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x194c0
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x19415
leaq 0x25776(%rip), %rcx     # 0x3e9f0
movq 0x2576f(%rip), %rsi     # 0x3e9f0
cmpb $0x1, 0x10(%rsi)
jne 0x19311
movq (%rcx), %rcx
movq (%rcx), %rcx
cmpb $0x1, 0x10(%rcx)
jne 0x1930a
cmpb $0x1, %dl
je 0x192f0
movq 0x2574d(%rip), %rax     # 0x3e9f0
jmp 0x192f4
movq 0x27ff4(%rip), %rdi     # 0x412a0
callq 0x861b
movq %r14, %rdi
callq 0x861b
movq %rbx, %rdi
callq 0x861b
pushq $0x3
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x85eb
js 0x19319
pushq $0x1
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa426
movq 0x25706(%rip), %rcx     # 0x3e9f0
cmpb $0x1, 0x10(%rcx)
jne 0x1930a
movq 0x8(%rax), %rax
cmpb $0x1, 0x10(%rax)
je 0x19301
leaq 0x256ef(%rip), %rax     # 0x3e9f0
movq (%rax), %rcx
addq $0x8, %rcx
jmp 0x19311
leaq 0x256df(%rip), %rcx     # 0x3e9f0
movq (%rcx), %rsi
jmp 0x191ed
negl %eax
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x19583