// File: /workspace/github_c_makefile_star2_O2/georgeweigt[P]eigenmath/eigenmath.c
// Function: arcsin
void
arcsin(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]);
			arcsin();
			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 = asin(d);
			push_double(d);
			return;
		}
	}

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

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

	// arcsin(-x) = -arcsin(x)

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

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

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

	// arcsin(0) = 0

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

	// arcsin(1/2) = 1/6 pi

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

	// arcsin(1) = 1/2 pi

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

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
callq 0x868d
movq %rax, %rbx
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
je 0xc223
cmpl $0x7, %eax
jne 0xc254
movq %rbx, %rdi
callq 0x8f1b
movq %rax, %rbx
movq (%rax), %rax
movl 0x64(%rax), %r14d
xorl %r15d, %r15d
testl %r14d, %r14d
cmovlel %r15d, %r14d
cmpq %r15, %r14
je 0xc211
movq (%rbx), %rax
movq 0x68(%rax,%r15,8), %rdi
callq 0x861b
callq 0xc1a8
callq 0x868d
movq (%rbx), %rcx
movq %rax, 0x68(%rcx,%r15,8)
incq %r15
jmp 0xc1e8
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0x8ae1
movapd 0x16ee8(%rip), %xmm1    # 0x23120
andpd %xmm0, %xmm1
movsd 0x16efc(%rip), %xmm2    # 0x23140
ucomisd %xmm1, %xmm2
jae 0xc2d3
cmpb $0x5, 0x10(%rbx)
je 0xc264
movq %rbx, %rdi
callq 0xb876
testl %eax, %eax
je 0xc2e7
movq 0xf8865(%rip), %rdi     # 0x104ad0
callq 0x861b
callq 0x975f
movq 0xf8854(%rip), %rdi     # 0x104ad0
callq 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0x9fae
movsd 0x16eaa(%rip), %xmm0    # 0x23140
callq 0xaf59
movq %rbx, %rdi
callq 0x861b
movq %rbx, %rdi
callq 0x861b
callq 0x9fae
callq 0xb07f
callq 0xba06
callq 0xa1f6
callq 0xba1b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9fae
callq 0x7310
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xaf59
movq %rbx, %rdi
callq 0x9fd6
testl %eax, %eax
je 0xc314
movq %rbx, %rdi
callq 0x861b
callq 0x975f
callq 0xc1a8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x975f
movq %rbx, %rdi
callq 0xbe16
testl %eax, %eax
je 0xc339
pushq $0x1
popq %rdi
pushq $0x4
popq %rsi
callq 0x9a47
movq 0x32d0e(%rip), %rdi     # 0x3f040
callq 0x861b
jmp 0xc2c4
movq %rbx, %rdi
callq 0xa641
testl %eax, %eax
je 0xc356
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa426
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0xbf44
testl %eax, %eax
je 0xc36f
pushq $0x1
popq %rdi
pushq $0x6
jmp 0xc325
movq %rbx, %rdi
callq 0xa95a
testl %eax, %eax
je 0xc382
pushq $0x1
popq %rdi
pushq $0x2
jmp 0xc325
movq 0x2fdef(%rip), %rdi     # 0x3c178
callq 0x861b
movq %rbx, %rdi
callq 0x861b
pushq $0x2
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x85eb