#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 */
typedef int uint32_t;

/* Variables and functions */
int __expo2f(float);
float expm1f(float);
float sinhf(float x) {
  union {
    float f;
    uint32_t i;
  } u = {.f = x};
  uint32_t w;
  float t, h, absx;
  h = 0.5;
  if (u.i >> 31)
    h = -h;
  u.i &= 0x7fffffff;
  absx = u.f;
  w = u.i;
  if (w < 0x42b17217) {
    t = expm1f(absx);
    if (w < 0x3f800000) {
      if (w < 0x3f800000 - (12 << 23))
        return x;
      return h * (2 * t - t * t / (t + 1));
    }
    return h * (t + t / (t + 1));
  }
  t = 2 * h * __expo2f(absx);
  return t;
}


x86 assembly (clang, -O0):
<sinhf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xec1(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x1f,%eax
cmp    $0x0,%eax
je     116a <sinhf+0x4a>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x42b17217,-0x14(%rbp)
jge    1244 <sinhf+0x124>
movss  -0x20(%rbp),%xmm0
call   1040 <expm1f@plt>
movss  %xmm0,-0x18(%rbp)
cmpl   $0x3f800000,-0x14(%rbp)
jge    1212 <sinhf+0xf2>
cmpl   $0x39800000,-0x14(%rbp)
jge    11ca <sinhf+0xaa>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    127c <sinhf+0x15c>
movss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
mulss  -0x18(%rbp),%xmm2
movss  0xe22(%rip),%xmm3
addss  -0x18(%rbp),%xmm3
divss  %xmm3,%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
addss  %xmm1,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    127c <sinhf+0x15c>
movss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movss  0xddf(%rip),%xmm3
addss  -0x18(%rbp),%xmm3
divss  %xmm3,%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    127c <sinhf+0x15c>
movss  0xdb8(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
call   1030 <__expo2f@plt>
movss  -0x24(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinhf>:
push   %rbx
sub    $0x20,%rsp
movdqa %xmm0,%xmm2
movd   %xmm0,%ebx
movdqa 0xecb(%rip),%xmm1
pand   %xmm0,%xmm1
por    0xecf(%rip),%xmm1
and    $0x7fffffff,%ebx
movdqa 0xed1(%rip),%xmm0
pand   %xmm2,%xmm0
cmp    $0x42b17216,%ebx
ja     11a8 <sinhf+0x88>
movdqa %xmm2,0x10(%rsp)
movaps %xmm1,(%rsp)
call   1040 <expm1f@plt>
cmp    $0x3f7fffff,%ebx
ja     11c3 <sinhf+0xa3>
cmp    $0x39800000,%ebx
movaps 0x10(%rsp),%xmm1
jb     11e5 <sinhf+0xc5>
movss  0xea9(%rip),%xmm1
addss  %xmm0,%xmm1
movaps %xmm0,%xmm2
mulss  %xmm0,%xmm2
divss  %xmm1,%xmm2
addss  %xmm0,%xmm0
subss  %xmm2,%xmm0
movaps (%rsp),%xmm1
mulss  %xmm0,%xmm1
jmp    11e5 <sinhf+0xc5>
addss  %xmm1,%xmm1
movaps %xmm1,(%rsp)
call   1030 <__expo2f@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
mulss  (%rsp),%xmm1
jmp    11e5 <sinhf+0xc5>
movss  0xe65(%rip),%xmm1
addss  %xmm0,%xmm1
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
addss  %xmm0,%xmm2
movaps (%rsp),%xmm0
mulss  %xmm2,%xmm0
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @sinhf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca %union.anon
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %3
%9 = bitcast %union.anon* %4 to float*
%10 = load float, float* %3
store float %10, float* %9
store float 5.000000e-01, float* %7
%11 = bitcast %union.anon* %4 to i32*
%12 = load i32, i32* %11
%13 = ashr i32 %12, 31
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load float, float* %7
%17 = fneg float %16
store float %17, float* %7
br label %18
18: ; preds = %15, %1
%19 = bitcast %union.anon* %4 to i32*
%20 = load i32, i32* %19
%21 = and i32 %20, 2147483647
store i32 %21, i32* %19
%22 = bitcast %union.anon* %4 to float*
%23 = load float, float* %22
store float %23, float* %8
%24 = bitcast %union.anon* %4 to i32*
%25 = load i32, i32* %24
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = icmp slt i32 %26, 1118925335
br i1 %27, label %28, label %59
28: ; preds = %18
%29 = load float, float* %8
%30 = call float @expm1f(float %29)
store float %30, float* %6
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 1065353216
br i1 %32, label %33, label %50
33: ; preds = %28
%34 = load i32, i32* %5
%35 = icmp slt i32 %34, 964689920
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = load float, float* %3
store float %37, float* %2
br label %67
38: ; preds = %33
%39 = load float, float* %7
%40 = load float, float* %6
%41 = load float, float* %6
%42 = load float, float* %6
%43 = fmul float %41, %42
%44 = load float, float* %6
%45 = fadd float %44, 1.000000e+00
%46 = fdiv float %43, %45
%47 = fneg float %46
%48 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %40, float %47)
%49 = fmul float %39, %48
store float %49, float* %2
br label %67
50: ; preds = %28
%51 = load float, float* %7
%52 = load float, float* %6
%53 = load float, float* %6
%54 = load float, float* %6
%55 = fadd float %54, 1.000000e+00
%56 = fdiv float %53, %55
%57 = fadd float %52, %56
%58 = fmul float %51, %57
store float %58, float* %2
br label %67
59: ; preds = %18
%60 = load float, float* %7
%61 = fmul float 2.000000e+00, %60
%62 = load float, float* %8
%63 = call i32 @__expo2f(float %62)
%64 = sitofp i32 %63 to float
%65 = fmul float %61, %64
store float %65, float* %6
%66 = load float, float* %6
store float %66, float* %2
br label %67
67: ; preds = %59, %50, %38, %36
%68 = load float, float* %2
ret float %68
}

LLVM IR (-O2):
define float @sinhf(float %0) {
%2 = bitcast float %0 to i32
%3 = tail call float @llvm.copysign.f32(float 5.000000e-01, float %0)
%4 = and i32 %2, 2147483647
%5 = bitcast i32 %4 to float
%6 = icmp ult i32 %4, 1118925335
br i1 %6, label %7, label %24
7: ; preds = %1
%8 = tail call float @expm1f(float %5)
%9 = icmp ult i32 %4, 1065353216
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = icmp ult i32 %4, 964689920
br i1 %11, label %29, label %12
12: ; preds = %10
%13 = fadd float %8, 1.000000e+00
%14 = fneg float %8
%15 = fmul float %8, %14
%16 = fdiv float %15, %13
%17 = tail call float @llvm.fmuladd.f32(float %8, float 2.000000e+00, float %16)
%18 = fmul float %3, %17
br label %29
19: ; preds = %7
%20 = fadd float %8, 1.000000e+00
%21 = fdiv float %8, %20
%22 = fadd float %8, %21
%23 = fmul float %3, %22
br label %29
24: ; preds = %1
%25 = fmul float %3, 2.000000e+00
%26 = tail call i32 @__expo2f(float %5)
%27 = sitofp i32 %26 to float
%28 = fmul float %25, %27
br label %29
29: ; preds = %10, %24, %19, %12
%30 = phi float [ %18, %12 ], [ %23, %19 ], [ %28, %24 ], [ %0, %10 ]
ret float %30
}