// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]eigenmath/eigenmath.c
// Function: reduce_radical_rational
struct atom *
reduce_radical_rational(int h, struct atom *COEF)
{
	int i, k;
	struct atom *p1, *p2, *NUMER, *DENOM, *BASE, *EXPO;

	if (isplusone(COEF) || isminusone(COEF))
		return COEF; // COEF has no factors, no cancellation is possible

	push(COEF);
	absfunc();
	p1 = pop();

	push(p1);
	numerator();
	NUMER = pop();

	push(p1);
	denominator();
	DENOM = pop();

	k = 0;

	for (i = h; i < tos; i++) {
		p1 = stack[i];
		if (!isradical(p1))
			continue;
		BASE = cadr(p1);
		EXPO = caddr(p1);
		if (isnegativenumber(EXPO)) {
			mod_integers(NUMER, BASE);
			p2 = pop();
			if (iszero(p2)) {
				push(NUMER);
				push(BASE);
				divide();
				NUMER = pop();
				push_symbol(POWER);
				push(BASE);
				push_integer(1);
				push(EXPO);
				add();
				list(3);
				stack[i] = pop();
				k++;
			}
		} else {
			mod_integers(DENOM, BASE);
			p2 = pop();
			if (iszero(p2)) {
				push(DENOM);
				push(BASE);
				divide();
				DENOM = pop();
				push_symbol(POWER);
				push(BASE);
				push_integer(-1);
				push(EXPO);
				add();
				list(3);
				stack[i] = pop();
				k++;
			}
		}
	}

	if (k) {
		push(NUMER);
		push(DENOM);
		divide();
		if (isnegativenumber(COEF))
			negate();
		COEF = pop();
	}

	return COEF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movl %edi, %r12d
movq %rsi, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0xd1c4
testl %eax, %eax
jne 0x1aca4
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x1, %edx
callq 0xd1c4
testl %eax, %eax
jne 0x1aca4
movq %r14, %rdi
callq 0x8ba5
callq 0x9e31
movl 0x249ef(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %ebx       # imm = 0xFFFE795F
leal (%rax,%rbx), %ecx
cmpl %ebx, %ecx
jbe 0x1acc9
decl %eax
movl %eax, 0x249d7(%rip)     # 0x3f2b8
leaq 0x2dcd8(%rip), %rcx     # 0x485c0
movq (%rcx,%rax,8), %r15
movq %r15, %rdi
callq 0x8ba5
callq 0xe915
callq 0xb238
movl 0x249b4(%rip), %eax     # 0x3f2b8
leal (%rax,%rbx), %ecx
cmpl %ebx, %ecx
jbe 0x1acc9
leal -0x1(%rax), %ecx
movl %ecx, 0x249a0(%rip)     # 0x3f2b8
cmpl $0x1, %eax
jbe 0x1acc9
addl $-0x2, %eax
movl %eax, 0x2498e(%rip)     # 0x3f2b8
leaq 0x2dc8f(%rip), %rbx     # 0x485c0
movq (%rbx,%rax,8), %rax
movq %rax, -0x38(%rbp)
movq %r15, %rdi
callq 0x8ba5
callq 0xe915
movl 0x2496b(%rip), %r15d    # 0x3f2b8
movl $0xfffe795f, %eax       # imm = 0xFFFE795F
leal (%r15,%rax), %ecx
cmpl %eax, %ecx
jbe 0x1acc9
leal -0x1(%r15), %eax
movl %eax, 0x24950(%rip)     # 0x3f2b8
cmpl $0x1, %r15d
jbe 0x1acc9
addl $-0x2, %r15d
movl %r15d, 0x2493b(%rip)    # 0x3f2b8
cmpl %r12d, %r15d
jle 0x1aca4
movq %r14, -0x48(%rbp)
movl %r15d, %eax
movq (%rbx,%rax,8), %rax
movq %rax, -0x40(%rbp)
movslq %r12d, %r14
leaq (%rbx,%r14,8), %rbx
movl $0x0, -0x2c(%rbp)
leaq 0x2b056(%rip), %r13     # 0x45a00
movq (%rbx), %r12
movq %r12, %rdi
callq 0x1ae1b
testl %eax, %eax
je 0x1ac01
leaq 0x8(%r12), %rax
cmpb $0x1, 0x10(%r12)
cmovneq %r13, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
jne 0x1a9e2
movq (%rax), %rsi
movq 0x8(%rax), %rax
cmpb $0x1, 0x10(%rax)
jmp 0x1a9f0
movq 0x2b017(%rip), %rax     # 0x45a00
cmpb $0x1, 0x10(%rax)
movq %rax, %rsi
movq %r13, %rcx
movl $0xfffe795f, %r12d      # imm = 0xFFFE795F
jne 0x1a9fe
movq %rax, %rcx
movq (%rcx), %rcx
movzbl 0x10(%rcx), %eax
cmpl $0x5, %eax
movq %rcx, -0x50(%rbp)
je 0x1aae6
cmpl $0x4, %eax
jne 0x1aaf4
cmpb $0x1, 0x12(%rcx)
jne 0x1aaf4
movq -0x38(%rbp), %rdi
movq %rsi, %r13
callq 0x19b7a
movl 0x24880(%rip), %r15d    # 0x3f2b8
leal (%r15,%r12), %eax
cmpl %r12d, %eax
jbe 0x1acc9
decl %r15d
movl %r15d, 0x24869(%rip)    # 0x3f2b8
leaq 0x2db6a(%rip), %rax     # 0x485c0
movq (%rax,%r15,8), %rdi
callq 0xb477
testl %eax, %eax
je 0x1abfa
movq -0x38(%rbp), %rdi
callq 0x8ba5
movq %r13, %r15
movq %r13, %rdi
callq 0x8ba5
movq 0xfb96e(%rip), %rdi     # 0x1163f0
callq 0x8ba5
callq 0xa573
movl $0x2, %edi
callq 0xacef
movl 0x2481c(%rip), %eax     # 0x3f2b8
leal (%rax,%r12), %ecx
cmpl %r12d, %ecx
movl $0xfffe795f, %r13d      # imm = 0xFFFE795F
jbe 0x1acc9
decl %eax
movl %eax, 0x24801(%rip)     # 0x3f2b8
leaq 0x2db02(%rip), %r12     # 0x485c0
movq (%r12,%rax,8), %rax
movq %rax, -0x38(%rbp)
movq 0x2d7e3(%rip), %rdi     # 0x482b0
callq 0x8ba5
movq %r15, %rdi
callq 0x8ba5
movq 0xf0ff7(%rip), %rdi     # 0x10bad8
jmp 0x1abb0
xorpd %xmm0, %xmm0
ucomisd (%rcx), %xmm0
ja 0x1aa25
movq -0x40(%rbp), %rdi
movq %rsi, %r13
callq 0x19b7a
movl 0x247b1(%rip), %r15d    # 0x3f2b8
leal (%r15,%r12), %eax
cmpl %r12d, %eax
jbe 0x1acc9
decl %r15d
movl %r15d, 0x2479a(%rip)    # 0x3f2b8
leaq 0x2da9b(%rip), %rax     # 0x485c0
movq (%rax,%r15,8), %rdi
callq 0xb477
testl %eax, %eax
je 0x1abfa
movq -0x40(%rbp), %rdi
callq 0x8ba5
movq %r13, %r15
movq %r13, %rdi
callq 0x8ba5
movq 0xfb89f(%rip), %rdi     # 0x1163f0
callq 0x8ba5
callq 0xa573
movl $0x2, %edi
callq 0xacef
movl 0x2474d(%rip), %eax     # 0x3f2b8
leal (%rax,%r12), %ecx
cmpl %r12d, %ecx
movl $0xfffe795f, %r13d      # imm = 0xFFFE795F
jbe 0x1acc9
decl %eax
movl %eax, 0x24732(%rip)     # 0x3f2b8
leaq 0x2da33(%rip), %r12     # 0x485c0
movq (%r12,%rax,8), %rax
movq %rax, -0x40(%rbp)
movq 0x2d714(%rip), %rdi     # 0x482b0
callq 0x8ba5
movq %r15, %rdi
callq 0x8ba5
movq 0xfb840(%rip), %rdi     # 0x1163f0
callq 0x8ba5
movq -0x50(%rbp), %rdi
callq 0x8ba5
movl $0x2, %edi
callq 0xadb3
movl $0x3, %edi
callq 0x8b7d
movl 0x246df(%rip), %r15d    # 0x3f2b8
leal (%r15,%r13), %eax
cmpl %r13d, %eax
jbe 0x1acc9
decl %r15d
movl %r15d, 0x246c8(%rip)    # 0x3f2b8
movq (%r12,%r15,8), %rax
movq %rax, (%rbx)
incl -0x2c(%rbp)
leaq 0x2adff(%rip), %r13     # 0x45a00
incq %r14
movslq %r15d, %rax
addq $0x8, %rbx
cmpq %rax, %r14
jl 0x1a9aa
cmpl $0x0, -0x2c(%rbp)
je 0x1aca0
movq -0x38(%rbp), %rdi
callq 0x8ba5
movq -0x40(%rbp), %rdi
callq 0x8ba5
movq 0xfb7b9(%rip), %rdi     # 0x1163f0
callq 0x8ba5
callq 0xa573
movl $0x2, %edi
callq 0xacef
movq -0x48(%rbp), %rcx
movzbl 0x10(%rcx), %eax
cmpl $0x5, %eax
je 0x1acb6
cmpl $0x4, %eax
leaq 0x2d95e(%rip), %rbx     # 0x485c0
jne 0x1ac80
cmpb $0x1, 0x12(%rcx)
jne 0x1ac80
movq 0xfb77f(%rip), %rdi     # 0x1163f0
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movl 0x24632(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %ecx       # imm = 0xFFFE795F
leal (%rax,%rcx), %edx
cmpl %ecx, %edx
jbe 0x1acc9
decl %eax
movl %eax, 0x2461e(%rip)     # 0x3f2b8
movq (%rbx,%rax,8), %r14
jmp 0x1aca4
movq -0x48(%rbp), %r14
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorpd %xmm0, %xmm0
ucomisd (%rcx), %xmm0
leaq 0x2d8fb(%rip), %rbx     # 0x485c0
ja 0x1ac6a
jmp 0x1ac80
leaq 0x14271(%rip), %rdi     # 0x2ef41
callq 0x780b