#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 hyper_tan(double a, double x) {
  double exp_x1, exp_x2, ax;
  ax = a * x;
  if (ax > 100.0) {
    return (1.0);
  } else if (ax < -100.0) {
    return (-1.0);
  } else {
    exp_x1 = exp(ax);
    exp_x2 = exp(-ax);
    return (exp_x1 - exp_x2) / (exp_x1 + exp_x2);
  }
}


x86 assembly (clang, -O0):
<hyper_tan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xec2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115a <hyper_tan+0x4a>
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <hyper_tan+0xc1>
movsd  0xea6(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    117f <hyper_tan+0x6f>
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <hyper_tan+0xc1>
movsd  -0x30(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hyper_tan>:
sub    $0x28,%rsp
mulsd  %xmm1,%xmm0
ucomisd 0xee8(%rip),%xmm0
jbe    112f <hyper_tan+0x1f>
movsd  0xed6(%rip),%xmm0
add    $0x28,%rsp
ret
movsd  0xee1(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    114a <hyper_tan+0x3a>
movsd  0xecb(%rip),%xmm0
add    $0x28,%rsp
ret
movapd %xmm0,0x10(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xeb7(%rip),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @hyper_tan(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
%9 = load double, double* %4
%10 = load double, double* %5
%11 = fmul double %9, %10
store double %11, double* %8
%12 = load double, double* %8
%13 = fcmp ogt double %12, 1.000000e+02
br i1 %13, label %14, label %15
14: ; preds = %2
store double 1.000000e+00, double* %3
br label %32
15: ; preds = %2
%16 = load double, double* %8
%17 = fcmp olt double %16, -1.000000e+02
br i1 %17, label %18, label %19
18: ; preds = %15
store double -1.000000e+00, double* %3
br label %32
19: ; preds = %15
%20 = load double, double* %8
%21 = call double @exp(double %20)
store double %21, double* %6
%22 = load double, double* %8
%23 = fneg double %22
%24 = call double @exp(double %23)
store double %24, double* %7
%25 = load double, double* %6
%26 = load double, double* %7
%27 = fsub double %25, %26
%28 = load double, double* %6
%29 = load double, double* %7
%30 = fadd double %28, %29
%31 = fdiv double %27, %30
store double %31, double* %3
br label %32
32: ; preds = %19, %18, %14
%33 = load double, double* %3
ret double %33
}

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