#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 const);
double pow(int, int);
double gexp(const double r, const double x) {
  if (r == 0.0) {
    return (exp(x));
  } else {
    if (r < 0.0)
      return (pow(1 / (1 + r * x), -1 / r));
    else
      return (pow(1 + r * x, 1 / r));
  }
}


x86 assembly (clang, -O0):
<gexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115e <gexp+0x3e>
jp     115e <gexp+0x3e>
movsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11ef <gexp+0xcf>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11b6 <gexp+0x96>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe7e(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe72(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe6a(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%esi
call   1040 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11ef <gexp+0xcf>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe34(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe24(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%esi
call   1040 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gexp>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jne    1134 <gexp+0x14>
jp     1134 <gexp+0x14>
movaps %xmm1,%xmm0
jmp    1030 <exp@plt>
ucomisd %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  0xebc(%rip),%xmm1
jbe    1160 <gexp+0x40>
movsd  0xeb2(%rip),%xmm2
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%edi
movsd  0xeaa(%rip),%xmm1
jmp    116c <gexp+0x4c>
cvttsd2si %xmm1,%edi
movsd  0xe94(%rip),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%esi
jmp    1040 <pow@plt>

LLVM IR (-O0):
define double @gexp(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load double, double* %5
%10 = call double @exp(double %9)
store double %10, double* %3
br label %33
11: ; preds = %2
%12 = load double, double* %4
%13 = fcmp olt double %12, 0.000000e+00
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load double, double* %4
%16 = load double, double* %5
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double 1.000000e+00)
%18 = fdiv double 1.000000e+00, %17
%19 = fptosi double %18 to i32
%20 = load double, double* %4
%21 = fdiv double -1.000000e+00, %20
%22 = fptosi double %21 to i32
%23 = call double @pow(i32 %19, i32 %22)
store double %23, double* %3
br label %33
24: ; preds = %11
%25 = load double, double* %4
%26 = load double, double* %5
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double 1.000000e+00)
%28 = fptosi double %27 to i32
%29 = load double, double* %4
%30 = fdiv double 1.000000e+00, %29
%31 = fptosi double %30 to i32
%32 = call double @pow(i32 %28, i32 %31)
store double %32, double* %3
br label %33
33: ; preds = %24, %14, %8
%34 = load double, double* %3
ret double %34
}

LLVM IR (-O2):
define double @gexp(double %0, double %1) {
%3 = fcmp oeq double %0, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call double @exp(double %1)
br label %20
6: ; preds = %2
%7 = fcmp olt double %0, 0.000000e+00
%8 = tail call double @llvm.fmuladd.f64(double %0, double %1, double 1.000000e+00)
br i1 %7, label %9, label %15
9: ; preds = %6
%10 = fdiv double 1.000000e+00, %8
%11 = fptosi double %10 to i32
%12 = fdiv double -1.000000e+00, %0
%13 = fptosi double %12 to i32
%14 = tail call double @pow(i32 %11, i32 %13)
br label %20
15: ; preds = %6
%16 = fptosi double %8 to i32
%17 = fdiv double 1.000000e+00, %0
%18 = fptosi double %17 to i32
%19 = tail call double @pow(i32 %16, i32 %18)
br label %20
20: ; preds = %15, %9, %4
%21 = phi double [ %5, %4 ], [ %14, %9 ], [ %19, %15 ]
ret double %21
}