#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 exp(double);
int /*<<< orphan*/ finite(double);
double log(double);
double pow(double, int);
double sqrt(int);
int nfw_weights(double inlambda, double r0, double beta, long ngal,
                double *ucounts, double *bcounts, double *r, double *w,
                double *p, double *wt, double *rlambda, double *theta_r,
                double rsig, int update_all) {
  double nfwnorm, logrlambda;
  int i;
  double rsig_const;
  rsig_const = 1. / (sqrt(2) * rsig);
  *rlambda = r0 * pow((inlambda / 100.), beta);
  logrlambda = log(*rlambda);
  nfwnorm =
      exp(1.65169 - 0.547850 * logrlambda + 0.138202 * pow(logrlambda, 2) -
          0.0719021 * pow(logrlambda, 3) - 0.0158241 * pow(logrlambda, 4) -
          0.000854985 * pow(logrlambda, 5));
  for (i = 0; i < ngal; i++) {
    if (update_all) {
      p[i] = (inlambda * ucounts[i] * nfwnorm) /
             (inlambda * ucounts[i] * nfwnorm + bcounts[i]);
    }
    if (!finite(p[i]))
      p[i] = 0.0;
    if (rsig <= 0.0) {
      if (r[i] < *rlambda) {
        if (update_all) {
          wt[i] = p[i] * w[i];
        }
        theta_r[i] = 1.0;
      } else {
        wt[i] = 0.0;
      }
    } else {
      if (r[i] < (*rlambda - 5.0 * rsig)) {
        theta_r[i] = 1.0;
      } else if (r[i] > (*rlambda + 5.0 * rsig)) {
        theta_r[i] = 0.0;
      } else {
        theta_r[i] = (0.5 + 0.5 * erf((*rlambda - r[i]) * rsig_const));
      }
      if (update_all) {
        wt[i] = p[i] * w[i] * theta_r[i];
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<nfw_weights>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
movsd  %xmm3,-0x50(%rbp)
mov    $0x2,%edi
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
mulsd  -0x50(%rbp),%xmm1
movsd  0xe88(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si -0x18(%rbp),%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <log@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xe09(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe05(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movsd  -0x90(%rbp),%xmm1
ff
movsd  0xdca(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
mov    $0x3,%edi
call   1050 <pow@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  0xd93(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    $0x4,%edi
call   1050 <pow@plt>
movsd  -0x80(%rbp),%xmm1
movsd  0xd62(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    $0x5,%edi
call   1050 <pow@plt>
movsd  -0x78(%rbp),%xmm1
movsd  0xd31(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1549 <nfw_weights+0x3f9>
cmpl   $0x0,0x28(%rbp)
je     1354 <nfw_weights+0x204>
movsd  -0x8(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movsd  -0x58(%rbp),%xmm3
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xcf8(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xccc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    138e <nfw_weights+0x23e>
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jb     141b <nfw_weights+0x2cb>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1406 <nfw_weights+0x2b6>
cmpl   $0x0,0x28(%rbp)
je     13ec <nfw_weights+0x29c>
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x20(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  0xc3c(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1416 <nfw_weights+0x2c6>
mov    0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1536 <nfw_weights+0x3e6>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  0xc0b(%rip),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1469 <nfw_weights+0x319>
mov    0x20(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  0xbd9(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    14f3 <nfw_weights+0x3a3>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x50(%rbp),%xmm1
movsd  0xbc5(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    14b2 <nfw_weights+0x362>
mov    0x20(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    14ee <nfw_weights+0x39e>
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mulsd  -0x70(%rbp),%xmm0
call   1070 <erf@plt>
movsd  0xb7f(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    14f3 <nfw_weights+0x3a3>
cmpl   $0x0,0x28(%rbp)
je     1531 <nfw_weights+0x3e1>
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
movslq -0x64(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1536 <nfw_weights+0x3e6>
jmp    153b <nfw_weights+0x3eb>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12e8 <nfw_weights+0x198>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfw_weights>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm3,0x20(%rsp)
mov    %r9,%rbx
mov    %r8,0x30(%rsp)
mov    %rcx,%rbp
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r13
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x28(%rsp)
mov    0x98(%rsp),%r14
mov    $0x2,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%rsp),%xmm0
divsd  0xe58(%rip),%xmm0
cvttsd2si 0x8(%rsp),%edi
call   1050 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
call   1040 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe37(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe33(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    $0x2,%edi
call   1050 <pow@plt>
mulsd  0xe23(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x3,%edi
call   1050 <pow@plt>
mulsd  0xe07(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x4,%edi
call   1050 <pow@plt>
mulsd  0xdeb(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x5,%edi
call   1050 <pow@plt>
mulsd  0xdcf(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
mov    0x30(%rsp),%r8
movsd  0x20(%rsp),%xmm4
test   %r13,%r13
jle    14dc <nfw_weights+0x38c>
mov    %r13,%rdx
movapd %xmm0,%xmm8
mov    0xa8(%rsp),%r14d
mov    0xa0(%rsp),%rdi
mov    0x90(%rsp),%rcx
movsd  0x18(%rsp),%xmm1
mulsd  %xmm4,%xmm1
movsd  0xd46(%rip),%xmm6
movapd %xmm6,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %r13d,%r13d
movapd 0xd8d(%rip),%xmm7
movsd  0xd65(%rip),%xmm5
xorpd  %xmm9,%xmm9
movsd  0xd5f(%rip),%xmm10
mulsd  %xmm4,%xmm10
movsd  0xd59(%rip),%xmm11
movsd  0xd00(%rip),%xmm12
mov    %r15,0x50(%rsp)
movsd  %xmm8,0x10(%rsp)
mov    %rbp,0x48(%rsp)
mov    %r12,0x40(%rsp)
mov    %rbx,0x38(%rsp)
movsd  %xmm10,0x18(%rsp)
jmp    1343 <nfw_weights+0x1f3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm2,(%rax,%r13,8)
add    $0x1,%r13
cmp    %r13,%rdx
je     14dc <nfw_weights+0x38c>
test   %r14d,%r14d
je     1370 <nfw_weights+0x220>
movsd  (%r15,%r13,8),%xmm1
mulsd  0x28(%rsp),%xmm1
mulsd  %xmm8,%xmm1
movsd  (%r12,%r13,8),%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%r13,8)
jmp    1376 <nfw_weights+0x226>
nop
movsd  (%rbx,%r13,8),%xmm1
movapd %xmm1,%xmm0
andpd  %xmm7,%xmm0
ucomisd %xmm5,%xmm0
jne    1390 <nfw_weights+0x240>
movq   $0x0,(%rbx,%r13,8)
xorpd  %xmm1,%xmm1
ucomisd %xmm4,%xmm9
movsd  0x0(%rbp,%r13,8),%xmm2
mov    0x98(%rsp),%rax
movsd  (%rax),%xmm0
jae    14a0 <nfw_weights+0x350>
movapd %xmm10,%xmm1
addsd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
movapd %xmm6,%xmm1
ja     1472 <nfw_weights+0x322>
movapd %xmm4,%xmm3
mulsd  %xmm11,%xmm3
addsd  %xmm0,%xmm3
xorpd  %xmm1,%xmm1
ucomisd %xmm3,%xmm2
ja     1472 <nfw_weights+0x322>
subsd  %xmm2,%xmm0
mulsd  0x8(%rsp),%xmm0
mov    %r8,%r12
mov    %rdx,%rbx
mov    %rdi,%r15
mov    %rcx,%rbp
call   1070 <erf@plt>
movsd  0xbfc(%rip),%xmm12
movsd  0xc43(%rip),%xmm11
movsd  0x18(%rsp),%xmm10
xorpd  %xmm9,%xmm9
movsd  0xc1f(%rip),%xmm5
movapd 0xc37(%rip),%xmm7
movsd  0xbcf(%rip),%xmm6
mov    %rbp,%rcx
mov    %r15,%rdi
movsd  0x10(%rsp),%xmm8
mov    %rbx,%rdx
mov    0x38(%rsp),%rbx
mov    %r12,%r8
mov    0x40(%rsp),%r12
mov    0x50(%rsp),%r15
mov    0x48(%rsp),%rbp
movsd  0x20(%rsp),%xmm4
movapd %xmm0,%xmm1
movsd  0xbee(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%r13,8)
test   %r14d,%r14d
je     1336 <nfw_weights+0x1e6>
movsd  (%rbx,%r13,8),%xmm2
mulsd  (%r8,%r13,8),%xmm2
mulsd  %xmm1,%xmm2
mov    %rcx,%rax
jmp    1330 <nfw_weights+0x1e0>
nopl   0x0(%rax)
ucomisd %xmm2,%xmm0
mov    %rdi,%rax
cmovbe %rcx,%rax
cmpnltsd %xmm0,%xmm2
andnpd %xmm12,%xmm2
jbe    1330 <nfw_weights+0x1e0>
test   %r14d,%r14d
je     1330 <nfw_weights+0x1e0>
mulsd  (%r8,%r13,8),%xmm1
movsd  %xmm1,(%rcx,%r13,8)
mov    %rdi,%rax
movapd %xmm6,%xmm2
jmp    1330 <nfw_weights+0x1e0>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @nfw_weights(double %0, double %1, double %2, i64 %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double %12, i32 %13) {
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca i64
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double
%28 = alloca i32
%29 = alloca double
%30 = alloca double
%31 = alloca i32
%32 = alloca double
store double %0, double* %15
store double %1, double* %16
store double %2, double* %17
store i64 %3, i64* %18
store double* %4, double** %19
store double* %5, double** %20
store double* %6, double** %21
store double* %7, double** %22
store double* %8, double** %23
store double* %9, double** %24
store double* %10, double** %25
store double* %11, double** %26
store double %12, double* %27
store i32 %13, i32* %28
%33 = call double @sqrt(i32 2)
%34 = load double, double* %27
%35 = fmul double %33, %34
%36 = fdiv double 1.000000e+00, %35
store double %36, double* %32
%37 = load double, double* %16
%38 = load double, double* %15
%39 = fdiv double %38, 1.000000e+02
%40 = load double, double* %17
%41 = fptosi double %40 to i32
%42 = call double @pow(double %39, i32 %41)
%43 = fmul double %37, %42
%44 = load double*, double** %25
store double %43, double* %44
%45 = load double*, double** %25
%46 = load double, double* %45
%47 = call double @log(double %46)
store double %47, double* %30
%48 = load double, double* %30
%49 = call double @llvm.fmuladd.f64(double -5.478500e-01, double %48, double 1.651690e+00)
%50 = load double, double* %30
%51 = call double @pow(double %50, i32 2)
%52 = call double @llvm.fmuladd.f64(double 1.382020e-01, double %51, double %49)
%53 = load double, double* %30
%54 = call double @pow(double %53, i32 3)
%55 = call double @llvm.fmuladd.f64(double -7.190210e-02, double %54, double %52)
%56 = load double, double* %30
%57 = call double @pow(double %56, i32 4)
%58 = call double @llvm.fmuladd.f64(double -1.582410e-02, double %57, double %55)
%59 = load double, double* %30
%60 = call double @pow(double %59, i32 5)
%61 = call double @llvm.fmuladd.f64(double 0xBF4C04224E897AE8, double %60, double %58)
%62 = call double @exp(double %61)
store double %62, double* %29
store i32 0, i32* %31
br label %63
63: ; preds = %232, %14
%64 = load i32, i32* %31
%65 = sext i32 %64 to i64
%66 = load i64, i64* %18
%67 = icmp slt i64 %65, %66
br i1 %67, label %68, label %235
68: ; preds = %63
%69 = load i32, i32* %28
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %100
71: ; preds = %68
%72 = load double, double* %15
%73 = load double*, double** %19
%74 = load i32, i32* %31
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = load double, double* %76
%78 = fmul double %72, %77
%79 = load double, double* %29
%80 = fmul double %78, %79
%81 = load double, double* %15
%82 = load double*, double** %19
%83 = load i32, i32* %31
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %82, i64 %84
%86 = load double, double* %85
%87 = fmul double %81, %86
%88 = load double, double* %29
%89 = load double*, double** %20
%90 = load i32, i32* %31
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
%93 = load double, double* %92
%94 = call double @llvm.fmuladd.f64(double %87, double %88, double %93)
%95 = fdiv double %80, %94
%96 = load double*, double** %23
%97 = load i32, i32* %31
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %96, i64 %98
store double %95, double* %99
br label %100
100: ; preds = %71, %68
%101 = load double*, double** %23
%102 = load i32, i32* %31
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
%105 = load double, double* %104
%106 = call double @llvm.fabs.f64(double %105)
%107 = fcmp one double %106, 0x7FF0000000000000
br i1 %107, label %113, label %108
108: ; preds = %100
%109 = load double*, double** %23
%110 = load i32, i32* %31
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
store double 0.000000e+00, double* %112
br label %113
113: ; preds = %108, %100
%114 = load double, double* %27
%115 = fcmp ole double %114, 0.000000e+00
br i1 %115, label %116, label %155
116: ; preds = %113
%117 = load double*, double** %21
%118 = load i32, i32* %31
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %117, i64 %119
%121 = load double, double* %120
%122 = load double*, double** %25
%123 = load double, double* %122
%124 = fcmp olt double %121, %123
br i1 %124, label %125, label %149
125: ; preds = %116
%126 = load i32, i32* %28
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %144
128: ; preds = %125
%129 = load double*, double** %23
%130 = load i32, i32* %31
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
%133 = load double, double* %132
%134 = load double*, double** %22
%135 = load i32, i32* %31
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double, double* %134, i64 %136
%138 = load double, double* %137
%139 = fmul double %133, %138
%140 = load double*, double** %24
%141 = load i32, i32* %31
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %140, i64 %142
store double %139, double* %143
br label %144
144: ; preds = %128, %125
%145 = load double*, double** %26
%146 = load i32, i32* %31
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %145, i64 %147
store double 1.000000e+00, double* %148
br label %154
149: ; preds = %116
%150 = load double*, double** %24
%151 = load i32, i32* %31
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %150, i64 %152
store double 0.000000e+00, double* %153
br label %154
154: ; preds = %149, %144
br label %231
155: ; preds = %113
%156 = load double*, double** %21
%157 = load i32, i32* %31
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds double, double* %156, i64 %158
%160 = load double, double* %159
%161 = load double*, double** %25
%162 = load double, double* %161
%163 = load double, double* %27
%164 = call double @llvm.fmuladd.f64(double -5.000000e+00, double %163, double %162)
%165 = fcmp olt double %160, %164
br i1 %165, label %166, label %171
166: ; preds = %155
%167 = load double*, double** %26
%168 = load i32, i32* %31
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %167, i64 %169
store double 1.000000e+00, double* %170
br label %205
171: ; preds = %155
%172 = load double*, double** %21
%173 = load i32, i32* %31
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = load double*, double** %25
%178 = load double, double* %177
%179 = load double, double* %27
%180 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %179, double %178)
%181 = fcmp ogt double %176, %180
br i1 %181, label %182, label %187
182: ; preds = %171
%183 = load double*, double** %26
%184 = load i32, i32* %31
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds double, double* %183, i64 %185
store double 0.000000e+00, double* %186
br label %204
187: ; preds = %171
%188 = load double*, double** %25
%189 = load double, double* %188
%190 = load double*, double** %21
%191 = load i32, i32* %31
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds double, double* %190, i64 %192
%194 = load double, double* %193
%195 = fsub double %189, %194
%196 = load double, double* %32
%197 = fmul double %195, %196
%198 = call double @erf(double %197)
%199 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %198, double 5.000000e-01)
%200 = load double*, double** %26
%201 = load i32, i32* %31
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %200, i64 %202
store double %199, double* %203
br label %204
204: ; preds = %187, %182
br label %205
205: ; preds = %204, %166
%206 = load i32, i32* %28
%207 = icmp ne i32 %206, 0
br i1 %207, label %208, label %230
208: ; preds = %205
%209 = load double*, double** %23
%210 = load i32, i32* %31
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds double, double* %209, i64 %211
%213 = load double, double* %212
%214 = load double*, double** %22
%215 = load i32, i32* %31
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %214, i64 %216
%218 = load double, double* %217
%219 = fmul double %213, %218
%220 = load double*, double** %26
%221 = load i32, i32* %31
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %220, i64 %222
%224 = load double, double* %223
%225 = fmul double %219, %224
%226 = load double*, double** %24
%227 = load i32, i32* %31
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds double, double* %226, i64 %228
store double %225, double* %229
br label %230
230: ; preds = %208, %205
br label %231
231: ; preds = %230, %154
br label %232
232: ; preds = %231
%233 = load i32, i32* %31
%234 = add nsw i32 %233, 1
store i32 %234, i32* %31
br label %63
235: ; preds = %63
ret i32 0
}

LLVM IR (-O2):
define i32 @nfw_weights(double %0, double %1, double %2, i64 %3, double* nocapture %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture %8, double* nocapture writeonly %9, double* nocapture %10, double* nocapture %11, double %12, i32 %13) {
%15 = tail call double @sqrt(i32 2)
%16 = fmul double %15, %12
%17 = fdiv double 1.000000e+00, %16
%18 = fdiv double %0, 1.000000e+02
%19 = fptosi double %2 to i32
%20 = tail call double @pow(double %18, i32 %19)
%21 = fmul double %20, %1
store double %21, double* %10
%22 = tail call double @log(double %21)
%23 = tail call double @llvm.fmuladd.f64(double %22, double -5.478500e-01, double 1.651690e+00)
%24 = tail call double @pow(double %22, i32 2)
%25 = tail call double @llvm.fmuladd.f64(double %24, double 1.382020e-01, double %23)
%26 = tail call double @pow(double %22, i32 3)
%27 = tail call double @llvm.fmuladd.f64(double %26, double -7.190210e-02, double %25)
%28 = tail call double @pow(double %22, i32 4)
%29 = tail call double @llvm.fmuladd.f64(double %28, double -1.582410e-02, double %27)
%30 = tail call double @pow(double %22, i32 5)
%31 = tail call double @llvm.fmuladd.f64(double %30, double 0xBF4C04224E897AE8, double %29)
%32 = tail call double @exp(double %31)
%33 = icmp sgt i64 %3, 0
br i1 %33, label %34, label %100
34: ; preds = %14
%35 = icmp eq i32 %13, 0
%36 = fcmp ugt double %12, 0.000000e+00
br label %37
37: ; preds = %34, %97
%38 = phi i64 [ 0, %34 ], [ %98, %97 ]
br i1 %35, label %39, label %42
39: ; preds = %37
%40 = getelementptr inbounds double, double* %8, i64 %38
%41 = load double, double* %40
br label %52
42: ; preds = %37
%43 = getelementptr inbounds double, double* %4, i64 %38
%44 = load double, double* %43
%45 = fmul double %44, %0
%46 = fmul double %32, %45
%47 = getelementptr inbounds double, double* %5, i64 %38
%48 = load double, double* %47
%49 = tail call double @llvm.fmuladd.f64(double %45, double %32, double %48)
%50 = fdiv double %46, %49
%51 = getelementptr inbounds double, double* %8, i64 %38
store double %50, double* %51
br label %52
52: ; preds = %39, %42
%53 = phi double [ %41, %39 ], [ %50, %42 ]
%54 = getelementptr inbounds double, double* %8, i64 %38
%55 = tail call double @llvm.fabs.f64(double %53)
%56 = fcmp ueq double %55, 0x7FF0000000000000
br i1 %56, label %57, label %58
57: ; preds = %52
store double 0.000000e+00, double* %54
br label %58
58: ; preds = %57, %52
%59 = phi double [ 0.000000e+00, %57 ], [ %53, %52 ]
%60 = getelementptr inbounds double, double* %6, i64 %38
%61 = load double, double* %60
%62 = load double, double* %10
br i1 %36, label %73, label %63
63: ; preds = %58
%64 = fcmp uge double %61, %62
%65 = or i1 %64, %35
%66 = select i1 %64, double* %9, double* %11
%67 = select i1 %64, double 0.000000e+00, double 1.000000e+00
br i1 %65, label %93, label %68
68: ; preds = %63
%69 = getelementptr inbounds double, double* %7, i64 %38
%70 = load double, double* %69
%71 = fmul double %59, %70
%72 = getelementptr inbounds double, double* %9, i64 %38
store double %71, double* %72
br label %93
73: ; preds = %58
%74 = tail call double @llvm.fmuladd.f64(double %12, double -5.000000e+00, double %62)
%75 = fcmp olt double %61, %74
br i1 %75, label %84, label %76
76: ; preds = %73
%77 = tail call double @llvm.fmuladd.f64(double %12, double 5.000000e+00, double %62)
%78 = fcmp ogt double %61, %77
br i1 %78, label %84, label %79
79: ; preds = %76
%80 = fsub double %62, %61
%81 = fmul double %17, %80
%82 = tail call double @erf(double %81)
%83 = tail call double @llvm.fmuladd.f64(double %82, double 5.000000e-01, double 5.000000e-01)
br label %84
84: ; preds = %76, %73, %79
%85 = phi double [ %83, %79 ], [ 1.000000e+00, %73 ], [ 0.000000e+00, %76 ]
%86 = getelementptr inbounds double, double* %11, i64 %38
store double %85, double* %86
br i1 %35, label %97, label %87
87: ; preds = %84
%88 = load double, double* %54
%89 = getelementptr inbounds double, double* %7, i64 %38
%90 = load double, double* %89
%91 = fmul double %88, %90
%92 = fmul double %91, %85
br label %93
93: ; preds = %63, %68, %87
%94 = phi double* [ %9, %87 ], [ %11, %68 ], [ %66, %63 ]
%95 = phi double [ %92, %87 ], [ 1.000000e+00, %68 ], [ %67, %63 ]
%96 = getelementptr inbounds double, double* %94, i64 %38
store double %95, double* %96
br label %97
97: ; preds = %93, %84
%98 = add nuw nsw i64 %38, 1
%99 = icmp eq i64 %98, %3
br i1 %99, label %100, label %37
100: ; preds = %97, %14
ret i32 0
}