#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 fabsf(float);
float sinhf(float);
void _cchshf(float x, float *c, float *s) {
  float e, ei;
  if (fabsf(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    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm1
movaps 0xebf(%rip),%xmm0
pand   %xmm0,%xmm1
movss  0xea3(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     118f <_cchshf+0x5f>
movss  -0x4(%rbp),%xmm0
call   1030 <coshf@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
call   1050 <sinhf@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    11e6 <_cchshf+0xb6>
movss  -0x4(%rbp),%xmm0
call   1040 <expf@plt>
movss  %xmm0,-0x1c(%rbp)
movss  0xe5a(%rip),%xmm0
divss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe48(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%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),%xmm1
andps  %xmm0,%xmm1
movss  0xec1(%rip),%xmm2
ucomiss %xmm1,%xmm2
jae    1182 <_cchshf+0x52>
call   1040 <expf@plt>
movss  0xeaf(%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    119d <_cchshf+0x6d>
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
store float %0, float* %4
store float* %1, float** %5
store float* %2, float** %6
%9 = load float, float* %4
%10 = call float @llvm.fabs.f32(float %9)
%11 = fcmp ole float %10, 5.000000e-01
br i1 %11, label %12, label %19
12: ; preds = %3
%13 = load float, float* %4
%14 = call float @coshf(float %13)
%15 = load float*, float** %5
store float %14, float* %15
%16 = load float, float* %4
%17 = call float @sinhf(float %16)
%18 = load float*, float** %6
store float %17, float* %18
br label %34
19: ; preds = %3
%20 = load float, float* %4
%21 = call float @expf(float %20)
store float %21, float* %7
%22 = load float, float* %7
%23 = fdiv float 5.000000e-01, %22
store float %23, float* %8
%24 = load float, float* %7
%25 = fmul float 5.000000e-01, %24
store float %25, float* %7
%26 = load float, float* %7
%27 = load float, float* %8
%28 = fsub float %26, %27
%29 = load float*, float** %6
store float %28, float* %29
%30 = load float, float* %7
%31 = load float, float* %8
%32 = fadd float %30, %31
%33 = load float*, float** %5
store float %32, float* %33
br label %34
34: ; preds = %19, %12
ret void
}

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