#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 fabs(double);
double log(double);
double log1p(double);
double sqrt(double);
double asinh(double x) {
  double t, w;
  int hx, ix;
  hx = *(1 + (const int *)&x);
  ix = hx & 0x7fffffff;
  if (ix >= 0x7ff00000) {
    return x + x;
  }
  if (ix < 0x3e300000) {
    if (1.0e+300 + x > 1.0) {
      return x;
    }
  }
  if (ix > 0x41b00000) {
    w = log(fabs(x)) + 6.93147180559945286227e-01;
  } else if (ix > 0x40000000) {
    t = fabs(x);
    w = log(2.0 * t + 1.0 / (sqrt(x * x + 1.0) + t));
  } else {
    t = x * x;
    w = log1p(fabs(x) + t / (1.0 + sqrt(1.0 + t)));
  }
  if (hx > 0) {
    return w;
  } else {
    return -w;
  }
}


x86 assembly (clang, -O0):
<asinh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x7ff00000,-0x28(%rbp)
jl     116f <asinh+0x3f>
movsd  -0x10(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130c <asinh+0x1dc>
cmpl   $0x3e300000,-0x28(%rbp)
jge    11af <asinh+0x7f>
movsd  0xe84(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe6f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11aa <asinh+0x7a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130c <asinh+0x1dc>
jmp    11af <asinh+0x7f>
cmpl   $0x41b00000,-0x28(%rbp)
jle    11e7 <asinh+0xb7>
movsd  -0x10(%rbp),%xmm0
movaps 0xe58(%rip),%xmm1
pand   %xmm1,%xmm0
call   1030 <log@plt>
movsd  0xe37(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12d2 <asinh+0x1a2>
cmpl   $0x40000000,-0x28(%rbp)
jle    1262 <asinh+0x132>
movsd  -0x10(%rbp),%xmm0
movaps 0xe20(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd7(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm2
movsd  0xdb9(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    12cd <asinh+0x19d>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xda3(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd68(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
movsd  0xd49(%rip),%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1050 <log1p@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    12d2 <asinh+0x1a2>
cmpl   $0x0,-0x24(%rbp)
jle    12eb <asinh+0x1bb>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130c <asinh+0x1dc>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinh>:
push   %rbx
sub    $0x20,%rsp
movdqa %xmm0,%xmm2
movq   %xmm0,%rbx
shr    $0x20,%rbx
mov    %ebx,%eax
and    $0x7fffffff,%eax
cmp    $0x7ff00000,%eax
jb     1159 <asinh+0x29>
addsd  %xmm2,%xmm2
jmp    1283 <asinh+0x153>
movsd  0xe9f(%rip),%xmm0
addsd  %xmm2,%xmm0
ucomisd 0xe9b(%rip),%xmm0
jbe    117a <asinh+0x4a>
cmp    $0x3e300000,%eax
jb     1283 <asinh+0x153>
cmp    $0x41b00001,%eax
jb     11ab <asinh+0x7b>
andpd  0xe97(%rip),%xmm2
movapd %xmm2,%xmm0
call   1030 <log@plt>
movapd %xmm0,%xmm2
addsd  0xe72(%rip),%xmm2
test   %ebx,%ebx
jle    127b <asinh+0x14b>
jmp    1283 <asinh+0x153>
cmp    $0x40000001,%eax
jb     11dd <asinh+0xad>
movapd 0xe66(%rip),%xmm3
andpd  %xmm2,%xmm3
mulsd  %xmm2,%xmm2
addsd  0xe3e(%rip),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1209 <asinh+0xd9>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    121c <asinh+0xec>
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
andpd  0xe33(%rip),%xmm2
movsd  0xe13(%rip),%xmm0
addsd  %xmm3,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     123f <asinh+0x10f>
sqrtsd %xmm0,%xmm0
jmp    125a <asinh+0x12a>
movapd %xmm2,%xmm0
movapd %xmm3,(%rsp)
call   1040 <sqrt@plt>
movapd (%rsp),%xmm3
addsd  %xmm3,%xmm0
movsd  0xde0(%rip),%xmm1
divsd  %xmm0,%xmm1
addsd  %xmm3,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm3,%xmm0
call   1030 <log@plt>
jmp    1273 <asinh+0x143>
movapd %xmm2,(%rsp)
movapd %xmm3,0x10(%rsp)
call   1040 <sqrt@plt>
movapd 0x10(%rsp),%xmm3
movapd (%rsp),%xmm2
addsd  0xda6(%rip),%xmm0
divsd  %xmm0,%xmm3
addsd  %xmm3,%xmm2
movapd %xmm2,%xmm0
call   1050 <log1p@plt>
movapd %xmm0,%xmm2
test   %ebx,%ebx
jg     1283 <asinh+0x153>
xorpd  0xdad(%rip),%xmm2
movapd %xmm2,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @asinh(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store double %0, double* %3
%8 = bitcast double* %3 to i32*
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = and i32 %11, 2147483647
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp sge i32 %13, 2146435072
br i1 %14, label %15, label %19
15: ; preds = %1
%16 = load double, double* %3
%17 = load double, double* %3
%18 = fadd double %16, %17
store double %18, double* %2
br label %76
19: ; preds = %1
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 1043333120
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load double, double* %3
%24 = fadd double 1.000000e+300, %23
%25 = fcmp ogt double %24, 1.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load double, double* %3
store double %27, double* %2
br label %76
28: ; preds = %22
br label %29
29: ; preds = %28, %19
%30 = load i32, i32* %7
%31 = icmp sgt i32 %30, 1102053376
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load double, double* %3
%34 = call double @llvm.fabs.f64(double %33)
%35 = call double @log(double %34)
%36 = fadd double %35, 0x3FE62E42FEFA39EF
store double %36, double* %5
br label %68
37: ; preds = %29
%38 = load i32, i32* %7
%39 = icmp sgt i32 %38, 1073741824
br i1 %39, label %40, label %53
40: ; preds = %37
%41 = load double, double* %3
%42 = call double @llvm.fabs.f64(double %41)
store double %42, double* %4
%43 = load double, double* %4
%44 = load double, double* %3
%45 = load double, double* %3
%46 = call double @llvm.fmuladd.f64(double %44, double %45, double 1.000000e+00)
%47 = call double @sqrt(double %46)
%48 = load double, double* %4
%49 = fadd double %47, %48
%50 = fdiv double 1.000000e+00, %49
%51 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %43, double %50)
%52 = call double @log(double %51)
store double %52, double* %5
br label %67
53: ; preds = %37
%54 = load double, double* %3
%55 = load double, double* %3
%56 = fmul double %54, %55
store double %56, double* %4
%57 = load double, double* %3
%58 = call double @llvm.fabs.f64(double %57)
%59 = load double, double* %4
%60 = load double, double* %4
%61 = fadd double 1.000000e+00, %60
%62 = call double @sqrt(double %61)
%63 = fadd double 1.000000e+00, %62
%64 = fdiv double %59, %63
%65 = fadd double %58, %64
%66 = call double @log1p(double %65)
store double %66, double* %5
br label %67
67: ; preds = %53, %40
br label %68
68: ; preds = %67, %32
%69 = load i32, i32* %6
%70 = icmp sgt i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = load double, double* %5
store double %72, double* %2
br label %76
73: ; preds = %68
%74 = load double, double* %5
%75 = fneg double %74
store double %75, double* %2
br label %76
76: ; preds = %73, %71, %26, %15
%77 = load double, double* %2
ret double %77
}

LLVM IR (-O2):
define double @asinh(double %0) {
%2 = bitcast double %0 to i64
%3 = lshr i64 %2, 32
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 2147483647
%6 = icmp ugt i32 %5, 2146435071
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = fadd double %0, %0
br label %44
9: ; preds = %1
%10 = icmp ult i32 %5, 1043333120
%11 = fadd double %0, 1.000000e+300
%12 = fcmp ogt double %11, 1.000000e+00
%13 = and i1 %12, %10
br i1 %13, label %44, label %14
14: ; preds = %9
%15 = icmp ugt i32 %5, 1102053376
br i1 %15, label %16, label %20
16: ; preds = %14
%17 = tail call double @llvm.fabs.f64(double %0)
%18 = tail call double @log(double %17)
%19 = fadd double %18, 0x3FE62E42FEFA39EF
br label %39
20: ; preds = %14
%21 = icmp ugt i32 %5, 1073741824
br i1 %21, label %22, label %30
22: ; preds = %20
%23 = tail call double @llvm.fabs.f64(double %0)
%24 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%25 = tail call double @sqrt(double %24)
%26 = fadd double %23, %25
%27 = fdiv double 1.000000e+00, %26
%28 = tail call double @llvm.fmuladd.f64(double %23, double 2.000000e+00, double %27)
%29 = tail call double @log(double %28)
br label %39
30: ; preds = %20
%31 = fmul double %0, %0
%32 = tail call double @llvm.fabs.f64(double %0)
%33 = fadd double %31, 1.000000e+00
%34 = tail call double @sqrt(double %33)
%35 = fadd double %34, 1.000000e+00
%36 = fdiv double %31, %35
%37 = fadd double %32, %36
%38 = tail call double @log1p(double %37)
br label %39
39: ; preds = %22, %30, %16
%40 = phi double [ %19, %16 ], [ %29, %22 ], [ %38, %30 ]
%41 = icmp sgt i32 %4, 0
%42 = fneg double %40
%43 = select i1 %41, double %40, double %42
br label %44
44: ; preds = %39, %9, %7
%45 = phi double [ %8, %7 ], [ %0, %9 ], [ %43, %39 ]
ret double %45
}