#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 */
float coshf(float);
float expf(float);
float sinhf(float);
void cchshf(float xx, float *c, float *s) {
  float x, e, ei;
  x = xx;
  if (((x) < 0 ? -(x) : (x)) <= 0.5f) {
    *c = coshf(x);
    *s = sinhf(x);
  } else {
    e = expf(x);
    ei = 0.5f / e;
    e = 0.5f * e;
    *s = e - ei;
    *c = e + ei;
  }
}


x86 assembly (clang, -O0):
<cchshf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    1178 <cchshf+0x48>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    1182 <cchshf+0x52>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm1
movss  0xe71(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     11c1 <cchshf+0x91>
movss  -0x1c(%rbp),%xmm0
call   1030 <coshf@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
call   1050 <sinhf@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1218 <cchshf+0xe8>
movss  -0x1c(%rbp),%xmm0
call   1040 <expf@plt>
movss  %xmm0,-0x20(%rbp)
movss  0xe28(%rip),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xe16(%rip),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
subss  -0x24(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x20(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cchshf>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movaps 0xebc(%rip),%xmm3
xorps  %xmm0,%xmm3
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
cmpltss %xmm1,%xmm2
andps  %xmm2,%xmm3
andnps %xmm0,%xmm2
orps   %xmm3,%xmm2
movss  0xead(%rip),%xmm1
ucomiss %xmm2,%xmm1
jae    1196 <cchshf+0x66>
call   1040 <expf@plt>
movss  0xe9b(%rip),%xmm2
movaps %xmm2,%xmm1
divss  %xmm0,%xmm1
mulss  %xmm2,%xmm0
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
movss  %xmm2,(%r14)
addss  %xmm1,%xmm0
movss  %xmm0,(%rbx)
jmp    11b1 <cchshf+0x81>
movaps %xmm0,(%rsp)
call   1030 <coshf@plt>
movss  %xmm0,(%rbx)
movaps (%rsp),%xmm0
call   1050 <sinhf@plt>
movss  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @cchshf(float %0, float* %1, float* %2) {
%4 = alloca float
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %4
store float* %1, float** %5
store float* %2, float** %6
%10 = load float, float* %4
store float %10, float* %7
%11 = load float, float* %7
%12 = fcmp olt float %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load float, float* %7
%15 = fneg float %14
br label %18
16: ; preds = %3
%17 = load float, float* %7
br label %18
18: ; preds = %16, %13
%19 = phi float [ %15, %13 ], [ %17, %16 ]
%20 = fcmp ole float %19, 5.000000e-01
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load float, float* %7
%23 = call float @coshf(float %22)
%24 = load float*, float** %5
store float %23, float* %24
%25 = load float, float* %7
%26 = call float @sinhf(float %25)
%27 = load float*, float** %6
store float %26, float* %27
br label %43
28: ; preds = %18
%29 = load float, float* %7
%30 = call float @expf(float %29)
store float %30, float* %8
%31 = load float, float* %8
%32 = fdiv float 5.000000e-01, %31
store float %32, float* %9
%33 = load float, float* %8
%34 = fmul float 5.000000e-01, %33
store float %34, float* %8
%35 = load float, float* %8
%36 = load float, float* %9
%37 = fsub float %35, %36
%38 = load float*, float** %6
store float %37, float* %38
%39 = load float, float* %8
%40 = load float, float* %9
%41 = fadd float %39, %40
%42 = load float*, float** %5
store float %41, float* %42
br label %43
43: ; preds = %28, %21
ret void
}

LLVM IR (-O2):
define void @cchshf(float %0, float* nocapture writeonly %1, float* nocapture writeonly %2) {
%4 = fcmp olt float %0, 0.000000e+00
%5 = fneg float %0
%6 = select i1 %4, float %5, float %0
%7 = fcmp ugt float %6, 5.000000e-01
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = tail call float @coshf(float %0)
store float %9, float* %1
%10 = tail call float @sinhf(float %0)
store float %10, float* %2
br label %17
11: ; preds = %3
%12 = tail call float @expf(float %0)
%13 = fdiv float 5.000000e-01, %12
%14 = fmul float %12, 5.000000e-01
%15 = fsub float %14, %13
store float %15, float* %2
%16 = fadd float %14, %13
store float %16, float* %1
br label %17
17: ; preds = %11, %8
ret void
}