#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 */
double exp(double);
double sinh(double x) {
  if (x >= 0.0) {
    const double epos = exp(x);
    return (epos - 1.0 / epos) / 2.0;
  } else {
    const double eneg = exp(-x);
    return (1.0 / eneg - eneg) / 2.0;
  }
}


x86 assembly (clang, -O0):
<sinh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116a <sinh+0x5a>
movsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xebd(%rip),%xmm1
divsd  -0x18(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b3 <sinh+0xa3>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe70(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinh>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    113a <sinh+0x2a>
xorpd  0xeed(%rip),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm1
movsd  0xecc(%rip),%xmm0
divsd  %xmm1,%xmm0
jmp    114b <sinh+0x3b>
call   1030 <exp@plt>
movsd  0xeb9(%rip),%xmm1
divsd  %xmm0,%xmm1
subsd  %xmm1,%xmm0
mulsd  0xeb1(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sinh(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = fcmp oge double %6, 0.000000e+00
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = load double, double* %3
%10 = call double @exp(double %9)
store double %10, double* %4
%11 = load double, double* %4
%12 = load double, double* %4
%13 = fdiv double 1.000000e+00, %12
%14 = fsub double %11, %13
%15 = fdiv double %14, 2.000000e+00
store double %15, double* %2
br label %25
16: ; preds = %1
%17 = load double, double* %3
%18 = fneg double %17
%19 = call double @exp(double %18)
store double %19, double* %5
%20 = load double, double* %5
%21 = fdiv double 1.000000e+00, %20
%22 = load double, double* %5
%23 = fsub double %21, %22
%24 = fdiv double %23, 2.000000e+00
store double %24, double* %2
br label %25
25: ; preds = %16, %8
%26 = load double, double* %2
ret double %26
}

LLVM IR (-O2):
define double @sinh(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call double @exp(double %0)
%5 = fdiv double 1.000000e+00, %4
br label %10
6: ; preds = %1
%7 = fneg double %0
%8 = tail call double @exp(double %7)
%9 = fdiv double 1.000000e+00, %8
br label %10
10: ; preds = %6, %3
%11 = phi double [ %8, %6 ], [ %5, %3 ]
%12 = phi double [ %9, %6 ], [ %4, %3 ]
%13 = fsub double %12, %11
%14 = fmul double %13, 5.000000e-01
ret double %14
}