// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0xaece
movl %eax, %r15d
testl %eax, %eax
je 0xd602
movq %rbx, %rdi
callq 0xaece
testl %eax, %eax
je 0xd602
movq 0x30b43(%rip), %rdi     # 0x3e140
jmp 0xd6b9
movzbl 0x10(%r14), %r12d
cmpl $0x5, %r12d
je 0xd618
movzbl 0x10(%rbx), %r13d
cmpl $0x5, %r13d
jne 0xd689
movq %r14, %rdi
callq 0x8b01
callq 0x9086
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
callq 0x8b01
callq 0x9086
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xd666
jp 0xd666
callq 0x74ec
xorpd %xmm0, %xmm0
ucomisd -0x30(%rbp), %xmm0
movb $0x5, 0x10(%rax)
jbe 0xd6af
movabsq $-0x3ff6de04abbbd2e8, %rcx # imm = 0xC00921FB54442D18
movq %rcx, (%rax)
jmp 0xd6b6
movsd -0x30(%rbp), %xmm1
callq 0x72a0
movsd %xmm0, -0x30(%rbp)
callq 0x74ec
movb $0x5, 0x10(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0xd6b6
movq %rbx, %rdi
callq 0xaece
testl %eax, %eax
je 0xd6cc
cmpl $0x5, %r12d
je 0xd6f1
cmpl $0x4, %r12d
jne 0xd5f6
cmpb $0x1, 0x12(%r14)
sete %al
jmp 0xd6fd
movq $0x0, (%rax)
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8b01
testl %r15d, %r15d
je 0xd71d
cmpl $0x5, %r13d
je 0xd783
cmpl $0x4, %r13d
jne 0xd797
cmpb $0x1, 0x12(%rbx)
sete %al
jmp 0xd78e
xorpd %xmm0, %xmm0
ucomisd (%r14), %xmm0
seta %al
testb %al, %al
je 0xd5f6
movq 0x33944(%rip), %rdi     # 0x41050
callq 0x8b01
movq 0x103cd8(%rip), %rdi    # 0x1113f0
jmp 0xd7ad
movq %rbx, %rdi
callq 0x8b01
movq %r14, %rdi
callq 0x8b01
movq 0x103cbc(%rip), %rdi    # 0x1113f0
callq 0x8b01
callq 0xa234
movl $0x2, %edi
callq 0xa8bb
callq 0x9be7
callq 0x8b78
movq %rax, %r15
movq %rax, %rdi
callq 0x8b01
callq 0xdee7
callq 0xad38
callq 0x8b78
movzbl 0x10(%rbx), %eax
cmpl $0x5, %eax
je 0xd7ca
cmpl $0x4, %eax
jne 0xd7ef
cmpb $0x1, 0x12(%rbx)
sete %al
jmp 0xd7d5
xorpd %xmm0, %xmm0
ucomisd (%rbx), %xmm0
seta %al
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
testb %al, %al
jne 0xd79c
movl $0x1, %edi
movl $0x2, %esi
callq 0xa1f4
movq 0x338a3(%rip), %rdi     # 0x41050
callq 0x8b01
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa8bb
xorpd %xmm0, %xmm0
ucomisd (%rbx), %xmm0
seta %al
testb %al, %al
je 0xd7ef
movq 0x103c10(%rip), %rdi    # 0x1113f0
callq 0x8b01
movl $0x2, %edi
callq 0xa8bb
callq 0x8b78
movq %rax, %rbx
movq %r15, %rdi
callq 0x8b01
callq 0xdee7
callq 0x8b78
movzbl 0x10(%r14), %eax
cmpl $0x5, %eax
je 0xd822
cmpl $0x4, %eax
jne 0xd848
cmpb $0x1, 0x12(%r14)
sete %al
jmp 0xd82e
xorpd %xmm0, %xmm0
ucomisd (%r14), %xmm0
seta %al
testb %al, %al
je 0xd848
movq 0x103bb7(%rip), %rdi    # 0x1113f0
callq 0x8b01
movl $0x2, %edi
callq 0xa8bb
callq 0x8b78
movq %rax, %r14
movq (%rax), %rdi
movq (%rbx), %rsi
callq 0x866a
testl %eax, %eax
jne 0xd874
movq 0x8(%r14), %rdi
movq 0x8(%rbx), %rsi
callq 0x866a
testl %eax, %eax
je 0xd90f
movzbl 0x10(%rbx), %eax
cmpl $0x5, %eax
je 0xd88b
cmpl $0x4, %eax
jne 0xd8db
cmpb $0x1, 0x12(%rbx)
sete %al
jmp 0xd896
xorpd %xmm0, %xmm0
ucomisd (%rbx), %xmm0
seta %al
testb %al, %al
je 0xd8db
movq 0x308f7(%rip), %rdi     # 0x3e198
callq 0x8b01
movq %rbx, %rdi
callq 0x8b01
movq 0x103b3b(%rip), %rdi    # 0x1113f0
callq 0x8b01
movl $0x2, %edi
callq 0xa8bb
movq %r14, %rdi
callq 0x8b01
movl $0x3, %edi
callq 0x8ad9
jmp 0xd711
movq 0x308b6(%rip), %rdi     # 0x3e198
callq 0x8b01
movq %rbx, %rdi
callq 0x8b01
movq %r14, %rdi
callq 0x8b01
movl $0x3, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8ad9
movzbl 0x10(%r14), %eax
cmpl $0x5, %eax
je 0xd928
cmpl $0x4, %eax
jne 0xd94f
cmpb $0x1, 0x12(%r14)
sete %al
jmp 0xd934
xorpd %xmm0, %xmm0
ucomisd (%r14), %xmm0
seta %al
testb %al, %al
je 0xd94f
movzbl 0x10(%rbx), %eax
cmpl $0x5, %eax
je 0xd981
cmpl $0x4, %eax
jne 0xd995
cmpb $0x1, 0x12(%rbx)
sete %al
jmp 0xd98c
movzbl 0x10(%rbx), %eax
cmpl $0x5, %eax
je 0xd966
cmpl $0x4, %eax
jne 0xd97a
cmpb $0x1, 0x12(%rbx)
sete %al
jmp 0xd971
xorpd %xmm0, %xmm0
ucomisd (%rbx), %xmm0
seta %al
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
testb %al, %al
jne 0xd99a
movl $0x1, %edi
jmp 0xd99a
xorpd %xmm0, %xmm0
ucomisd (%rbx), %xmm0
seta %al
movl $0xfffffffd, %edi       # imm = 0xFFFFFFFD
testb %al, %al
jne 0xd99a
movl $0x3, %edi
movl $0x4, %esi
jmp 0xd7a1