#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 log(double);
double _pypy_math_expm1(double x) {
  if (fabs(x) < 0.7) {
    double u;
    u = exp(x);
    if (u == 1.0)
      return x;
    else
      return (u - 1.0) * x / log(u);
  } else
    return exp(x) - 1.0;
}


x86 assembly (clang, -O0):
<_pypy_math_expm1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movaps 0xed7(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xebb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c5 <_pypy_math_expm1+0xa5>
movsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe9d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    118a <_pypy_math_expm1+0x6a>
jp     118a <_pypy_math_expm1+0x6a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e0 <_pypy_math_expm1+0xc0>
movsd  -0x18(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
subsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e0 <_pypy_math_expm1+0xc0>
movsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  0xe31(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pypy_math_expm1>:
sub    $0x28,%rsp
movapd 0xed4(%rip),%xmm1
andpd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movapd %xmm0,0x10(%rsp)
call   1030 <exp@plt>
movsd  0xec8(%rip),%xmm1
ucomisd (%rsp),%xmm1
jbe    1165 <_pypy_math_expm1+0x45>
ucomisd 0xec9(%rip),%xmm0
jne    1172 <_pypy_math_expm1+0x52>
jp     1172 <_pypy_math_expm1+0x52>
movaps 0x10(%rsp),%xmm0
add    $0x28,%rsp
ret
addsd  0xeab(%rip),%xmm0
add    $0x28,%rsp
ret
movapd %xmm0,%xmm1
addsd  0xe9a(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
call   1040 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @_pypy_math_expm1(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = call double @llvm.fabs.f64(double %5)
%7 = fcmp olt double %6, 0x3FE6666666666666
br i1 %7, label %8, label %23
8: ; preds = %1
%9 = load double, double* %3
%10 = call double @exp(double %9)
store double %10, double* %4
%11 = load double, double* %4
%12 = fcmp oeq double %11, 1.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = load double, double* %3
store double %14, double* %2
br label %27
15: ; preds = %8
%16 = load double, double* %4
%17 = fsub double %16, 1.000000e+00
%18 = load double, double* %3
%19 = fmul double %17, %18
%20 = load double, double* %4
%21 = call double @log(double %20)
%22 = fdiv double %19, %21
store double %22, double* %2
br label %27
23: ; preds = %1
%24 = load double, double* %3
%25 = call double @exp(double %24)
%26 = fsub double %25, 1.000000e+00
store double %26, double* %2
br label %27
27: ; preds = %23, %15, %13
%28 = load double, double* %2
ret double %28
}

LLVM IR (-O2):
define double @_pypy_math_expm1(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp olt double %2, 0x3FE6666666666666
%4 = tail call double @exp(double %0)
br i1 %3, label %5, label %12
5: ; preds = %1
%6 = fcmp oeq double %4, 1.000000e+00
br i1 %6, label %14, label %7
7: ; preds = %5
%8 = fadd double %4, -1.000000e+00
%9 = fmul double %8, %0
%10 = tail call double @log(double %4)
%11 = fdiv double %9, %10
br label %14
12: ; preds = %1
%13 = fadd double %4, -1.000000e+00
br label %14
14: ; preds = %7, %5, %12
%15 = phi double [ %13, %12 ], [ %11, %7 ], [ %0, %5 ]
ret double %15
}