#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
long double coshl(long double);
long double expl(long double);
long double fabsl(long double);
long double sinhl(long double);
void _cchshl(long double x, long double *c, long double *s) {
  long double e, ei;
  if (fabsl(x) <= 0.5L) {
    *c = coshl(x);
    *s = sinhl(x);
  } else {
    e = expl(x);
    ei = 0.5L / e;
    e = 0.5L * e;
    *s = e - ei;
    *c = e + ei;
  }
}


x86 assembly (clang, -O0):
<_cchshl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
fldt   -0x10(%rbp)
fabs
flds   0xeaf(%rip)
fucomip %st(1),%st
fstp   %st(0)
jb     118b <_cchshl+0x5b>
jmp    1160 <_cchshl+0x30>
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <coshl@plt>
mov    -0x18(%rbp),%rax
fstpt  (%rax)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <sinhl@plt>
mov    -0x20(%rbp),%rax
fstpt  (%rax)
jmp    11cf <_cchshl+0x9f>
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <expl@plt>
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
flds   0xe5c(%rip)
fdiv   %st,%st(1)
fxch   %st(1)
fstpt  -0x40(%rbp)
fldt   -0x30(%rbp)
fmulp  %st,%st(1)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
fsubrp %st,%st(1)
mov    -0x20(%rbp),%rax
fstpt  (%rax)
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
faddp  %st,%st(1)
mov    -0x18(%rbp),%rax
fstpt  (%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cchshl>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
fldt   0x40(%rsp)
fld    %st(0)
fabs
flds   0xeb5(%rip)
fucomi %st(1),%st
fstp   %st(1)
jae    1178 <_cchshl+0x48>
fxch   %st(1)
fstpt  (%rsp)
fstpt  0x1c(%rsp)
call   1050 <expl@plt>
fldt   0x1c(%rsp)
fld    %st(0)
fdiv   %st(2),%st
fxch   %st(2)
fmulp  %st,%st(1)
fld    %st(0)
fsub   %st(2),%st
fstpt  (%r14)
faddp  %st,%st(1)
fstpt  (%rbx)
jmp    1199 <_cchshl+0x69>
fstp   %st(0)
fld    %st(0)
fstpt  (%rsp)
fstpt  0x1c(%rsp)
call   1030 <coshl@plt>
fstpt  (%rbx)
fldt   0x1c(%rsp)
fstpt  (%rsp)
call   1040 <sinhl@plt>
fstpt  (%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @_cchshl(x86_fp80 %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca x86_fp80
%5 = alloca x86_fp80*
%6 = alloca x86_fp80*
%7 = alloca x86_fp80
%8 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80* %1, x86_fp80** %5
store x86_fp80* %2, x86_fp80** %6
%9 = load x86_fp80, x86_fp80* %4
%10 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %9)
%11 = fcmp ole x86_fp80 %10, 0xK3FFE8000000000000000
br i1 %11, label %12, label %19
12: ; preds = %3
%13 = load x86_fp80, x86_fp80* %4
%14 = call x86_fp80 @coshl(x86_fp80 %13)
%15 = load x86_fp80*, x86_fp80** %5
store x86_fp80 %14, x86_fp80* %15
%16 = load x86_fp80, x86_fp80* %4
%17 = call x86_fp80 @sinhl(x86_fp80 %16)
%18 = load x86_fp80*, x86_fp80** %6
store x86_fp80 %17, x86_fp80* %18
br label %34
19: ; preds = %3
%20 = load x86_fp80, x86_fp80* %4
%21 = call x86_fp80 @expl(x86_fp80 %20)
store x86_fp80 %21, x86_fp80* %7
%22 = load x86_fp80, x86_fp80* %7
%23 = fdiv x86_fp80 0xK3FFE8000000000000000, %22
store x86_fp80 %23, x86_fp80* %8
%24 = load x86_fp80, x86_fp80* %7
%25 = fmul x86_fp80 0xK3FFE8000000000000000, %24
store x86_fp80 %25, x86_fp80* %7
%26 = load x86_fp80, x86_fp80* %7
%27 = load x86_fp80, x86_fp80* %8
%28 = fsub x86_fp80 %26, %27
%29 = load x86_fp80*, x86_fp80** %6
store x86_fp80 %28, x86_fp80* %29
%30 = load x86_fp80, x86_fp80* %7
%31 = load x86_fp80, x86_fp80* %8
%32 = fadd x86_fp80 %30, %31
%33 = load x86_fp80*, x86_fp80** %5
store x86_fp80 %32, x86_fp80* %33
br label %34
34: ; preds = %19, %12
ret void
}

LLVM IR (-O2):
define void @_cchshl(x86_fp80 %0, x86_fp80* nocapture writeonly %1, x86_fp80* nocapture writeonly %2) {
%4 = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %0)
%5 = fcmp ugt x86_fp80 %4, 0xK3FFE8000000000000000
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call x86_fp80 @coshl(x86_fp80 %0)
store x86_fp80 %7, x86_fp80* %1
%8 = tail call x86_fp80 @sinhl(x86_fp80 %0)
store x86_fp80 %8, x86_fp80* %2
br label %15
9: ; preds = %3
%10 = tail call x86_fp80 @expl(x86_fp80 %0)
%11 = fdiv x86_fp80 0xK3FFE8000000000000000, %10
%12 = fmul x86_fp80 %10, 0xK3FFE8000000000000000
%13 = fsub x86_fp80 %12, %11
store x86_fp80 %13, x86_fp80* %2
%14 = fadd x86_fp80 %12, %11
store x86_fp80 %14, x86_fp80* %1
br label %15
15: ; preds = %9, %6
ret void
}