// File: /workspace/github_c_makefile_star2_O1/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 0x24e14(%rip), %rdx     # 0x40a00
movq %rdx, %rcx
cmoveq %rdi, %rcx
movq %rsi, %rbx
movq (%rcx), %rcx
cmpq 0x276a0(%rip), %rcx     # 0x432a0
je 0x1bc30
movq 0x22537(%rip), %r15     # 0x3e140
cmpq 0x27698(%rip), %rcx     # 0x432a8
jne 0x1bcb5
leaq 0x8(%r14), %rcx
cmpb $0x1, %al
cmovneq %rdx, %rcx
movq (%rcx), %rax
cmpb $0x1, 0x10(%rax)
cmoveq %rax, %rdx
jmp 0x1bcbc
leaq 0x8(%r14), %rcx
cmpb $0x1, %al
cmovneq %rdx, %rcx
movq (%rcx), %rsi
movb 0x10(%rsi), %cl
leaq 0x8(%rsi), %rax
cmpb $0x1, %cl
cmovneq %rdx, %rsi
movq %rdx, %rdi
cmoveq %rax, %rdi
movq (%rdi), %rdi
cmpb $0x1, 0x10(%rdi)
movq %rdx, %rdi
jne 0x1bc6f
cmpb $0x1, %cl
leaq 0x24d98(%rip), %rdi     # 0x40a00
cmoveq %rax, %rdi
movq (%rdi), %rdi
movq (%rdi), %rdi
cmpb $0x1, 0x10(%rdi)
jne 0x1bca6
cmpb $0x1, %cl
leaq 0x24d7e(%rip), %rdx     # 0x40a00
movq %rdx, %rdi
cmoveq %rax, %rdi
movq (%rdi), %rdi
cmpb $0x1, 0x10(%rdi)
jne 0x1bca3
cmpb $0x1, %cl
leaq 0x24d64(%rip), %rdx     # 0x40a00
cmoveq %rax, %rdx
movq (%rdx), %rdx
movq (%rdx), %rdx
movq (%rsi), %r15
movq (%rdx), %rdx
cmpq 0x275f5(%rip), %rdx     # 0x432a8
je 0x1bcfa
leaq 0xeae1c(%rip), %rdx     # 0x106ad8
movq (%rdx), %r12
cmpb $0x5, 0x10(%r15)
je 0x1bce4
cmpb $0x5, 0x10(%r12)
je 0x1bce4
movzbl 0x10(%rbx), %eax
cmpl $0x4, %eax
je 0x1bde4
cmpl $0x5, %eax
jne 0x1be25
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1be96
cmpb $0x1, %cl
leaq 0x24cfc(%rip), %rdx     # 0x40a00
movq %rdx, %rsi
cmoveq %rax, %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
movq %rdx, %rsi
jne 0x1bd28
cmpb $0x1, %cl
leaq 0x24cdf(%rip), %rsi     # 0x40a00
cmoveq %rax, %rsi
movq (%rsi), %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
movq %rdx, %rsi
jne 0x1bd66
cmpb $0x1, %cl
leaq 0x24cc2(%rip), %rsi     # 0x40a00
movq %rsi, %rdi
cmoveq %rax, %rdi
movq (%rdi), %rdi
cmpb $0x1, 0x10(%rdi)
jne 0x1bd5f
cmpb $0x1, %cl
leaq 0x24ca8(%rip), %rsi     # 0x40a00
cmoveq %rax, %rsi
movq (%rsi), %rsi
movq (%rsi), %rsi
addq $0x8, %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1bcbc
cmpb $0x1, %cl
leaq 0x24c83(%rip), %rdx     # 0x40a00
movq %rdx, %rsi
cmoveq %rax, %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
movq %rdx, %rsi
jne 0x1bda1
cmpb $0x1, %cl
leaq 0x24c66(%rip), %rsi     # 0x40a00
cmoveq %rax, %rsi
movq (%rsi), %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1bddc
cmpb $0x1, %cl
leaq 0x24c4c(%rip), %rdx     # 0x40a00
movq %rdx, %rsi
cmoveq %rax, %rsi
movq (%rsi), %rsi
cmpb $0x1, 0x10(%rsi)
jne 0x1bdd5
cmpb $0x1, %cl
leaq 0x24c32(%rip), %rcx     # 0x40a00
cmoveq %rax, %rcx
movq (%rcx), %rdx
movq (%rdx), %rdx
addq $0x8, %rdx
movq (%rdx), %rdx
jmp 0x1bcbc
movq 0x8(%rbx), %rax
cmpl $0x1, -0x4(%rax)
jne 0x1be25
cmpl $0x1, (%rax)
jne 0x1be25
movq %rbx, %rdi
callq 0x1433e
testl %eax, %eax
je 0x1be3b
movq %rbx, %rdi
callq 0x8b01
callq 0xeb5b
testl %eax, %eax
jle 0x1be69
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1c088
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1bfa5
movq 0x2746e(%rip), %rdi     # 0x432b0
callq 0x8b01
movq %r14, %rdi
callq 0x8b01
movq %rbx, %rdi
callq 0x8b01
movl $0x3, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8ad9
js 0x1be7f
movq 0xeac66(%rip), %rdi     # 0x106ad8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8b01
negl %eax
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1c1a2