#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 erf(double);
double sqrt(double);
double err_mod_func(double n_sub, double ind, double nu) {
  double center, func;
  if (nu == 0.0)
    nu = 1e-14;
  if (n_sub == 0.0)
    n_sub = 1.0;
  center = n_sub / 2.0;
  ind -= center;
  ind /= center;
  nu /= sqrt(2.0);
  ind *= nu;
  func = erf(ind) / erf(nu) / 2.0;
  func += 0.5;
  return func;
}


x86 assembly (clang, -O0):
<err_mod_func>:
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    115c <err_mod_func+0x3c>
jp     115c <err_mod_func+0x3c>
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1181 <err_mod_func+0x61>
jp     1181 <err_mod_func+0x61>
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe53(%rip),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <erf@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <erf@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe01(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xde8(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_mod_func>:
sub    $0x18,%rsp
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm2
movsd  0xedc(%rip),%xmm4
movapd %xmm0,%xmm3
mulsd  %xmm4,%xmm3
cmpeqsd %xmm5,%xmm0
movapd %xmm0,%xmm5
andnpd %xmm3,%xmm5
andpd  %xmm4,%xmm0
orpd   %xmm5,%xmm0
subsd  %xmm0,%xmm1
divsd  %xmm0,%xmm1
jne    1157 <err_mod_func+0x47>
jp     1157 <err_mod_func+0x47>
movsd  0xeb3(%rip),%xmm2
jmp    115f <err_mod_func+0x4f>
divsd  0xeb1(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
call   1030 <erf@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <erf@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xe6b(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @err_mod_func(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 %17, 2.000000e+00
store double %18, double* %7
%19 = load double, double* %7
%20 = load double, double* %5
%21 = fsub double %20, %19
store double %21, double* %5
%22 = load double, double* %7
%23 = load double, double* %5
%24 = fdiv double %23, %22
store double %24, double* %5
%25 = call double @sqrt(double 2.000000e+00)
%26 = load double, double* %6
%27 = fdiv double %26, %25
store double %27, double* %6
%28 = load double, double* %6
%29 = load double, double* %5
%30 = fmul double %29, %28
store double %30, double* %5
%31 = load double, double* %5
%32 = call double @erf(double %31)
%33 = load double, double* %6
%34 = call double @erf(double %33)
%35 = fdiv double %32, %34
%36 = fdiv double %35, 2.000000e+00
store double %36, double* %8
%37 = load double, double* %8
%38 = fadd double %37, 5.000000e-01
store double %38, double* %8
%39 = load double, double* %8
ret double %39
}

LLVM IR (-O2):
define double @err_mod_func(double %0, double %1, double %2) {
%4 = fcmp oeq double %2, 0.000000e+00
%5 = fcmp oeq double %0, 0.000000e+00
%6 = fmul double %0, 5.000000e-01
%7 = select i1 %5, double 5.000000e-01, double %6
%8 = fsub double %1, %7
%9 = fdiv double %8, %7
%10 = fdiv double %2, 0x3FF6A09E667F3BCD
%11 = select i1 %4, double 0x3CFFD862DA202956, double %10
%12 = fmul double %9, %11
%13 = tail call double @erf(double %12)
%14 = tail call double @erf(double %11)
%15 = fdiv double %13, %14
%16 = fmul double %15, 5.000000e-01
%17 = fadd double %16, 5.000000e-01
ret double %17
}