// File: /workspace/github_c_makefile_star2_O3/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), %cl
cmpb $0x1, %cl
leaq 0x27d29(%rip), %rax     # 0x45a00
movq %rax, %rdx
cmoveq %rdi, %rdx
movq %rsi, %rbx
movq (%rdx), %rdx
cmpq 0x2a5b5(%rip), %rdx     # 0x482a0
je 0x1dd1c
movq 0x2544c(%rip), %r15     # 0x43140
cmpq 0x2a5ad(%rip), %rdx     # 0x482a8
jne 0x1ddef
leaq 0x8(%r14), %rdx
cmpb $0x1, %cl
cmovneq %rax, %rdx
movq (%rdx), %rcx
cmpb $0x1, 0x10(%rcx)
cmoveq %rcx, %rax
jmp 0x1de7f
leaq 0x8(%r14), %rdx
cmpb $0x1, %cl
cmovneq %rax, %rdx
movq (%rdx), %rcx
movb 0x10(%rcx), %dl
cmpb $0x1, %dl
jne 0x1dd5c
movq 0x8(%rcx), %rdi
cmpb $0x1, 0x10(%rdi)
leaq 0x27cbf(%rip), %rsi     # 0x45a00
cmovneq %rsi, %rdi
movq (%rcx), %r15
movq (%rdi), %rdi
cmpb $0x1, 0x10(%rdi)
jne 0x1dd8a
cmpb $0x1, %dl
jne 0x1dd73
movq 0x8(%rcx), %rsi
jmp 0x1dd7a
movq 0x27c9d(%rip), %r15     # 0x45a00
cmpb $0x1, 0x10(%r15)
jne 0x1ddd4
movq (%r15), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1dddf
movq 0x27c86(%rip), %rsi     # 0x45a00
cmpb $0x1, 0x10(%rsi)
je 0x1dd87
leaq 0x27c79(%rip), %rsi     # 0x45a00
movq (%rsi), %rsi
movq (%rsi), %rsi
cmpq 0x2a514(%rip), %rsi     # 0x482a8
jne 0x1ddef
cmpb $0x1, %dl
jne 0x1ddfb
movq 0x8(%rcx), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1de2f
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1de2a
movq 0x8(%rcx), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1de45
leaq 0x8(%rcx), %rdi
cmpb $0x1, %dl
leaq 0x27c32(%rip), %rsi     # 0x45a00
cmoveq %rdi, %rsi
jmp 0x1de25
cmpq 0x2a4cd(%rip), %r15     # 0x482a8
jne 0x1ddef
jmp 0x1de2a
movq 0x27c1a(%rip), %rsi     # 0x45a00
cmpq 0x2a4bb(%rip), %rsi     # 0x482a8
je 0x1ddfb
leaq 0xedce2(%rip), %rsi     # 0x10bad8
jmp 0x1de82
movq 0x27bfe(%rip), %rsi     # 0x45a00
cmpb $0x1, 0x10(%rsi)
jne 0x1de2a
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1de2a
leaq 0x27be8(%rip), %rsi     # 0x45a00
movq 0x27be1(%rip), %rdi     # 0x45a00
cmpb $0x1, 0x10(%rdi)
jne 0x1de4c
movq (%rsi), %rsi
jmp 0x1de4c
movq %rax, %rsi
jmp 0x1de53
leaq 0x27bca(%rip), %rsi     # 0x45a00
movq 0x27bc3(%rip), %rdi     # 0x45a00
cmpb $0x1, 0x10(%rdi)
je 0x1de4c
jmp 0x1de82
leaq 0x27bb4(%rip), %rsi     # 0x45a00
movq (%rsi), %rsi
addq $0x8, %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1de7f
cmpb $0x1, %dl
jne 0x1df17
movq 0x8(%rcx), %rax
cmpb $0x1, 0x10(%rax)
jne 0x1df44
movq 0x8(%rcx), %rax
movq (%rax), %rax
jmp 0x1df4b
movq %rax, %rsi
movq (%rsi), %r12
cmpb $0x5, 0x10(%r15)
je 0x1dea2
cmpb $0x5, 0x10(%r12)
je 0x1dea2
movzbl 0x10(%rbx), %eax
cmpl $0x4, %eax
je 0x1deb8
cmpl $0x5, %eax
jne 0x1df01
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1dfd5
movq 0x8(%rbx), %rax
cmpl $0x1, -0x4(%rax)
jne 0x1df01
cmpl $0x1, (%rax)
jne 0x1df01
movq %rbx, %rdi
callq 0x15ac2
testl %eax, %eax
je 0x1df7a
movq %rbx, %rdi
callq 0x8ba5
callq 0xf8e6
testl %eax, %eax
jle 0x1dfa8
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1e1f0
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1e0e4
leaq 0x27ae2(%rip), %rax     # 0x45a00
movq 0x27adb(%rip), %rcx     # 0x45a00
cmpb $0x1, 0x10(%rcx)
jne 0x1df72
movq 0x27ace(%rip), %rcx     # 0x45a00
movq (%rcx), %rcx
cmpb $0x1, 0x10(%rcx)
jne 0x1df72
movq 0x27abe(%rip), %rax     # 0x45a00
jmp 0x1df55
movq 0x27ab5(%rip), %rax     # 0x45a00
cmpb $0x1, 0x10(%rax)
jne 0x1df6b
movq 0x8(%rcx), %rax
cmpb $0x1, 0x10(%rax)
je 0x1df62
leaq 0x27a9e(%rip), %rax     # 0x45a00
movq (%rax), %rax
addq $0x8, %rax
jmp 0x1df72
leaq 0x27a8e(%rip), %rax     # 0x45a00
movq (%rax), %rsi
jmp 0x1de82
movq 0x2a32f(%rip), %rdi     # 0x482b0
callq 0x8ba5
movq %r14, %rdi
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movl $0x3, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8b7d
js 0x1dfbe
movq 0xedb27(%rip), %rdi     # 0x10bad8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8ba5
negl %eax
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1e340