#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 DBL_EPSILON;
double chebyshev_eval(double, double *, int const);
double fabs(double);
double log(int);
double log1p(double x) {
  double alnrcs[] = {
      +.10378693562743769800686267719098e+1,
      -.13364301504908918098766041553133e+0,
      +.19408249135520563357926199374750e-1,
      -.30107551127535777690376537776592e-2,
      +.48694614797154850090456366509137e-3,
      -.81054881893175356066809943008622e-4,
      +.13778847799559524782938251496059e-4,
      -.23802210894358970251369992914935e-5,
      +.41640416213865183476391859901989e-6,
      -.73595828378075994984266837031998e-7,
      +.13117611876241674949152294345011e-7,
      -.23546709317742425136696092330175e-8,
      +.42522773276034997775638052962567e-9,
      -.77190894134840796826108107493300e-10,
      +.14075746481359069909215356472191e-10,
      -.25769072058024680627537078627584e-11,
      +.47342406666294421849154395005938e-12,
      -.87249012674742641745301263292675e-13,
      +.16124614902740551465739833119115e-13,
      -.29875652015665773006710792416815e-14,
      +.55480701209082887983041321697279e-15,
      -.10324619158271569595141333961932e-15,
      +.19250239203049851177878503244868e-16,
      -.35955073465265150011189707844266e-17,
      +.67264542537876857892194574226773e-18,
      -.12602624168735219252082425637546e-18,
      +.23644884408606210044916158955519e-19,
      -.44419377050807936898878389179733e-20,
      +.83546594464034259016241293994666e-21,
      -.15731559416479562574899253521066e-21,
      +.29653128740247422686154369706666e-22,
      -.55949583481815947292156013226666e-23,
      +.10566354268835681048187284138666e-23,
      -.19972483680670204548314999466666e-24,
      +.37782977818839361421049855999999e-25,
      -.71531586889081740345038165333333e-26,
      +.13552488463674213646502024533333e-26,
      -.25694673048487567430079829333333e-27,
      +.48747756066216949076459519999999e-28,
      -.92542112530849715321132373333333e-29,
      +.17578597841760239233269760000000e-29,
      -.33410026677731010351377066666666e-30,
      +.63533936180236187354180266666666e-31,
  };
  const int nlnrel = 22;
  const double xmin = -0.999999985;
  if (x == 0.0)
    return 0.0;
  if (x == -1)
    return (0xfff0000000000000);
  if (x < -1)
    return 0xfff8000000000000;
  if (fabs(x) <= .375) {
    if (fabs(x) < .5 * DBL_EPSILON)
      return x;
    if ((0 < x && x < 1e-8) || (-1e-9 < x && x < 0))
      return x * (1 - .5 * x);
    return x * (1 - x * chebyshev_eval(x / .375, alnrcs, nlnrel));
  }
  if (x < xmin) {
  }
  return log(1 + x);
}


