#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 const exp(double const);
double fmod(double, double);
double const log(double);
double exptl(double x) {
  const double u = fmod(x, 6.28318530717958647693);
  static const double roundness = 0.00001;
  return roundness *
             exp(((u < 3.14159265358979323846) ? u
                                               : (6.28318530717958647693 - u)) *
                 log(1.0 / roundness) / 3.14159265358979323846) *
             2.0 -
         1.0;
}


x86 assembly (clang, -O0):
<exptl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xea4(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1176 <exptl+0x46>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1188 <exptl+0x58>
movsd  0xe8a(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe86(%rip),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe4d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe51(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
movsd  0xe39(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exptl>:
push   %rax
movsd  0xed7(%rip),%xmm1
call   1030 <fmod@plt>
movsd  0xeca(%rip),%xmm3
subsd  %xmm0,%xmm3
movsd  0xec6(%rip),%xmm1
movapd %xmm0,%xmm2
cmpltsd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm3,%xmm2
orpd   %xmm2,%xmm0
mulsd  0xeb1(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
mulsd  0xea8(%rip),%xmm0
addsd  %xmm0,%xmm0
addsd  0xea4(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@exptl.roundness = internal constant double 1.000000e-05
define double @exptl(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @fmod(double %4, double 0x401921FB54442D18)
store double %5, double* %3
%6 = load double, double* %3
%7 = fcmp olt double %6, 0x400921FB54442D18
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load double, double* %3
br label %13
10: ; preds = %1
%11 = load double, double* %3
%12 = fsub double 0x401921FB54442D18, %11
br label %13
13: ; preds = %10, %8
%14 = phi double [ %9, %8 ], [ %12, %10 ]
%15 = call double @log(double 0x40F869FFFFFFFFFF)
%16 = fmul double %14, %15
%17 = fdiv double %16, 0x400921FB54442D18
%18 = call double @exp(double %17)
%19 = fmul double 1.000000e-05, %18
%20 = call double @llvm.fmuladd.f64(double %19, double 2.000000e+00, double -1.000000e+00)
ret double %20
}

LLVM IR (-O2):
define double @exptl(double %0) {
%2 = tail call double @fmod(double %0, double 0x401921FB54442D18)
%3 = fcmp olt double %2, 0x400921FB54442D18
%4 = fsub double 0x401921FB54442D18, %2
%5 = select i1 %3, double %2, double %4
%6 = fmul double %5, 0x4027069E2AA2AA5B
%7 = fdiv double %6, 0x400921FB54442D18
%8 = tail call double @exp(double %7)
%9 = fmul double %8, 1.000000e-05
%10 = tail call double @llvm.fmuladd.f64(double %9, double 2.000000e+00, double -1.000000e+00)
ret double %10
}