// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x317eb(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %ecx       # imm = 0xFFFE795F
leal (%rax,%rcx), %edx
cmpl %ecx, %edx
jbe 0xddcf
leal -0x1(%rax), %ecx
movl %ecx, 0x317d2(%rip)     # 0x3f2b8
cmpl $0x1, %eax
jbe 0xddcf
leaq 0x3aaca(%rip), %rdx     # 0x485c0
movq (%rdx,%rcx,8), %rbx
addl $-0x2, %eax
movl %eax, 0x317b5(%rip)     # 0x3f2b8
movq (%rdx,%rax,8), %r14
movb 0x10(%r14), %r12b
cmpb $0x7, %r12b
jne 0xdb9b
movq %r14, %rdi
callq 0x9638
movq %rax, %r14
movq (%rax), %rax
movslq 0x64(%rax), %r12
testq %r12, %r12
jle 0xdb85
xorl %r13d, %r13d
movl $0xfffe795f, %r15d      # imm = 0xFFFE795F
movq (%r14), %rax
movq 0x68(%rax,%r13,8), %rdi
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
callq 0xdab9
movl 0x31763(%rip), %eax     # 0x3f2b8
leal (%rax,%r15), %ecx
cmpl %r15d, %ecx
jbe 0xddcf
decl %eax
movl %eax, 0x3174e(%rip)     # 0x3f2b8
leaq 0x3aa4f(%rip), %rcx     # 0x485c0
movq (%rcx,%rax,8), %rax
movq (%r14), %rcx
movq %rax, 0x68(%rcx,%r13,8)
incq %r13
cmpq %r13, %r12
jne 0xdb35
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8ba5
movl %r12d, %eax
andb $-0x2, %al
cmpb $0x4, %al
jne 0xdbc6
movb 0x10(%rbx), %al
andb $-0x2, %al
cmpb $0x4, %al
jne 0xdbc6
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdddb
movq %rbx, %rdi
callq 0xb477
testl %eax, %eax
je 0xdc1e
movq %r14, %rdi
callq 0xac49
testl %eax, %eax
je 0xdd48
movq %r14, %rdi
callq 0x8ba5
movq 0x1087ff(%rip), %rdi    # 0x1163f0
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movq %rbx, %rdi
callq 0x8ba5
callq 0xdab9
movq 0x1087dc(%rip), %rdi    # 0x1163f0
callq 0x8ba5
jmp 0xdd30
movq %rbx, %rdi
callq 0xca1c
testl %eax, %eax
jne 0xdc36
movq %r14, %rdi
callq 0xca1c
testl %eax, %eax
je 0xdbd2
movq %r14, %rdi
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movq 0x1087a3(%rip), %rdi    # 0x1163f0
callq 0x8ba5
callq 0xa573
movl $0x2, %edi
callq 0xacef
movl 0x31651(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %ecx       # imm = 0xFFFE795F
leal (%rax,%rcx), %edx
cmpl %ecx, %edx
jbe 0xddcf
decl %eax
movl %eax, 0x31639(%rip)     # 0x3f2b8
leaq 0x3a93a(%rip), %rcx     # 0x485c0
movq (%rcx,%rax,8), %rbx
callq 0x74dc
movb $0x5, 0x10(%rax)
movabsq $-0x4020000000000000, %rcx # imm = 0xBFE0000000000000
movq %rcx, (%rax)
movq %rax, %rdi
callq 0x8ba5
movq 0xfde31(%rip), %rdi     # 0x10bae0
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movq 0xfde1b(%rip), %rdi     # 0x10bae0
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movq 0x108717(%rip), %rdi    # 0x1163f0
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movl $0x2, %edi
callq 0xadb3
movq 0xfdde7(%rip), %rdi     # 0x10bae0
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movl $0x2, %edi
callq 0xadb3
movq 0x1086d9(%rip), %rdi    # 0x1163f0
callq 0x8ba5
callq 0xa573
movl $0x2, %edi
callq 0xacef
callq 0xcbe3
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xacef
cmpb $0x1, %r12b
leaq 0x37cad(%rip), %r15     # 0x45a00
movq %r15, %rax
cmoveq %r14, %rax
movq (%rax), %rax
cmpq 0x38f6c(%rip), %rax     # 0x46cd0
je 0xdd9a
movq 0x3542b(%rip), %rdi     # 0x43198
callq 0x8ba5
movq %r14, %rdi
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movl $0x3, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8b7d
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0xd1c4
testl %eax, %eax
je 0xdd66
addq $0x8, %r14
cmpb $0x1, %r12b
cmovneq %r15, %r14
movq (%r14), %rax
cmpb $0x1, 0x10(%rax)
cmoveq %rax, %r15
movq (%r15), %rdi
jmp 0xdb88
leaq 0x2116b(%rip), %rdi     # 0x2ef41
callq 0x780b