#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 log(scalar_t__);
scalar_t__ sqrt(double);
double asinh(double x) {
  return x > 0 ? log(x + sqrt(x * x + 1)) : -log(sqrt(x * x + 1) - x);
}


x86 assembly (clang, -O0):
<asinh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    118a <asinh+0x6a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea1(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x18(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    11d9 <asinh+0xb9>
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe60(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
cvtsi2sd %rax,%xmm0
subsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinh>:
push   %rax
movsd  %xmm0,(%rsp)
mulsd  %xmm0,%xmm0
addsd  0xece(%rip),%xmm0
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
jbe    115d <asinh+0x3d>
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
pop    %rax
jmp    1030 <log@plt>
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <log@plt>
xorpd  0xe9d(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @asinh(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = load double, double* %2
%7 = load double, double* %2
%8 = load double, double* %2
%9 = call double @llvm.fmuladd.f64(double %7, double %8, double 1.000000e+00)
%10 = call i64 @sqrt(double %9)
%11 = sitofp i64 %10 to double
%12 = fadd double %6, %11
%13 = fptosi double %12 to i64
%14 = call double @log(i64 %13)
br label %26
15: ; preds = %1
%16 = load double, double* %2
%17 = load double, double* %2
%18 = call double @llvm.fmuladd.f64(double %16, double %17, double 1.000000e+00)
%19 = call i64 @sqrt(double %18)
%20 = sitofp i64 %19 to double
%21 = load double, double* %2
%22 = fsub double %20, %21
%23 = fptosi double %22 to i64
%24 = call double @log(i64 %23)
%25 = fneg double %24
br label %26
26: ; preds = %15, %5
%27 = phi double [ %14, %5 ], [ %25, %15 ]
ret double %27
}

LLVM IR (-O2):
define double @asinh(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%4 = tail call i64 @sqrt(double %3)
%5 = sitofp i64 %4 to double
br i1 %2, label %6, label %10
6: ; preds = %1
%7 = fadd double %5, %0
%8 = fptosi double %7 to i64
%9 = tail call double @log(i64 %8)
br label %15
10: ; preds = %1
%11 = fsub double %5, %0
%12 = fptosi double %11 to i64
%13 = tail call double @log(i64 %12)
%14 = fneg double %13
br label %15
15: ; preds = %10, %6
%16 = phi double [ %9, %6 ], [ %14, %10 ]
ret double %16
}