// File: /workspace/github_c_makefile_star2_O2/georgeweigt[P]eigenmath/eigenmath.c
// Function: arctan
void
arctan(void)
{
	int i, n;
	struct atom *X, *Y, *Z;

	X = pop();
	Y = pop();

	if (istensor(Y)) {
		Y = copy_tensor(Y);
		n = Y->u.tensor->nelem;
		for (i = 0; i < n; i++) {
			push(Y->u.tensor->elem[i]);
			push(X);
			arctan();
			Y->u.tensor->elem[i] = pop();
		}
		push(Y);
		return;
	}

	if (isnum(X) && isnum(Y)) {
		arctan_numbers(X, Y);
		return;
	}

	// arctan(z) = -1/2 i log((i - z) / (i + z))

	if (!iszero(X) && (isdoublez(X) || isdoublez(Y))) {
		push(Y);
		push(X);
		divide();
		Z = pop();
		push_double(-0.5);
		push(imaginaryunit);
		multiply();
		push(imaginaryunit);
		push(Z);
		subtract();
		push(imaginaryunit);
		push(Z);
		add();
		divide();
		logfunc();
		multiply();
		return;
	}

	// arctan(-y,x) = -arctan(y,x)

	if (isnegativeterm(Y)) {
		push(Y);
		negate();
		push(X);
		arctan();
		negate();
		return;
	}

	if (car(Y) == symbol(TAN) && isplusone(X)) {
		push(cadr(Y)); // x of tan(x)
		return;
	}

	push_symbol(ARCTAN);
	push(Y);
	push(X);
	list(3);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
callq 0x868d
movq %rax, %rbx
callq 0x868d
movq %rax, %r14
movb 0x10(%rax), %r15b
cmpb $0x7, %r15b
jne 0xc65c
movq %r14, %rdi
callq 0x8f1b
movq %rax, %r14
movq (%rax), %rax
movl 0x64(%rax), %r15d
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
cmpq %r12, %r15
je 0xc681
movq (%r14), %rax
movq 0x68(%rax,%r12,8), %rdi
callq 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0xc5ea
callq 0x868d
movq (%r14), %rcx
movq %rax, 0x68(%rcx,%r12,8)
incq %r12
jmp 0xc62b
movl %r15d, %eax
andb $-0x2, %al
cmpb $0x4, %al
jne 0xc691
movb 0x10(%rbx), %al
andb $-0x2, %al
cmpb $0x4, %al
jne 0xc691
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xc7e6
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x861b
movq %rbx, %rdi
callq 0xa641
testl %eax, %eax
je 0xc6d4
movq %r14, %rdi
callq 0x9fd6
testl %eax, %eax
je 0xc770
movq %r14, %rdi
callq 0x861b
callq 0x975f
movq %rbx, %rdi
callq 0x861b
callq 0xc5ea
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x975f
movq %rbx, %rdi
callq 0xb876
testl %eax, %eax
jne 0xc6ec
movq %r14, %rdi
callq 0xb876
testl %eax, %eax
je 0xc69d
movq %r14, %rdi
callq 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0xca0b
callq 0x868d
movq %rax, %rbx
movsd 0x16a3f(%rip), %xmm0    # 0x23150
callq 0xaf59
movq 0xf83b3(%rip), %rdi     # 0x104ad0
callq 0x861b
callq 0x9fae
movq 0xf83a2(%rip), %rdi     # 0x104ad0
callq 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0xb07f
movq 0xf8389(%rip), %rdi     # 0x104ad0
callq 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0xa1f6
callq 0xca0b
callq 0xba1b
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9fae
cmpb $0x1, %r15b
leaq 0x32275(%rip), %r12     # 0x3e9f0
movq %r12, %rax
cmoveq %r14, %rax
movq (%rax), %rax
cmpq 0x33534(%rip), %rax     # 0x3fcc0
je 0xc7ba
movq 0x2f9f3(%rip), %rdi     # 0x3c188
callq 0x861b
movq %r14, %rdi
callq 0x861b
movq %rbx, %rdi
callq 0x861b
pushq $0x3
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x85eb
movq %rbx, %rdi
callq 0xa95a
testl %eax, %eax
je 0xc78e
addq $0x8, %r14
cmpb $0x1, %r15b
cmovneq %r12, %r14
movq (%r14), %rax
cmpb $0x1, 0x10(%rax)
cmoveq %rax, %r12
movq (%r12), %rdi
jmp 0xc684