// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]eigenmath/eigenmath.c
// Function: arccos
void
arccos(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]);
			arccos();
			p1->u.tensor->elem[i] = pop();
		}
		push(p1);
		return;
	}

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

	// arccos(z) = -i log(z + i sqrt(1 - z^2))

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

	// arccos(1 / sqrt(2)) = 1/4 pi

	if (isoneoversqrttwo(p1)) {
		push_rational(1, 4);
		push_symbol(PI);
		multiply();
		return;
	}

	// arccos(-1 / sqrt(2)) = 3/4 pi

	if (isminusoneoversqrttwo(p1)) {
		push_rational(3, 4);
		push_symbol(PI);
		multiply();
		return;
	}

	// arccos(0) = 1/2 pi

	if (iszero(p1)) {
		push_rational(1, 2);
		push_symbol(PI);
		multiply();
		return;
	}

	// arccos(1/2) = 1/3 pi

	if (isequalq(p1, 1 ,2)) {
		push_rational(1, 3);
		push_symbol(PI);
		multiply();
		return;
	}

	// arccos(1) = 0

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

	// arccos(-1/2) = 2/3 pi

	if (isequalq(p1, -1, 2)) {
		push_rational(2, 3);
		push_symbol(PI);
		multiply();
		return;
	}

	// arccos(-1) = pi

	if (isminusone(p1)) {
		push_symbol(PI);
		return;
	}

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
callq 0x91d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x7, %eax
jne 0xf112
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 0xf104
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movq 0x68(%rax,%rcx,8), %rdi
callq 0x9110
callq 0xf080
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 0xf0bf
movq -0x18(%rbp), %rdi
callq 0x9110
jmp 0xf35e
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0xf174
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0x9af0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x35f69(%rip), %xmm1    # 0x450a8
ucomisd %xmm1, %xmm0
jb 0xf172
movsd 0x35f63(%rip), %xmm0    # 0x450b0
ucomisd -0x10(%rbp), %xmm0
jb 0xf172
movsd -0x10(%rbp), %xmm0
callq 0x7180
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0xe5e0
jmp 0xf35e
jmp 0xf174
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
je 0xf18f
movq -0x18(%rbp), %rdi
callq 0xf370
cmpl $0x0, %eax
je 0xf1fc
movsd 0x35f19(%rip), %xmm0    # 0x450b0
callq 0xe5e0
movq -0x18(%rbp), %rdi
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0xc280
callq 0xe7e0
callq 0xfa20
movq 0x11591c(%rip), %rdi    # 0x124ae0
callq 0x9110
callq 0xc280
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0xc660
callq 0xfa40
movq 0x1158f8(%rip), %rdi    # 0x124ae0
callq 0x9110
callq 0xc280
callq 0xb4b0
jmp 0xf35e
movq -0x18(%rbp), %rdi
callq 0x10240
cmpl $0x0, %eax
je 0xf22f
movl $0x1, %edi
movl $0x4, %esi
callq 0xb840
movq 0x4fe30(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xc280
jmp 0xf35e
movq -0x18(%rbp), %rdi
callq 0x10450
cmpl $0x0, %eax
je 0xf262
movl $0x3, %edi
movl $0x4, %esi
callq 0xb840
movq 0x4fdfd(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xc280
jmp 0xf35e
movq -0x18(%rbp), %rdi
callq 0xcdc0
cmpl $0x0, %eax
je 0xf295
movl $0x1, %edi
movl $0x2, %esi
callq 0xb840
movq 0x4fdca(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xc280
jmp 0xf35e
movq -0x18(%rbp), %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0x10670
cmpl $0x0, %eax
je 0xf2d2
movl $0x1, %edi
movl $0x3, %esi
callq 0xb840
movq 0x4fd8d(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xc280
jmp 0xf35e
movq -0x18(%rbp), %rdi
callq 0xd4c0
cmpl $0x0, %eax
je 0xf2e9
xorl %edi, %edi
callq 0xca50
jmp 0xf35e
movq -0x18(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x2, %edx
callq 0x10670
cmpl $0x0, %eax
je 0xf323
movl $0x2, %edi
movl $0x3, %esi
callq 0xb840
movq 0x4fd39(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0xc280
jmp 0xf35e
movq -0x18(%rbp), %rdi
callq 0x10770
cmpl $0x0, %eax
je 0xf33f
movq 0x4fd18(%rip), %rdi     # 0x5f050
callq 0x9110
jmp 0xf35e
movq 0x4ce32(%rip), %rdi     # 0x5c178
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
movl $0x2, %edi
callq 0x90d0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)