// File: /workspace/github_c_makefile_star2_O2/georgeweigt[P]eigenmath/eigenmath.c
// Function: arctan_numbers
void
arctan_numbers(struct atom *X, struct atom *Y)
{
	double x, y;
	struct atom *T;

	if (iszero(X) && iszero(Y)) {
		push_integer(0);
		return;
	}

	if (isdouble(X) || isdouble(Y)) {
		push(X);
		x = pop_double();
		push(Y);
		y = pop_double();
		if (y == 0.0) {
			if (x < 0.0)
				push_double(-M_PI);
			else
				push_double(0.0);
		} else
			push_double(atan2(y, x));
		return;
	}

	// X and Y are rational numbers

	if (iszero(Y)) {
		if (isnegativenumber(X)) {
			push_symbol(PI);
			negate();
		} else
			push_integer(0);
		return;
	}

	if (iszero(X)) {
		if (isnegativenumber(Y))
			push_rational(-1, 2);
		else
			push_rational(1, 2);
		push_symbol(PI);
		multiply();
		return;
	}

	// convert fractions to integers

	push(Y);
	push(X);
	divide();
	absfunc();
	T = pop();

	push(T);
	numerator();
	if (isnegativenumber(Y))
		negate();
	Y = pop();

	push(T);
	denominator();
	if (isnegativenumber(X))
		negate();
	X = pop();

	// compare numerators and denominators, ignore signs

	if (mcmp(X->u.q.a, Y->u.q.a) != 0 || mcmp(X->u.q.b, Y->u.q.b) != 0) {
		// not equal
		if (isnegativenumber(Y)) {
			push_symbol(ARCTAN);
			push(Y);
			negate();
			push(X);
			list(3);
			negate();
		} else {
			push_symbol(ARCTAN);
			push(Y);
			push(X);
			list(3);
		}
		return;
	}

	// X = Y modulo sign

	if (isnegativenumber(X)) {
		if (isnegativenumber(Y))
			push_rational(-3, 4);
		else
			push_rational(3, 4);
	} else {
		if (isnegativenumber(Y))
			push_rational(-1, 4);
		else
			push_rational(1, 4);
	}

	push_symbol(PI);
	multiply();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0xa641
movl %eax, %r15d
testl %eax, %eax
je 0xc81f
movq %r14, %rdi
callq 0xa641
testl %eax, %eax
je 0xc81f
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa426
cmpb $0x5, 0x10(%rbx)
je 0xc82c
cmpb $0x5, 0x10(%r14)
jne 0xc874
movq %rbx, %rdi
callq 0x861b
callq 0x8ae1
movsd %xmm0, -0x20(%rbp)
movq %r14, %rdi
callq 0x861b
callq 0x8ae1
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xc868
jp 0xc868
ucomisd -0x20(%rbp), %xmm1
jbe 0xc8a7
movsd 0x168f2(%rip), %xmm0    # 0x23158
jmp 0xc8ab
movsd -0x20(%rbp), %xmm1
callq 0x7290
jmp 0xc8ab
movq %r14, %rdi
callq 0xa641
testl %eax, %eax
je 0xc8ba
movq %rbx, %rdi
callq 0x8c2a
testl %eax, %eax
je 0xc80e
movq 0x327ad(%rip), %rdi     # 0x3f040
callq 0x861b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x975f
xorpd %xmm0, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xaf59
testl %r15d, %r15d
je 0xc8f3
movq %r14, %rdi
callq 0x8c2a
xorl %edi, %edi
negl %eax
sbbl %edi, %edi
orl $0x1, %edi
pushq $0x2
popq %rsi
callq 0x9a47
movq 0x32761(%rip), %rdi     # 0x3f040
callq 0x861b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9fae
movq %r14, %rdi
callq 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0xca0b
callq 0x94f7
callq 0x868d
movq %rax, %r15
movq %rax, %rdi
callq 0x861b
callq 0xca1a
movq %r14, %rdi
callq 0x8c2a
testl %eax, %eax
je 0xc933
callq 0x975f
callq 0x868d
movq %rax, %r14
movq %r15, %rdi
callq 0x861b
callq 0xca2e
movq %rbx, %rdi
callq 0x8c2a
testl %eax, %eax
je 0xc959
callq 0x975f
callq 0x868d
movq %rax, %rbx
movq (%rax), %rdi
movq (%r14), %rsi
callq 0x82a7
testl %eax, %eax
jne 0xc981
movq 0x8(%rbx), %rdi
movq 0x8(%r14), %rsi
callq 0x82a7
testl %eax, %eax
je 0xc9d9
movq %r14, %rdi
callq 0x8c2a
movl %eax, %r15d
movq 0x2f7f5(%rip), %rdi     # 0x3c188
callq 0x861b
movq %r14, %rdi
callq 0x861b
testl %r15d, %r15d
je 0xc9bf
callq 0x975f
movq %rbx, %rdi
callq 0x861b
pushq $0x3
popq %rdi
callq 0x85eb
jmp 0xc898
movq %rbx, %rdi
callq 0x861b
pushq $0x3
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x85eb
movq %rbx, %rdi
callq 0x8c2a
movl %eax, %ebx
movq %r14, %rdi
callq 0x8c2a
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
pushq $0x3
popq %rax
pushq $-0x3
popq %rdx
cmovel %eax, %edx
testl %ebx, %ebx
leal -0x1(%rcx,%rcx), %edi
cmovnel %edx, %edi
pushq $0x4
jmp 0xc8d2