x86 assembly (clang, -O0):
<log1p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movsd  %xmm0,-0x10(%rbp)
lea    -0x170(%rbp),%rdi
lea    0xf12(%rip),%rsi
mov    $0x158,%edx
call   1040 <memcpy@plt>
movl   $0x16,-0x174(%rbp)
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1197 <log1p+0x67>
jp     1197 <log1p+0x67>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137a <log1p+0x24a>
movsd  -0x10(%rbp),%xmm0
movsd  0xe64(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11c6 <log1p+0x96>
jp     11c6 <log1p+0x96>
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137a <log1p+0x24a>
movsd  0xe3a(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11eb <log1p+0xbb>
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137a <log1p+0x24a>
movsd  -0x10(%rbp),%xmm1
movaps 0xe59(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe0d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1347 <log1p+0x217>
movsd  -0x10(%rbp),%xmm1
movaps 0xe37(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdfb(%rip),%xmm0
mov    0x2dbc(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1249 <log1p+0x119>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137a <log1p+0x24a>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    126e <log1p+0x13e>
movsd  0xdc5(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1293 <log1p+0x163>
movsd  -0x10(%rbp),%xmm0
movsd  0xdb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12c3 <log1p+0x193>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12c3 <log1p+0x193>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xd93(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd67(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137a <log1p+0x24a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x188(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x190(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  0xd26(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    -0x170(%rbp),%rdi
mov    $0x16,%esi
call   1030 <chebyshev_eval@plt>
movsd  -0x190(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x188(%rbp),%xmm0
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xce3(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137a <log1p+0x24a>
movsd  0xcb1(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    135f <log1p+0x22f>
jmp    135f <log1p+0x22f>
movsd  0xcb1(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log1p>:
sub    $0x168,%rsp
movapd %xmm0,(%rsp)
lea    0xf1d(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x158,%edx
call   1040 <memcpy@plt>
movapd (%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    116b <log1p+0x3b>
jp     116b <log1p+0x3b>
add    $0x168,%rsp
ret
ucomisd 0xe95(%rip),%xmm2
jne    1187 <log1p+0x57>
jp     1187 <log1p+0x57>
movsd  0xe81(%rip),%xmm0
add    $0x168,%rsp
ret
movsd  0xe79(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    11a5 <log1p+0x75>
movsd  0xe73(%rip),%xmm0
add    $0x168,%rsp
ret
movapd 0xea3(%rip),%xmm0
andpd  %xmm2,%xmm0
movsd  0xe5f(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11d7 <log1p+0xa7>
addsd  0xe71(%rip),%xmm2
cvttsd2si %xmm2,%edi
add    $0x168,%rsp
jmp    1050 <log@plt>
mov    0x2e0a(%rip),%rax
movsd  (%rax),%xmm1
mulsd  0xe36(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11fc <log1p+0xcc>
movapd %xmm2,%xmm0
add    $0x168,%rsp
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    1214 <log1p+0xe4>
movsd  0xe1a(%rip),%xmm0
ucomisd %xmm2,%xmm0
ja     1228 <log1p+0xf8>
ucomisd 0xe14(%rip),%xmm2
jbe    123e <log1p+0x10e>
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jbe    123e <log1p+0x10e>
movsd  0xe10(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xdfc(%rip),%xmm0
jmp    1272 <log1p+0x142>
movapd %xmm2,%xmm0
divsd  0xdce(%rip),%xmm0
lea    0x10(%rsp),%rdi
mov    $0x16,%esi
call   1030 <chebyshev_eval@plt>
movapd %xmm0,%xmm1
movapd (%rsp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdca(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
add    $0x168,%rsp
ret

LLVM IR (-O0):
@__const.log1p.alnrcs = [43 x double] [double 0x3FF09B1CE5EB811D, double 0xBFC11B36DD7CC21D, double 0x3F93DFC18D3D1D0A, double 0xBF68AA02D7DB79A8, double 0x3F3FE999C7CBA2A1, double 0xBF153F804484AA81, double 0x3EECE5766BEF61D2, double 0xBEC3F77C61DB8B10, double 0x3E9BF1C4DF5C5CAB, double 0xBE73C1778142704C, double 0x3E4C2B7BBFA9A43E, double 0xBE2439F9E4307C3D, double 0x3DFD38AF7574620A, double 0xBDD537D3873B471F, double 0x3DAEF3F0D9F9E17E, double 0xBD86AAADDDD12CBE, double 0x3D60A8399312F94D, double 0xBD388EF4351E6163, double 0x3D12279A93DD1044, double 0xBCEAE8DB38BE97B6, double 0x3CC3FD3104E8F0CE, double 0xBC9DC2396B1FF914, double 0x3C7631AAF34D1B23, double 0xBC5094D36A9CF561, double 0x3C28D0F4D828C566, double 0xBC029923052BBD6E, double 0x3BDBEA3A5223964A, double 0xBBB4F9F922605A68, double 0x3B8F90217D18C710, double 0xBB67C5DA2EBC8D10, double 0x3B41EC997391DB96, double 0xBB1B0E3913BB9605, double 0x3AF470348879FC8C, double 0xBACEE7EA795C855F, double 0x3AA762F3AA11D7F3, double 0xBA81B5DA5B1CB601, double 0x3A5AD7ED94F631C2, double 0xBA345B7FB395FD6D, double 0x3A0EE5C690C25FED, double 0xB9E7765395A5F4D8, double 0x39C1D3AA38098AC6, double 0xB99B1AFDB6458798, double 0x39749E3162EE7273]
@DBL_EPSILON = global double 0.000000e+00
define double @log1p(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca [43 x double]
%5 = alloca i32
%6 = alloca double
store double %0, double* %3
%7 = bitcast [43 x double]* %4 to i8*
store i32 22, i32* %5
store double 0xBFEFFFFFF7F26A6B, double* %6
%8 = load double, double* %3
%9 = fcmp oeq double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %1
store double 0.000000e+00, double* %2
br label %67
11: ; preds = %1
%12 = load double, double* %3
%13 = fcmp oeq double %12, -1.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %11
store double 0x43EFFE0000000000, double* %2
br label %67
15: ; preds = %11
%16 = load double, double* %3
%17 = fcmp olt double %16, -1.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %15
store double 0x43EFFF0000000000, double* %2
br label %67
19: ; preds = %15
%20 = load double, double* %3
%21 = call double @llvm.fabs.f64(double %20)
%22 = fcmp ole double %21, 3.750000e-01
br i1 %22, label %23, label %58
23: ; preds = %19
%24 = load double, double* %3
%25 = call double @llvm.fabs.f64(double %24)
%26 = load double, double* @DBL_EPSILON
%27 = fmul double 5.000000e-01, %26
%28 = fcmp olt double %25, %27
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = load double, double* %3
store double %30, double* %2
br label %67
31: ; preds = %23
%32 = load double, double* %3
%33 = fcmp olt double 0.000000e+00, %32
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load double, double* %3
%36 = fcmp olt double %35, 1.000000e-08
br i1 %36, label %43, label %37
37: ; preds = %34, %31
%38 = load double, double* %3
%39 = fcmp olt double -1.000000e-09, %38
br i1 %39, label %40, label %48
40: ; preds = %37
%41 = load double, double* %3
%42 = fcmp olt double %41, 0.000000e+00
br i1 %42, label %43, label %48
43: ; preds = %40, %34
%44 = load double, double* %3
%45 = load double, double* %3
%46 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %45, double 1.000000e+00)
%47 = fmul double %44, %46
store double %47, double* %2
br label %67
48: ; preds = %40, %37
%49 = load double, double* %3
%50 = load double, double* %3
%51 = load double, double* %3
%52 = fdiv double %51, 3.750000e-01
%53 = getelementptr inbounds [43 x double], [43 x double]* %4, i64 0, i64 0
%54 = call double @chebyshev_eval(double %52, double* %53, i32 22)
%55 = fneg double %50
%56 = call double @llvm.fmuladd.f64(double %55, double %54, double 1.000000e+00)
%57 = fmul double %49, %56
store double %57, double* %2
br label %67
58: ; preds = %19
%59 = load double, double* %3
%60 = fcmp olt double %59, 0xBFEFFFFFF7F26A6B
br i1 %60, label %61, label %62
61: ; preds = %58
br label %62
62: ; preds = %61, %58
%63 = load double, double* %3
%64 = fadd double 1.000000e+00, %63
%65 = fptosi double %64 to i32
%66 = call double @log(i32 %65)
store double %66, double* %2
br label %67
67: ; preds = %62, %48, %43, %29, %18, %14, %10
%68 = load double, double* %2
ret double %68
}

LLVM IR (-O2):
@__const.log1p.alnrcs = [43 x double] [double 0x3FF09B1CE5EB811D, double 0xBFC11B36DD7CC21D, double 0x3F93DFC18D3D1D0A, double 0xBF68AA02D7DB79A8, double 0x3F3FE999C7CBA2A1, double 0xBF153F804484AA81, double 0x3EECE5766BEF61D2, double 0xBEC3F77C61DB8B10, double 0x3E9BF1C4DF5C5CAB, double 0xBE73C1778142704C, double 0x3E4C2B7BBFA9A43E, double 0xBE2439F9E4307C3D, double 0x3DFD38AF7574620A, double 0xBDD537D3873B471F, double 0x3DAEF3F0D9F9E17E, double 0xBD86AAADDDD12CBE, double 0x3D60A8399312F94D, double 0xBD388EF4351E6163, double 0x3D12279A93DD1044, double 0xBCEAE8DB38BE97B6, double 0x3CC3FD3104E8F0CE, double 0xBC9DC2396B1FF914, double 0x3C7631AAF34D1B23, double 0xBC5094D36A9CF561, double 0x3C28D0F4D828C566, double 0xBC029923052BBD6E, double 0x3BDBEA3A5223964A, double 0xBBB4F9F922605A68, double 0x3B8F90217D18C710, double 0xBB67C5DA2EBC8D10, double 0x3B41EC997391DB96, double 0xBB1B0E3913BB9605, double 0x3AF470348879FC8C, double 0xBACEE7EA795C855F, double 0x3AA762F3AA11D7F3, double 0xBA81B5DA5B1CB601, double 0x3A5AD7ED94F631C2, double 0xBA345B7FB395FD6D, double 0x3A0EE5C690C25FED, double 0xB9E7765395A5F4D8, double 0x39C1D3AA38098AC6, double 0xB99B1AFDB6458798, double 0x39749E3162EE7273]
@DBL_EPSILON = global double 0.000000e+00
define double @log1p(double %0) {
%2 = alloca [43 x double]
%3 = bitcast [43 x double]* %2 to i8*
%4 = fcmp oeq double %0, 0.000000e+00
br i1 %4, label %38, label %5
5: ; preds = %1
%6 = fcmp oeq double %0, -1.000000e+00
br i1 %6, label %38, label %7
7: ; preds = %5
%8 = fcmp olt double %0, -1.000000e+00
br i1 %8, label %38, label %9
9: ; preds = %7
%10 = tail call double @llvm.fabs.f64(double %0)
%11 = fcmp ugt double %10, 3.750000e-01
br i1 %11, label %34, label %12
12: ; preds = %9
%13 = load double, double* @DBL_EPSILON
%14 = fmul double %13, 5.000000e-01
%15 = fcmp olt double %10, %14
br i1 %15, label %38, label %16
16: ; preds = %12
%17 = fcmp ogt double %0, 0.000000e+00
%18 = fcmp olt double %0, 1.000000e-08
%19 = and i1 %17, %18
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = fcmp ogt double %0, -1.000000e-09
%22 = fcmp olt double %0, 0.000000e+00
%23 = and i1 %21, %22
br i1 %23, label %24, label %27
24: ; preds = %20, %16
%25 = tail call double @llvm.fmuladd.f64(double %0, double -5.000000e-01, double 1.000000e+00)
%26 = fmul double %25, %0
br label %38
27: ; preds = %20
%28 = fdiv double %0, 3.750000e-01
%29 = getelementptr inbounds [43 x double], [43 x double]* %2, i64 0, i64 0
%30 = call double @chebyshev_eval(double %28, double* %29, i32 22)
%31 = fneg double %0
%32 = call double @llvm.fmuladd.f64(double %31, double %30, double 1.000000e+00)
%33 = fmul double %32, %0
br label %38
34: ; preds = %9
%35 = fadd double %0, 1.000000e+00
%36 = fptosi double %35 to i32
%37 = tail call double @log(i32 %36)
br label %38
38: ; preds = %12, %7, %5, %1, %34, %27, %24
%39 = phi double [ %26, %24 ], [ %33, %27 ], [ %37, %34 ], [ 0.000000e+00, %1 ], [ 0x43EFFE0000000000, %5 ], [ 0x43EFFF0000000000, %7 ], [ %0, %12 ]
ret double %39
}