#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 __builtin_inf();
double ldexp2k(double, int);
double mla(double, double, double);
scalar_t__ rintk(double);
__attribute__((visibility("default"))) const double xexp(double d) {
  int q = (int)rintk(
      d * 1.442695040888963407359924681001892137426645954152985934135449406931);
  double s, u;
  s = mla(q, -.69314718055966295651160180568695068359375, d);
  s = mla(q, -.28235290563031577122588448175013436025525412068e-12, s);
  double s2 = s * s, s4 = s2 * s2, s8 = s4 * s4;
  u = mla(
      s8,
      mla(s, (2.08860621107283687536341e-09), (2.51112930892876518610661e-08)),
      mla(s4,
          mla(s2,
              mla(s, (2.75573911234900471893338e-07),
                  (2.75572362911928827629423e-06)),
              mla(s, (2.4801587159235472998791e-05),
                  (0.000198412698960509205564975))),
          mla(s2,
              mla(s, (0.00138888888889774492207962),
                  (0.00833333333331652721664984)),
              mla(s, (0.0416666666666665047591422),
                  (0.166666666666666851703837)))));
  u = mla(u, s, +0.5);
  u = s * s * u + s + 1;
  u = ldexp2k(u, q);
  if (d > 709.78271114955742909217217426)
    u = __builtin_inf();
  if (d < -1000)
    u = 0;
  return u;
}


