double cdflib_dinvnr(double *p, double *q) {
  enum { maxit = 100 };
  static const double eps = 1.0e-13;
  static const double r2pi = 0.3989422804014326e0;
  static const double nhalf = -0.5e0;
  double dinvnr, strtx, xcur, cum, ccum, pp, dx;
  int i;
  unsigned long qporq;
  qporq = *p <= *q;
  if (!qporq) {
    goto S10;
  }
  pp = *p;
  goto S20;
S10:
  pp = *q;
S20:
  strtx = cdflib_stvaln(&pp);
  xcur = strtx;
  for (i = 1; i <= maxit; i++) {
    cdflib_cumnor(&xcur, &cum, &ccum);
    dx = (cum - pp) / (r2pi * exp(nhalf * (xcur) * (xcur)));
    xcur -= dx;
    if (fabs(dx / xcur) < eps) {
      goto S40;
    }
  }
  dinvnr = strtx;
  if (!qporq) {
    dinvnr = -dinvnr;
  }
  return dinvnr;
S40:
  dinvnr = xcur;
  if (!qporq) {
    dinvnr = -dinvnr;
  }
  return dinvnr;
}


x86 assembly (clang, -O0):
<cdflib_dinvnr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1172 <cdflib_dinvnr+0x42>
jmp    1184 <cdflib_dinvnr+0x54>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1191 <cdflib_dinvnr+0x61>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x48(%rbp),%rdi
mov    $0x0,%al
call   1040 <cdflib_stvaln@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x54(%rbp)
cmpl   $0x64,-0x54(%rbp)
jg     1268 <cdflib_dinvnr+0x138>
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1030 <cdflib_cumnor@plt>
movsd  -0x38(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe26(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
movsd  0xdff(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
movaps 0xde6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdba(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1255 <cdflib_dinvnr+0x125>
jmp    12ad <cdflib_dinvnr+0x17d>
jmp    125a <cdflib_dinvnr+0x12a>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11b6 <cdflib_dinvnr+0x86>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    129e <cdflib_dinvnr+0x16e>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12ed <cdflib_dinvnr+0x1bd>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    12e3 <cdflib_dinvnr+0x1b3>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_dinvnr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movapd %xmm0,%xmm2
cmplesd %xmm1,%xmm2
andpd  %xmm2,%xmm0
movapd %xmm2,0x20(%rsp)
andnpd %xmm1,%xmm2
orpd   %xmm0,%xmm2
movlpd %xmm2,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1040 <cdflib_stvaln@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  %xmm0,(%rsp)
mov    $0x64,%ebp
mov    %rsp,%r14
lea    0x18(%rsp),%r15
lea    0x40(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <cdflib_cumnor@plt>
movsd  0x18(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movapd %xmm0,0x30(%rsp)
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  0xe2d(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <exp@plt>
mulsd  0xe24(%rip),%xmm0
movapd 0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rsp),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
divsd  %xmm2,%xmm1
andpd  0xe18(%rip),%xmm1
movsd  0xe00(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1221 <cdflib_dinvnr+0xf1>
add    $0xffffffff,%ebp
jne    11a0 <cdflib_dinvnr+0x70>
movsd  0x10(%rsp),%xmm2
movapd 0x20(%rsp),%xmm0
movapd %xmm0,%xmm1
andpd  %xmm2,%xmm1
xorpd  0xdf9(%rip),%xmm2
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@cdflib_dinvnr.eps = internal constant double 1.000000e-13
@cdflib_dinvnr.r2pi = internal constant double 0x3FD9884533D4364F
@cdflib_dinvnr.nhalf = internal constant double -5.000000e-01
define double @cdflib_dinvnr(double* %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca i64
store double* %0, double** %4
store double* %1, double** %5
%15 = load double*, double** %4
%16 = load double, double* %15
%17 = load double*, double** %5
%18 = load double, double* %17
%19 = fcmp ole double %16, %18
%20 = zext i1 %19 to i32
%21 = sext i32 %20 to i64
store i64 %21, i64* %14
%22 = load i64, i64* %14
%23 = icmp ne i64 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %2
br label %28
25: ; preds = %2
%26 = load double*, double** %4
%27 = load double, double* %26
store double %27, double* %11
br label %31
28: ; preds = %24
%29 = load double*, double** %5
%30 = load double, double* %29
store double %30, double* %11
br label %31
31: ; preds = %28, %25
%32 = call i32 (double*, ...) bitcast (i32 (...)* @cdflib_stvaln to i32 (double*, ...)*)(double* %11)
%33 = sitofp i32 %32 to double
store double %33, double* %7
%34 = load double, double* %7
store double %34, double* %8
store i32 1, i32* %13
br label %35
35: ; preds = %60, %31
%36 = load i32, i32* %13
%37 = icmp sle i32 %36, 100
br i1 %37, label %38, label %63
38: ; preds = %35
%39 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @cdflib_cumnor to i32 (double*, double*, double*, ...)*)(double* %8, double* %9, double* %10)
%40 = load double, double* %9
%41 = load double, double* %11
%42 = fsub double %40, %41
%43 = load double, double* %8
%44 = fmul double -5.000000e-01, %43
%45 = load double, double* %8
%46 = fmul double %44, %45
%47 = call double @exp(double %46)
%48 = fmul double 0x3FD9884533D4364F, %47
%49 = fdiv double %42, %48
store double %49, double* %12
%50 = load double, double* %12
%51 = load double, double* %8
%52 = fsub double %51, %50
store double %52, double* %8
%53 = load double, double* %12
%54 = load double, double* %8
%55 = fdiv double %53, %54
%56 = call double @llvm.fabs.f64(double %55)
%57 = fcmp olt double %56, 1.000000e-13
br i1 %57, label %58, label %59
58: ; preds = %38
br label %72
59: ; preds = %38
br label %60
60: ; preds = %59
%61 = load i32, i32* %13
%62 = add nsw i32 %61, 1
store i32 %62, i32* %13
br label %35
63: ; preds = %35
%64 = load double, double* %7
store double %64, double* %6
%65 = load i64, i64* %14
%66 = icmp ne i64 %65, 0
br i1 %66, label %70, label %67
67: ; preds = %63
%68 = load double, double* %6
%69 = fneg double %68
store double %69, double* %6
br label %70
70: ; preds = %67, %63
%71 = load double, double* %6
store double %71, double* %3
br label %81
72: ; preds = %58
%73 = load double, double* %8
store double %73, double* %6
%74 = load i64, i64* %14
%75 = icmp ne i64 %74, 0
br i1 %75, label %79, label %76
76: ; preds = %72
%77 = load double, double* %6
%78 = fneg double %77
store double %78, double* %6
br label %79
79: ; preds = %76, %72
%80 = load double, double* %6
store double %80, double* %3
br label %81
81: ; preds = %79, %70
%82 = load double, double* %3
ret double %82
}

LLVM IR (-O2):
define double @cdflib_dinvnr(double* nocapture %0, double* nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = bitcast double* %6 to i8*
%11 = load double, double* %0
%12 = load double, double* %1
%13 = fcmp ole double %11, %12
%14 = select i1 %13, double %11, double %12
store double %14, double* %6
%15 = call i32 (double*, ...) bitcast (i32 (...)* @cdflib_stvaln to i32 (double*, ...)*)(double* %6)
%16 = sitofp i32 %15 to double
store double %16, double* %3
br label %20
17: ; preds = %20
%18 = add nuw nsw i32 %21, 1
%19 = icmp eq i32 %18, 101
br i1 %19, label %37, label %20
20: ; preds = %2, %17
%21 = phi i32 [ 1, %2 ], [ %18, %17 ]
%22 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @cdflib_cumnor to i32 (double*, double*, double*, ...)*)(double* %3, double* %4, double* %5)
%23 = load double, double* %4
%24 = load double, double* %6
%25 = fsub double %23, %24
%26 = load double, double* %3
%27 = fmul double %26, -5.000000e-01
%28 = fmul double %26, %27
%29 = call double @exp(double %28)
%30 = fmul double %29, 0x3FD9884533D4364F
%31 = fdiv double %25, %30
%32 = load double, double* %3
%33 = fsub double %32, %31
store double %33, double* %3
%34 = fdiv double %31, %33
%35 = call double @llvm.fabs.f64(double %34)
%36 = fcmp olt double %35, 1.000000e-13
br i1 %36, label %37, label %17
37: ; preds = %20, %17
%38 = phi double [ %16, %17 ], [ %33, %20 ]
%39 = fneg double %38
%40 = select i1 %13, double %38, double %39
ret double %40
}