// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xcdc0
cmpl $0x0, %eax
je 0x114e8
movq -0x10(%rbp), %rdi
callq 0xcdc0
cmpl $0x0, %eax
je 0x114e8
xorl %edi, %edi
callq 0xca50
jmp 0x11797
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
je 0x11502
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0x11574
movq -0x8(%rbp), %rdi
callq 0x9110
callq 0x9af0
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9110
callq 0x9af0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1155b
jp 0x1155b
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x11551
movsd 0x33b76(%rip), %xmm0    # 0x450c0
callq 0xe5e0
jmp 0x11559
xorps %xmm0, %xmm0
callq 0xe5e0
jmp 0x1156f
movsd -0x20(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
callq 0x7290
callq 0xe5e0
jmp 0x11797
movq -0x10(%rbp), %rdi
callq 0xcdc0
cmpl $0x0, %eax
je 0x115af
movq -0x8(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x115a3
movq 0x4dab9(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xb4b0
jmp 0x115aa
xorl %edi, %edi
callq 0xca50
jmp 0x11797
movq -0x8(%rbp), %rdi
callq 0xcdc0
cmpl $0x0, %eax
je 0x11601
movq -0x10(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x115dc
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x2, %esi
callq 0xb840
jmp 0x115eb
movl $0x1, %edi
movl $0x2, %esi
callq 0xb840
movq 0x4da5e(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xc280
jmp 0x11797
movq -0x10(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
callq 0x9110
callq 0x117a0
callq 0xafe0
callq 0x91d0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x9110
callq 0x117b0
movq -0x10(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x11647
callq 0xb4b0
callq 0x91d0
movq %rax, -0x10(%rbp)
movq -0x28(%rbp), %rdi
callq 0x9110
callq 0x117d0
movq -0x8(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x11671
callq 0xb4b0
callq 0x91d0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x8b80
cmpl $0x0, %eax
jne 0x116ac
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x8b80
cmpl $0x0, %eax
je 0x11718
movq -0x10(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x116ee
movq 0x4aad7(%rip), %rdi     # 0x5c198
callq 0x9110
movq -0x10(%rbp), %rdi
callq 0x9110
callq 0xb4b0
movq -0x8(%rbp), %rdi
callq 0x9110
movl $0x3, %edi
callq 0x90d0
callq 0xb4b0
jmp 0x11716
movq 0x4aaa3(%rip), %rdi     # 0x5c198
callq 0x9110
movq -0x10(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
callq 0x9110
movl $0x3, %edi
callq 0x90d0
jmp 0x11797
movq -0x8(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x11756
movq -0x10(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x11745
movl $0xfffffffd, %edi       # imm = 0xFFFFFFFD
movl $0x4, %esi
callq 0xb840
jmp 0x11754
movl $0x3, %edi
movl $0x4, %esi
callq 0xb840
jmp 0x11786
movq -0x10(%rbp), %rdi
callq 0x9e30
cmpl $0x0, %eax
je 0x11775
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x4, %esi
callq 0xb840
jmp 0x11784
movl $0x1, %edi
movl $0x4, %esi
callq 0xb840
jmp 0x11786
movq 0x4d8c3(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xc280
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)