#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 __fast_log1p(double);
double __fast_sqrt(double);
double fabs(double);
int /*<<< orphan*/ isfinite(double);
double asinh(double x) {
  double z;
  if (!isfinite(x))
    return x;
  z = fabs(x);
  z = __fast_log1p(z + z * z / (__fast_sqrt(z * z + 1.0) + 1.0));
  return (x > 0.0 ? z : -z);
}


x86 assembly (clang, -O0):
<asinh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <isfinite@plt>
cmp    $0x0,%eax
jne    115f <asinh+0x2f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1223 <asinh+0xf3>
movsd  -0x10(%rbp),%xmm0
movaps 0xea5(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5d(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <__fast_sqrt@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
movsd  0xe3f(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1050 <__fast_log1p@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11f8 <asinh+0xc8>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1219 <asinh+0xe9>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinh>:
sub    $0x38,%rsp
movaps %xmm0,(%rsp)
call   1030 <isfinite@plt>
test   %eax,%eax
je     11bb <asinh+0x8b>
movapd 0xeb7(%rip),%xmm1
movapd (%rsp),%xmm0
andpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
mulsd  %xmm0,%xmm0
movapd %xmm0,0x10(%rsp)
addsd  0xeb6(%rip),%xmm0
call   1040 <__fast_sqrt@plt>
addsd  0xea9(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0x20(%rsp),%xmm1
movapd %xmm1,%xmm0
call   1050 <__fast_log1p@plt>
movapd 0xe78(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd (%rsp),%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x38,%rsp
ret
movaps (%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @asinh(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = call i32 @isfinite(double %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = load double, double* %3
store double %9, double* %2
br label %34
10: ; preds = %1
%11 = load double, double* %3
%12 = call double @llvm.fabs.f64(double %11)
store double %12, double* %4
%13 = load double, double* %4
%14 = load double, double* %4
%15 = load double, double* %4
%16 = fmul double %14, %15
%17 = load double, double* %4
%18 = load double, double* %4
%19 = call double @llvm.fmuladd.f64(double %17, double %18, double 1.000000e+00)
%20 = call double @__fast_sqrt(double %19)
%21 = fadd double %20, 1.000000e+00
%22 = fdiv double %16, %21
%23 = fadd double %13, %22
%24 = call double @__fast_log1p(double %23)
store double %24, double* %4
%25 = load double, double* %3
%26 = fcmp ogt double %25, 0.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %10
%28 = load double, double* %4
br label %32
29: ; preds = %10
%30 = load double, double* %4
%31 = fneg double %30
br label %32
32: ; preds = %29, %27
%33 = phi double [ %28, %27 ], [ %31, %29 ]
store double %33, double* %2
br label %34
34: ; preds = %32, %8
%35 = load double, double* %2
ret double %35
}

LLVM IR (-O2):
define double @asinh(double %0) {
%2 = tail call i32 @isfinite(double %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1
%5 = tail call double @llvm.fabs.f64(double %0)
%6 = fmul double %0, %0
%7 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%8 = tail call double @__fast_sqrt(double %7)
%9 = fadd double %8, 1.000000e+00
%10 = fdiv double %6, %9
%11 = fadd double %5, %10
%12 = tail call double @__fast_log1p(double %11)
%13 = fcmp ogt double %0, 0.000000e+00
%14 = fneg double %12
%15 = select i1 %13, double %12, double %14
br label %16
16: ; preds = %1, %4
%17 = phi double [ %15, %4 ], [ %0, %1 ]
ret double %17
}