#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 exp_r(double n_sub, double ind, double nu) {
  double bin_size, func;
  if (nu == 0.0)
    nu = 1e-14;
  if (n_sub == 0.0)
    n_sub = 1.0;
  bin_size = 1.0 / n_sub;
  ind *= bin_size;
  func = 1.0 - exp(-nu * ind);
  func /= (1.0 - exp(-nu));
  return func;
}


x86 assembly (clang, -O0):
<exp_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114c <exp_r+0x3c>
jp     114c <exp_r+0x3c>
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1171 <exp_r+0x61>
jp     1171 <exp_r+0x61>
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe8f(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe45(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  0xe13(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp_r>:
sub    $0x28,%rsp
xorpd  %xmm3,%xmm3
movapd %xmm2,%xmm5
cmpeqsd %xmm3,%xmm5
movsd  0xed7(%rip),%xmm4
andpd  %xmm5,%xmm4
andnpd %xmm2,%xmm5
orpd   %xmm4,%xmm5
movsd  0xecb(%rip),%xmm2
ucomisd %xmm3,%xmm0
jne    1145 <exp_r+0x35>
jnp    1151 <exp_r+0x41>
movsd  0xebb(%rip),%xmm2
divsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
xorpd  0xeb3(%rip),%xmm5
movapd %xmm5,0x10(%rsp)
movapd %xmm5,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
movsd  0xe90(%rip),%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0xe73(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define double @exp_r(double %0, double %1, double %2) {
%4 = fcmp oeq double %2, 0.000000e+00
%5 = select i1 %4, double 0x3D06849B86A12B9B, double %2
%6 = fcmp oeq double %0, 0.000000e+00
%7 = fdiv double 1.000000e+00, %0
%8 = select i1 %6, double 1.000000e+00, double %7
%9 = fmul double %8, %1
%10 = fneg double %5
%11 = fmul double %9, %10
%12 = tail call double @exp(double %11)
%13 = fsub double 1.000000e+00, %12
%14 = tail call double @exp(double %10)
%15 = fsub double 1.000000e+00, %14
%16 = fdiv double %13, %15
ret double %16
}