#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 ldexpk(double, int);
double mla(double, double, double);
scalar_t__ xisminf(double);
scalar_t__ xrint(double);
double xexp(double d) {
  int q = (int)xrint(
      d * 1.442695040888963407359924681001892137426645954152985934135449406931);
  double s, u;
  s = mla(q, -.69314718055966295651160180568695068359375, d);
  s = mla(q, -.28235290563031577122588448175013436025525412068e-12, s);
  u = 2.08860621107283687536341e-09;
  u = mla(u, s, 2.51112930892876518610661e-08);
  u = mla(u, s, 2.75573911234900471893338e-07);
  u = mla(u, s, 2.75572362911928827629423e-06);
  u = mla(u, s, 2.4801587159235472998791e-05);
  u = mla(u, s, 0.000198412698960509205564975);
  u = mla(u, s, 0.00138888888889774492207962);
  u = mla(u, s, 0.00833333333331652721664984);
  u = mla(u, s, 0.0416666666666665047591422);
  u = mla(u, s, 0.166666666666666851703837);
  u = mla(u, s, 0.5);
  u = s * s * u + s + 1;
  u = ldexpk(u, q);
  if (xisminf(d))
    u = 0;
  return u;
}


x86 assembly (clang, -O0):
<xexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xf1b(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <xrint@plt>
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xef4(%rip),%xmm1
call   1060 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xed0(%rip),%xmm1
call   1060 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe97(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe73(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe4f(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe2b(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe07(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xde3(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xdbf(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xd9b(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xd77(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xd53(%rip),%xmm2
call   1060 <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  0xd1d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <ldexpk@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <xisminf@plt>
cmp    $0x0,%rax
je     131a <xexp+0x1da>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xexp>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
movsd  0xea9(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <xrint@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe91(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
call   1060 <mla@plt>
movapd %xmm0,%xmm2
movsd  0xe82(%rip),%xmm1
movsd  (%rsp),%xmm0
call   1060 <mla@plt>
movaps %xmm0,%xmm1
movsd  %xmm0,(%rsp)
movsd  0xe70(%rip),%xmm0
movsd  0xe70(%rip),%xmm2
call   1060 <mla@plt>
movsd  0xe6b(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe61(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe57(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe4d(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe43(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe39(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe2f(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe25(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  0xe1b(%rip),%xmm2
movsd  (%rsp),%xmm1
call   1060 <mla@plt>
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
addsd  0xdfc(%rip),%xmm0
mov    %ebx,%edi
call   1030 <ldexpk@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <xisminf@plt>
movsd  (%rsp),%xmm0
test   %rax,%rax
je     1298 <xexp+0x158>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define double @xexp(double %0) {
%2 = fmul double %0, 0x3FF71547652B82FE
%3 = tail call i64 @xrint(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 = tail call double @mla(double 0x3E21F0E4C4ECD775, double %7, double 0x3E5AF68A28CC800A)
%9 = tail call double @mla(double %8, double %7, double 0x3E927E52E0FCD573)
%10 = tail call double @mla(double %9, double %7, double 0x3EC71DDF1629E6CE)
%11 = tail call double @mla(double %10, double %7, double 0x3EFA01A01780879E)
%12 = tail call double @mla(double %11, double %7, double 0x3F2A01A01B3603F5)
%13 = tail call double @mla(double %12, double %7, double 0x3F56C16C16C20BA0)
%14 = tail call double @mla(double %13, double %7, double 0x3F8111111110EB39)
%15 = tail call double @mla(double %14, double %7, double 0x3FA555555555553E)
%16 = tail call double @mla(double %15, double %7, double 0x3FC555555555555C)
%17 = tail call double @mla(double %16, double %7, double 5.000000e-01)
%18 = fmul double %7, %7
%19 = tail call double @llvm.fmuladd.f64(double %18, double %17, double %7)
%20 = fadd double %19, 1.000000e+00
%21 = tail call double @ldexpk(double %20, i32 %4)
%22 = tail call i64 @xisminf(double %0)
%23 = icmp eq i64 %22, 0
%24 = select i1 %23, double %21, double 0.000000e+00
ret double %24
}