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

	if (isdouble(p1)) {
		push(p1);
		d = pop_double();
		d = cosh(d);
		push_double(d);
		return;
	}

	// cosh(z) = 1/2 exp(z) + 1/2 exp(-z)

	if (isdoublez(p1)) {
		push_rational(1, 2);
		push(p1);
		expfunc();
		push(p1);
		negate();
		expfunc();
		add();
		multiply();
		return;
	}

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

	// cosh(-x) = cosh(x)

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

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

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x2e1ff(%rip), %eax     # 0x3f2b8
leal -0x186a1(%rax), %ecx
cmpl $0xfffe7960, %ecx       # imm = 0xFFFE7960
jb 0x11159
leaq 0x374ee(%rip), %r14     # 0x485c0
decl %eax
movl %eax, 0x2e1de(%rip)     # 0x3f2b8
movq (%r14,%rax,8), %rbx
movzbl 0x10(%rbx), %r15d
cmpl $0x5, %r15d
je 0x11165
cmpl $0x7, %r15d
je 0x11196
movq %rbx, %rdi
callq 0xca1c
testl %eax, %eax
jne 0x111fb
movq %rbx, %rdi
callq 0xb477
testl %eax, %eax
jne 0x1127e
movq %rbx, %rdi
callq 0xac49
testl %eax, %eax
je 0x11287
movq %rbx, %rdi
callq 0x8ba5
movq 0x1052be(%rip), %rdi    # 0x1163f0
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movl 0x2e171(%rip), %eax     # 0x3f2b8
leal -0x186a1(%rax), %ecx
cmpl $0xfffe7960, %ecx       # imm = 0xFFFE7960
jae 0x110d2
leaq 0x1dde1(%rip), %rdi     # 0x2ef41
callq 0x780b
movq %rbx, %rdi
callq 0x8ba5
callq 0x9128
callq 0x7220
movsd %xmm0, -0x30(%rbp)
callq 0x74dc
movb $0x5, 0x10(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %rax, %rdi
jmp 0x112eb
movq %rbx, %rdi
callq 0x9638
movq %rax, %rbx
movq (%rax), %rax
movslq 0x64(%rax), %r15
testq %r15, %r15
jle 0x111f3
xorl %r12d, %r12d
movl $0xfffe795f, %r13d      # imm = 0xFFFE795F
movq (%rbx), %rax
movq 0x68(%rax,%r12,8), %rdi
callq 0x8ba5
callq 0x110a5
movl 0x2e0ea(%rip), %eax     # 0x3f2b8
leal (%rax,%r13), %ecx
cmpl %r13d, %ecx
jbe 0x11159
decl %eax
movl %eax, 0x2e0d9(%rip)     # 0x3f2b8
movq (%r14,%rax,8), %rax
movq (%rbx), %rcx
movq %rax, 0x68(%rcx,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x111b6
movq %rbx, %rdi
jmp 0x112eb
movl $0x1, %edi
movl $0x2, %esi
callq 0xa533
movq %rbx, %rdi
callq 0x8ba5
movq 0x370af(%rip), %rdi     # 0x482c8
callq 0x8ba5
callq 0xb238
callq 0xa573
movq %rbx, %rdi
callq 0x8ba5
movq 0x1051b9(%rip), %rdi    # 0x1163f0
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movq 0x3707b(%rip), %rdi     # 0x482c8
callq 0x8ba5
callq 0xb238
callq 0xa573
movl $0x2, %edi
callq 0xadb3
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xacef
movq 0xfa853(%rip), %rdi     # 0x10bad8
jmp 0x112eb
cmpb $0x1, %r15b
leaq 0x3476e(%rip), %rax     # 0x45a00
movq %rax, %rcx
cmoveq %rbx, %rcx
movq (%rcx), %rcx
cmpq 0x31edd(%rip), %rcx     # 0x43180
je 0x112d1
movq 0x3254c(%rip), %rdi     # 0x437f8
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8b7d
addq $0x8, %rbx
cmpb $0x1, %r15b
cmovneq %rax, %rbx
movq (%rbx), %rcx
cmpb $0x1, 0x10(%rcx)
cmoveq %rcx, %rax
movq (%rax), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8ba5