x86 assembly (clang, -O0):
<xexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xf30(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <rintk@plt>
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xf09(%rip),%xmm1
call   1050 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xee5(%rip),%xmm1
call   1050 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe87(%rip),%xmm1
movsd  0xe87(%rip),%xmm2
call   1050 <mla@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
movsd  0xe44(%rip),%xmm2
call   1050 <mla@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe15(%rip),%xmm1
movsd  0xe15(%rip),%xmm2
call   1050 <mla@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
call   1050 <mla@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xdca(%rip),%xmm1
movsd  0xdca(%rip),%xmm2
call   1050 <mla@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xd9b(%rip),%xmm1
movsd  0xd9b(%rip),%xmm2
call   1050 <mla@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
call   1050 <mla@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
call   1050 <mla@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
call   1050 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xd39(%rip),%xmm2
call   1050 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd03(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1040 <ldexp2k@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xcd3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1344 <xexp+0x214>
movsd  0xd41(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xd3c(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    135f <xexp+0x22f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xexp>:
push   %rbx
sub    $0x50,%rsp
movapd %xmm0,%xmm1
movapd %xmm0,0x40(%rsp)
movsd  0xeb9(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <rintk@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xea0(%rip),%xmm1
movaps 0x40(%rsp),%xmm2
call   1050 <mla@plt>
movapd %xmm0,%xmm2
movsd  0xe92(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1050 <mla@plt>
movsd  %xmm0,0x8(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x30(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x38(%rsp)
movsd  0xe5f(%rip),%xmm1
movsd  0xe5f(%rip),%xmm2
call   1050 <mla@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xe54(%rip),%xmm1
movsd  0xe54(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1050 <mla@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe43(%rip),%xmm1
movsd  0xe43(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1050 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1050 <mla@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe1e(%rip),%xmm1
movsd  0xe1e(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1050 <mla@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0xe0d(%rip),%xmm1
movsd  0xe0d(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1050 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1050 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x30(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1050 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x38(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
call   1050 <mla@plt>
movsd  0xdc6(%rip),%xmm2
movsd  0x8(%rsp),%xmm1
call   1050 <mla@plt>
mulsd  0x18(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
addsd  0xdaf(%rip),%xmm0
mov    %ebx,%edi
call   1040 <ldexp2k@plt>
movsd  0xda8(%rip),%xmm1
movapd 0x40(%rsp),%xmm3
cmpltsd %xmm3,%xmm1
movsd  0xd9d(%rip),%xmm2
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm1,%xmm2
movapd %xmm3,%xmm0
cmpltsd 0xd8c(%rip),%xmm0
andnpd %xmm2,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @xexp(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %2
%9 = load double, double* %2
%10 = fmul double %9, 0x3FF71547652B82FE
%11 = call i64 @rintk(double %10)
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to double
%15 = load double, double* %2
%16 = call double @mla(double %14, double 0xBFE62E42FEFA3000, double %15)
store double %16, double* %4
%17 = load i32, i32* %3
%18 = sitofp i32 %17 to double
%19 = load double, double* %4
%20 = call double @mla(double %18, double 0xBD53DE6AF278ECE6, double %19)
store double %20, double* %4
%21 = load double, double* %4
%22 = load double, double* %4
%23 = fmul double %21, %22
store double %23, double* %6
%24 = load double, double* %6
%25 = load double, double* %6
%26 = fmul double %24, %25
store double %26, double* %7
%27 = load double, double* %7
%28 = load double, double* %7
%29 = fmul double %27, %28
store double %29, double* %8
%30 = load double, double* %8
%31 = load double, double* %4
%32 = call double @mla(double %31, double 0x3E21F0E4C4ECD775, double 0x3E5AF68A28CC800A)
%33 = load double, double* %7
%34 = load double, double* %6
%35 = load double, double* %4
%36 = call double @mla(double %35, double 0x3E927E52E0FCD573, double 0x3EC71DDF1629E6CE)
%37 = load double, double* %4
%38 = call double @mla(double %37, double 0x3EFA01A01780879E, double 0x3F2A01A01B3603F5)
%39 = call double @mla(double %34, double %36, double %38)
%40 = load double, double* %6
%41 = load double, double* %4
%42 = call double @mla(double %41, double 0x3F56C16C16C20BA0, double 0x3F8111111110EB39)
%43 = load double, double* %4
%44 = call double @mla(double %43, double 0x3FA555555555553E, double 0x3FC555555555555C)
%45 = call double @mla(double %40, double %42, double %44)
%46 = call double @mla(double %33, double %39, double %45)
%47 = call double @mla(double %30, double %32, double %46)
store double %47, double* %5
%48 = load double, double* %5
%49 = load double, double* %4
%50 = call double @mla(double %48, double %49, double 5.000000e-01)
store double %50, double* %5
%51 = load double, double* %4
%52 = load double, double* %4
%53 = fmul double %51, %52
%54 = load double, double* %5
%55 = load double, double* %4
%56 = call double @llvm.fmuladd.f64(double %53, double %54, double %55)
%57 = fadd double %56, 1.000000e+00
store double %57, double* %5
%58 = load double, double* %5
%59 = load i32, i32* %3
%60 = call double @ldexp2k(double %58, i32 %59)
store double %60, double* %5
%61 = load double, double* %2
%62 = fcmp ogt double %61, 0x40862E42FE102C83
br i1 %62, label %63, label %64
63: ; preds = %1
store double 0x7FF0000000000000, double* %5
br label %64
64: ; preds = %63, %1
%65 = load double, double* %2
%66 = fcmp olt double %65, -1.000000e+03
br i1 %66, label %67, label %68
67: ; preds = %64
store double 0.000000e+00, double* %5
br label %68
68: ; preds = %67, %64
%69 = load double, double* %5
ret double %69
}

LLVM IR (-O2):
define double @xexp(double %0) {
%2 = fmul double %0, 0x3FF71547652B82FE
%3 = tail call i64 @rintk(double %2)
%4 = trunc i64 %3 to i32
%5 = sitofp i32 %4 to double
%6 = tail call double @mla(double %5, double 0xBFE62E42FEFA3000, double %0)
%7 = tail call double @mla(double %5, double 0xBD53DE6AF278ECE6, double %6)
%8 = fmul double %7, %7
%9 = fmul double %8, %8
%10 = fmul double %9, %9
%11 = tail call double @mla(double %7, double 0x3E21F0E4C4ECD775, double 0x3E5AF68A28CC800A)
%12 = tail call double @mla(double %7, double 0x3E927E52E0FCD573, double 0x3EC71DDF1629E6CE)
%13 = tail call double @mla(double %7, double 0x3EFA01A01780879E, double 0x3F2A01A01B3603F5)
%14 = tail call double @mla(double %8, double %12, double %13)
%15 = tail call double @mla(double %7, double 0x3F56C16C16C20BA0, double 0x3F8111111110EB39)
%16 = tail call double @mla(double %7, double 0x3FA555555555553E, double 0x3FC555555555555C)
%17 = tail call double @mla(double %8, double %15, double %16)
%18 = tail call double @mla(double %9, double %14, double %17)
%19 = tail call double @mla(double %10, double %11, double %18)
%20 = tail call double @mla(double %19, double %7, double 5.000000e-01)
%21 = tail call double @llvm.fmuladd.f64(double %8, double %20, double %7)
%22 = fadd double %21, 1.000000e+00
%23 = tail call double @ldexp2k(double %22, i32 %4)
%24 = fcmp ogt double %0, 0x40862E42FE102C83
%25 = select i1 %24, double 0x7FF0000000000000, double %23
%26 = fcmp olt double %0, -1.000000e+03
%27 = select i1 %26, double 0.000000e+00, double %25
ret double %27
}