// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
callq 0x91d0
movq %rax, -0x10(%rbp)
callq 0x91d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x7, %eax
jne 0x11284
movq -0x18(%rbp), %rdi
callq 0xa550
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x64(%rax), %eax
movl %eax, -0x8(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x11276
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movq 0x68(%rax,%rcx,8), %rdi
callq 0x9110
movq -0x10(%rbp), %rdi
callq 0x9110
callq 0x111e0
callq 0x91d0
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movq %rdx, 0x68(%rax,%rcx,8)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x11228
movq -0x18(%rbp), %rdi
callq 0x9110
jmp 0x1149e
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x4, %eax
je 0x1129e
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0x112ca
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x4, %eax
je 0x112b8
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0x112ca
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x114b0
jmp 0x1149e
movq -0x10(%rbp), %rdi
callq 0xcdc0
cmpl $0x0, %eax
jne 0x11382
movq -0x10(%rbp), %rdi
callq 0xf370
cmpl $0x0, %eax
jne 0x112fc
movq -0x18(%rbp), %rdi
callq 0xf370
cmpl $0x0, %eax
je 0x11382
movq -0x18(%rbp), %rdi
callq 0x9110
movq -0x10(%rbp), %rdi
callq 0x9110
callq 0x117a0
callq 0x91d0
movq %rax, -0x20(%rbp)
movsd 0x33d94(%rip), %xmm0    # 0x450b8
callq 0xe5e0
movq 0x1137b0(%rip), %rdi    # 0x124ae0
callq 0x9110
callq 0xc280
movq 0x11379f(%rip), %rdi    # 0x124ae0
callq 0x9110
movq -0x20(%rbp), %rdi
callq 0x9110
callq 0xe7e0
movq 0x113785(%rip), %rdi    # 0x124ae0
callq 0x9110
movq -0x20(%rbp), %rdi
callq 0x9110
callq 0xc660
callq 0x117a0
callq 0xfa40
callq 0xc280
jmp 0x1149e
movq -0x18(%rbp), %rdi
callq 0xc2b0
cmpl $0x0, %eax
je 0x113b6
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0xb4b0
movq -0x10(%rbp), %rdi
callq 0x9110
callq 0x111e0
callq 0xb4b0
jmp 0x1149e
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x113d0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x113db
movq 0x4d629(%rip), %rax     # 0x5ea00
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq 0x4e8ea(%rip), %rax     # 0x5fcd0
jne 0x11476
movq -0x10(%rbp), %rdi
callq 0xd4c0
cmpl $0x0, %eax
je 0x11476
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x11415
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x11420
movq 0x4d5e4(%rip), %rax     # 0x5ea00
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x11460
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x11448
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x11453
movq 0x4d5b1(%rip), %rax     # 0x5ea00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x1146b
movq 0x4d599(%rip), %rax     # 0x5ea00
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9110
jmp 0x1149e
movq 0x4ad1b(%rip), %rdi     # 0x5c198
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
movq -0x10(%rbp), %rdi
callq 0x9110
movl $0x3, %edi
callq 0x90d0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)