// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]eigenmath/eigenmath.c
// Function: arctanh
void
arctanh(void)
{
	int i, n;
	double d;
	struct atom *p1;

	p1 = pop();

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

	if (isplusone(p1) || isminusone(p1)) {
		push_symbol(ARCTANH);
		push(p1);
		list(2);
		return;
	}

	if (isdouble(p1)) {
		push(p1);
		d = pop_double();
		if (-1.0 < d && d < 1.0) {
			d = atanh(d);
			push_double(d);
			return;
		}
	}

	// arctanh(z) = 1/2 log(1 + z) - 1/2 log(1 - z)

	if (isdouble(p1) || isdoublez(p1)) {
		push_double(1.0);
		push(p1);
		add();
		logfunc();
		push_double(1.0);
		push(p1);
		subtract();
		logfunc();
		subtract();
		push_double(0.5);
		multiply();
		return;
	}

	if (iszero(p1)) {
		push_integer(0);
		return;
	}

	// arctanh(-x) = -arctanh(x)

	if (isnegativeterm(p1)) {
		push(p1);
		negate();
		arctanh();
		negate();
		return;
	}

	if (car(p1) == symbol(TANH)) {
		push(cadr(p1));
		return;
	}

	push_symbol(ARCTANH);
	push(p1);
	list(2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
callq 0x91d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x7, %eax
jne 0x11912
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 0x11904
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movq 0x68(%rax,%rcx,8), %rdi
callq 0x9110
callq 0x11880
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 0x118bf
movq -0x18(%rbp), %rdi
callq 0x9110
jmp 0x11b3d
movq -0x18(%rbp), %rdi
callq 0xd4c0
cmpl $0x0, %eax
jne 0x1192e
movq -0x18(%rbp), %rdi
callq 0x10770
cmpl $0x0, %eax
je 0x11952
movq 0x4a86b(%rip), %rdi     # 0x5c1a0
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
movl $0x2, %edi
callq 0x90d0
jmp 0x11b3d
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0x119b4
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0x9af0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x33729(%rip), %xmm1    # 0x450a8
ucomisd %xmm1, %xmm0
jbe 0x119b2
movsd 0x33723(%rip), %xmm0    # 0x450b0
ucomisd -0x10(%rbp), %xmm0
jbe 0x119b2
movsd -0x10(%rbp), %xmm0
callq 0x7060
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0xe5e0
jmp 0x11b3d
jmp 0x119b4
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
je 0x119cf
movq -0x18(%rbp), %rdi
callq 0xf370
cmpl $0x0, %eax
je 0x11a2b
movsd 0x336d9(%rip), %xmm0    # 0x450b0
callq 0xe5e0
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0xc660
callq 0xfa40
movsd 0x336b9(%rip), %xmm0    # 0x450b0
callq 0xe5e0
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0xe7e0
callq 0xfa40
callq 0xe7e0
movsd 0x336ac(%rip), %xmm0    # 0x450c8
callq 0xe5e0
callq 0xc280
jmp 0x11b3d
movq -0x18(%rbp), %rdi
callq 0xcdc0
cmpl $0x0, %eax
je 0x11a45
xorl %edi, %edi
callq 0xca50
jmp 0x11b3d
movq -0x18(%rbp), %rdi
callq 0xc2b0
cmpl $0x0, %eax
je 0x11a70
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0xb4b0
callq 0x11880
callq 0xb4b0
jmp 0x11b3d
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x11a8a
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x11a95
movq 0x4cf6f(%rip), %rax     # 0x5ea00
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq 0x4e238(%rip), %rax     # 0x5fcd8
jne 0x11b1e
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x11abd
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x11ac8
movq 0x4cf3c(%rip), %rax     # 0x5ea00
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x11b08
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x11af0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x11afb
movq 0x4cf09(%rip), %rax     # 0x5ea00
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x11b13
movq 0x4cef1(%rip), %rax     # 0x5ea00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x9110
jmp 0x11b3d
movq 0x4a67b(%rip), %rdi     # 0x5c1a0
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
movl $0x2, %edi
callq 0x90d0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)