#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 sinhf(float);
float tanhf(float arg) {
  float sign;
  sign = 1.;
  if (arg < 0.) {
    arg = -arg;
    sign = -1.;
  }
  if (arg > 21.)
    return (sign);
  return (sign * sinhf(arg) / coshf(arg));
}


x86 assembly (clang, -O0):
<tanhf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  0xecb(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1174 <tanhf+0x54>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe95(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe83(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    119e <tanhf+0x7e>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11de <tanhf+0xbe>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <sinhf@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <coshf@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanhf>:
sub    $0x28,%rsp
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %cl
jbe    1138 <tanhf+0x18>
xorps  0xec8(%rip),%xmm0
mov    %cl,%al
lea    0xecf(%rip),%rcx
movss  (%rcx,%rax,4),%xmm1
ucomiss 0xecb(%rip),%xmm0
ja     1183 <tanhf+0x63>
movaps %xmm0,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
call   1040 <sinhf@plt>
movss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <coshf@plt>
movss  0xc(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @tanhf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float 1.000000e+00, float* %4
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load float, float* %3
%10 = fneg float %9
store float %10, float* %3
store float -1.000000e+00, float* %4
br label %11
11: ; preds = %8, %1
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = fcmp ogt double %13, 2.100000e+01
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load float, float* %4
store float %16, float* %2
br label %25
17: ; preds = %11
%18 = load float, float* %4
%19 = load float, float* %3
%20 = call float @sinhf(float %19)
%21 = fmul float %18, %20
%22 = load float, float* %3
%23 = call float @coshf(float %22)
%24 = fdiv float %21, %23
store float %24, float* %2
br label %25
25: ; preds = %17, %15
%26 = load float, float* %2
ret float %26
}

LLVM IR (-O2):
define float @tanhf(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
%5 = select i1 %2, float -1.000000e+00, float 1.000000e+00
%6 = fcmp ogt float %4, 2.100000e+01
br i1 %6, label %12, label %7
7: ; preds = %1
%8 = tail call float @sinhf(float %4)
%9 = fmul float %5, %8
%10 = tail call float @coshf(float %4)
%11 = fdiv float %9, %10
br label %12
12: ; preds = %1, %7
%13 = phi float [ %11, %7 ], [ %5, %1 ]
ret float %13
}