#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 cdflib_alnrel(double *);
double cdflib_eval_pol(double const *, int const *, double *);
int /*<<< orphan*/ cdflib_ftnstop(char *);
double fabs(double);
double const log(double);
double cdflib_dlanor(double *x) {
  static const double dlsqpi = 0.91893853320467274177e0;
  static const double coef[12] = {
      -1.0e0,        3.0e0,         -15.0e0,         105.0e0,
      -945.0e0,      10395.0e0,     -135135.0e0,     2027025.0e0,
      -34459425.0e0, 654729075.0e0, -13749310575.e0, 316234143225.0e0};
  static const int K1 = 12;
  double dlanor, approx, correc, xx, xx2, T2;
  xx = fabs(*x);
  if (xx < 5.0e0) {
    cdflib_ftnstop(" Argument too small in DLANOR");
  }
  approx = -dlsqpi - 0.5e0 * xx * xx - log(xx);
  xx2 = xx * xx;
  T2 = 1.0e0 / xx2;
  correc = cdflib_eval_pol(coef, &K1, &T2) / xx2;
  correc = cdflib_alnrel(&correc);
  dlanor = approx + correc;
  return dlanor;
}


x86 assembly (clang, -O0):
<cdflib_dlanor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movaps 0xec5(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe94(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1183 <cdflib_dlanor+0x43>
lea    0xf26(%rip),%rdi
call   1040 <cdflib_ftnstop@plt>
movsd  0xe8d(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe58(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe15(%rip),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe3c(%rip),%rdi
lea    0xe95(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1050 <cdflib_eval_pol@plt>
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <cdflib_alnrel@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_dlanor>:
sub    $0x38,%rsp
movsd  (%rdi),%xmm1
movapd 0xeb0(%rip),%xmm0
movapd %xmm1,0x10(%rsp)
andpd  %xmm1,%xmm0
movsd  0xeae(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    117e <cdflib_dlanor+0x3e>
lea    0xf25(%rip),%rdi
movapd %xmm0,(%rsp)
call   1040 <cdflib_ftnstop@plt>
movapd (%rsp),%xmm0
movsd  0xe92(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe8a(%rip),%xmm1
movsd  %xmm1,(%rsp)
call   1060 <log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd 0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0xe62(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0xe59(%rip),%rdi
lea    0xeb2(%rip),%rsi
lea    0x28(%rsp),%rdx
call   1050 <cdflib_eval_pol@plt>
divsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
call   1030 <cdflib_alnrel@plt>
addsd  (%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
@cdflib_dlanor.dlsqpi = internal constant double 0x3FED67F1C864BEB5
@cdflib_dlanor.coef = internal constant [12 x double] [double -1.000000e+00, double 3.000000e+00, double -1.500000e+01, double 1.050000e+02, double -9.450000e+02, double 1.039500e+04, double -1.351350e+05, double 0x413EEE1100000000, double 0xC1806E7908000000, double 0x41C3832FB9800000, double 0xC2099C2EA3780000, double 0x42526841857E4000]
@cdflib_dlanor.K1 = internal constant i32 12
@.str = [30 x i8] c" Argument too small in DLANOR\00"
define double @cdflib_dlanor(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double* %0, double** %2
%9 = load double*, double** %2
%10 = load double, double* %9
%11 = call double @llvm.fabs.f64(double %10)
store double %11, double* %6
%12 = load double, double* %6
%13 = fcmp olt double %12, 5.000000e+00
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = call i32 @cdflib_ftnstop(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %1
%17 = load double, double* %6
%18 = fmul double 5.000000e-01, %17
%19 = load double, double* %6
%20 = fneg double %18
%21 = call double @llvm.fmuladd.f64(double %20, double %19, double 0xBFED67F1C864BEB5)
%22 = load double, double* %6
%23 = call double @log(double %22)
%24 = fsub double %21, %23
store double %24, double* %4
%25 = load double, double* %6
%26 = load double, double* %6
%27 = fmul double %25, %26
store double %27, double* %7
%28 = load double, double* %7
%29 = fdiv double 1.000000e+00, %28
store double %29, double* %8
%30 = call double @cdflib_eval_pol(double* getelementptr inbounds ([12 x double], [12 x double]* @cdflib_dlanor.coef, i64 0, i64 0), i32* @cdflib_dlanor.K1, double* %8)
%31 = load double, double* %7
%32 = fdiv double %30, %31
store double %32, double* %5
%33 = call double @cdflib_alnrel(double* %5)
store double %33, double* %5
%34 = load double, double* %4
%35 = load double, double* %5
%36 = fadd double %34, %35
store double %36, double* %3
%37 = load double, double* %3
ret double %37
}

LLVM IR (-O2):
@cdflib_dlanor.coef = internal constant [12 x double] [double -1.000000e+00, double 3.000000e+00, double -1.500000e+01, double 1.050000e+02, double -9.450000e+02, double 1.039500e+04, double -1.351350e+05, double 0x413EEE1100000000, double 0xC1806E7908000000, double 0x41C3832FB9800000, double 0xC2099C2EA3780000, double 0x42526841857E4000]
@cdflib_dlanor.K1 = internal constant i32 12
@.str = [30 x i8] c" Argument too small in DLANOR\00"
define double @cdflib_dlanor(double* nocapture %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
%5 = bitcast double* %3 to i8*
%6 = load double, double* %0
%7 = tail call double @llvm.fabs.f64(double %6)
%8 = fcmp olt double %7, 5.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = tail call i32 @cdflib_ftnstop(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = fmul double %7, -5.000000e-01
%13 = tail call double @llvm.fmuladd.f64(double %12, double %7, double 0xBFED67F1C864BEB5)
%14 = tail call double @log(double %7)
%15 = fsub double %13, %14
%16 = fmul double %6, %6
%17 = fdiv double 1.000000e+00, %16
store double %17, double* %3
%18 = call double @cdflib_eval_pol(double* getelementptr inbounds ([12 x double], [12 x double]* @cdflib_dlanor.coef, i64 0, i64 0), i32* @cdflib_dlanor.K1, double* %3)
%19 = fdiv double %18, %16
store double %19, double* %2
%20 = call double @cdflib_alnrel(double* %2)
%21 = fadd double %15, %20
ret double %21
}