#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 exp(double);
double fabs(double);
double rexp(double *x) {
  static double p1 = .914041914819518e-09;
  static double p2 = .238082361044469e-01;
  static double q1 = -.499999999085958e+00;
  static double q2 = .107141568980644e+00;
  static double q3 = -.119041179760821e-01;
  static double q4 = .595130811860248e-03;
  static double rexp, w;
  if (fabs(*x) > 0.15e0)
    goto S10;
  rexp = *x * (((p2 * *x + p1) * *x + 1.0e0) /
               ((((q4 * *x + q3) * *x + q2) * *x + q1) * *x + 1.0e0));
  return rexp;
S10:
  w = exp(*x);
  if (*x > 0.0e0)
    goto S20;
  rexp = w - 0.5e0 - 0.5e0;
  return rexp;
S20:
  rexp = w * (0.5e0 + (0.5e0 - 1.0e0 / w));
  return rexp;
}


x86 assembly (clang, -O0):
<rexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movaps 0xef5(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xec9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1146 <rexp+0x36>
jmp    1210 <rexp+0x100>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x2eda(%rip),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm3
movsd  0x2ec2(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe86(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0x2ec2(%rip),%xmm2
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm4
movsd  0x2eaa(%rip),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm4
movsd  0x2e8a(%rip),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm4
movsd  0x2e6a(%rip),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe1e(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x2e62(%rip)
movsd  0x2e5a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c2 <rexp+0x1b2>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x2e43(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    123f <rexp+0x12f>
jmp    1279 <rexp+0x169>
movsd  0x2e21(%rip),%xmm0
movsd  0xdc1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdb5(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2df9(%rip)
movsd  0x2df1(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c2 <rexp+0x1b2>
movsd  0x2de7(%rip),%xmm0
movsd  0xd7f(%rip),%xmm1
divsd  0x2dd7(%rip),%xmm1
movsd  0xd77(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  0xd6b(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x2dab(%rip)
movsd  0x2da3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rexp>:
push   %rbx
movsd  (%rdi),%xmm1
movapd 0xee3(%rip),%xmm0
andpd  %xmm1,%xmm0
ucomisd 0xf17(%rip),%xmm0
jbe    1167 <rexp+0x57>
mov    %rdi,%rbx
movapd %xmm1,%xmm0
call   1030 <exp@plt>
movsd  (%rbx),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jbe    11cd <rexp+0xbd>
movsd  0xf17(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xf13(%rip),%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
jmp    11c7 <rexp+0xb7>
movsd  0xed9(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xed5(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xed1(%rip),%xmm0
movapd %xmm1,%xmm2
unpcklpd %xmm0,%xmm2
movapd 0xe79(%rip),%xmm3
unpcklpd %xmm1,%xmm3
mulpd  %xmm2,%xmm3
addpd  0xe79(%rip),%xmm3
movapd %xmm1,%xmm0
unpcklpd %xmm1,%xmm0
mulpd  %xmm3,%xmm0
addpd  0xe75(%rip),%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
divsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
pop    %rbx
ret
movsd  0xe8b(%rip),%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
@rexp.p1 = internal global double 0x3E0F67FF69DA8D77
@rexp.p2 = internal global double 0x3F98612FADC6B3F6
@rexp.q1 = internal global double 0xBFDFFFFFFF04C003
@rexp.q2 = internal global double 0x3FBB6DA13ED061EA
@rexp.q3 = internal global double 0xBF88612FAB28F4E2
@rexp.q4 = internal global double 0x3F438051AFD8141C
@rexp.rexp = internal global double 0.000000e+00
@rexp.w = internal global double 0.000000e+00
define double @rexp(double* %0) {
%2 = alloca double
%3 = alloca double*
store double* %0, double** %3
%4 = load double*, double** %3
%5 = load double, double* %4
%6 = call double @llvm.fabs.f64(double %5)
%7 = fcmp ogt double %6, 1.500000e-01
br i1 %7, label %8, label %9
8: ; preds = %1
br label %39
9: ; preds = %1
%10 = load double*, double** %3
%11 = load double, double* %10
%12 = load double, double* @rexp.p2
%13 = load double*, double** %3
%14 = load double, double* %13
%15 = load double, double* @rexp.p1
%16 = call double @llvm.fmuladd.f64(double %12, double %14, double %15)
%17 = load double*, double** %3
%18 = load double, double* %17
%19 = call double @llvm.fmuladd.f64(double %16, double %18, double 1.000000e+00)
%20 = load double, double* @rexp.q4
%21 = load double*, double** %3
%22 = load double, double* %21
%23 = load double, double* @rexp.q3
%24 = call double @llvm.fmuladd.f64(double %20, double %22, double %23)
%25 = load double*, double** %3
%26 = load double, double* %25
%27 = load double, double* @rexp.q2
%28 = call double @llvm.fmuladd.f64(double %24, double %26, double %27)
%29 = load double*, double** %3
%30 = load double, double* %29
%31 = load double, double* @rexp.q1
%32 = call double @llvm.fmuladd.f64(double %28, double %30, double %31)
%33 = load double*, double** %3
%34 = load double, double* %33
%35 = call double @llvm.fmuladd.f64(double %32, double %34, double 1.000000e+00)
%36 = fdiv double %19, %35
%37 = fmul double %11, %36
store double %37, double* @rexp.rexp
%38 = load double, double* @rexp.rexp
store double %38, double* %2
br label %60
39: ; preds = %8
%40 = load double*, double** %3
%41 = load double, double* %40
%42 = call double @exp(double %41)
store double %42, double* @rexp.w
%43 = load double*, double** %3
%44 = load double, double* %43
%45 = fcmp ogt double %44, 0.000000e+00
br i1 %45, label %46, label %47
46: ; preds = %39
br label %52
47: ; preds = %39
%48 = load double, double* @rexp.w
%49 = fsub double %48, 5.000000e-01
%50 = fsub double %49, 5.000000e-01
store double %50, double* @rexp.rexp
%51 = load double, double* @rexp.rexp
store double %51, double* %2
br label %60
52: ; preds = %46
%53 = load double, double* @rexp.w
%54 = load double, double* @rexp.w
%55 = fdiv double 1.000000e+00, %54
%56 = fsub double 5.000000e-01, %55
%57 = fadd double 5.000000e-01, %56
%58 = fmul double %53, %57
store double %58, double* @rexp.rexp
%59 = load double, double* @rexp.rexp
store double %59, double* %2
br label %60
60: ; preds = %52, %47, %9
%61 = load double, double* %2
ret double %61
}

LLVM IR (-O2):
define double @rexp(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @llvm.fabs.f64(double %2)
%4 = fcmp ogt double %3, 1.500000e-01
br i1 %4, label %18, label %5
5: ; preds = %1
%6 = tail call double @llvm.fmuladd.f64(double %2, double 0x3F438051AFD8141C, double 0xBF88612FAB28F4E2)
%7 = tail call double @llvm.fmuladd.f64(double %6, double %2, double 0x3FBB6DA13ED061EA)
%8 = insertelement <2 x double> poison, double %2, i64 0
%9 = insertelement <2 x double> %8, double %7, i64 1
%10 = insertelement <2 x double> <double 0x3F98612FADC6B3F6, double poison>, double %2, i64 1
%11 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %9, <2 x double> %10, <2 x double> <double 0x3E0F67FF69DA8D77, double 0xBFDFFFFFFF04C003>)
%12 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
%13 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %12, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%14 = extractelement <2 x double> %13, i64 0
%15 = extractelement <2 x double> %13, i64 1
%16 = fdiv double %14, %15
%17 = fmul double %2, %16
br label %30
18: ; preds = %1
%19 = tail call double @exp(double %2)
%20 = load double, double* %0
%21 = fcmp ogt double %20, 0.000000e+00
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = fadd double %19, -5.000000e-01
%24 = fadd double %23, -5.000000e-01
br label %30
25: ; preds = %18
%26 = fdiv double 1.000000e+00, %19
%27 = fsub double 5.000000e-01, %26
%28 = fadd double %27, 5.000000e-01
%29 = fmul double %19, %28
br label %30
30: ; preds = %25, %22, %5
%31 = phi double [ %29, %25 ], [ %24, %22 ], [ %17, %5 ]
ret double %31
}