void ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd(
    const int nPoints, const double rho, const double nu, const double c_mu,
    const double *k, const double *grad_k, const double *epsilon,
    double *mom_u_diff_ten, double *mom_v_diff_ten, double *mom_uv_diff_ten,
    double *mom_vu_diff_ten, double *mom_u_source, double *mom_v_source) {
  int i;
  double nu_t, eval, kval;
  const double twoThirds = 2.0 / 3.0;
  const double div_zero = 1.0e-6;
  for (i = 0; i < nPoints; i++) {
    eval = epsilon[i] >= 0.0 ? epsilon[i] : 0.0;
    kval = k[i] >= 0.0 ? k[i] : 0.0;
    nu_t = c_mu * kval * kval / (eval + div_zero);
    mom_u_diff_ten[i * 2 + 0] += 2.0 * nu_t;
    mom_u_diff_ten[i * 2 + 1] += nu_t;
    mom_uv_diff_ten[i] += nu_t;
    mom_v_diff_ten[i * 2 + 0] += nu_t;
    mom_v_diff_ten[i * 2 + 1] += 2.0 * nu_t;
    mom_vu_diff_ten[i] += nu_t;
    mom_u_source[i] += twoThirds * grad_k[i * 2 + 0];
    mom_v_source[i] += twoThirds * grad_k[i * 2 + 1];
  }
}


x86 assembly (clang, -O0):
<ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd>:
push   %rbp
mov    %rsp,%rbp
push   %rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    135c <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0x25c>
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1199 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0x99>
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    11a6 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0xa6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    11a6 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0xa6>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11e4 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0xe4>
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    11f4 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0xf4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    11f4 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0xf4>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  0xde8(%rip),%xmm1
addsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x4c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0xcfe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x4c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0xcc7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    115c <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0x5c>
add    $0x8,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd>:
push   %r14
push   %rbx
test   %edi,%edi
jle    1212 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0x112>
mov    0x30(%rsp),%r10
mov    0x28(%rsp),%r11
mov    0x20(%rsp),%r14
mov    0x18(%rsp),%rbx
mov    %edi,%edi
shl    $0x3,%rdi
xor    %eax,%eax
movsd  0xed1(%rip),%xmm0
movsd  0xed1(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
movsd  (%rcx,%rax,1),%xmm3
xorpd  %xmm4,%xmm4
cmplesd %xmm3,%xmm4
andpd  %xmm3,%xmm4
movsd  (%rsi,%rax,1),%xmm3
xorpd  %xmm5,%xmm5
cmplesd %xmm3,%xmm5
andpd  %xmm3,%xmm5
movapd %xmm5,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm5,%xmm3
addsd  %xmm0,%xmm4
divsd  %xmm4,%xmm3
movapd %xmm3,%xmm4
addsd  %xmm3,%xmm4
movsd  (%r8,%rax,2),%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,(%r8,%rax,2)
movsd  0x8(%r8,%rax,2),%xmm5
addsd  %xmm3,%xmm5
movsd  %xmm5,0x8(%r8,%rax,2)
movsd  (%rbx,%rax,1),%xmm5
addsd  %xmm3,%xmm5
movsd  %xmm5,(%rbx,%rax,1)
movsd  (%r9,%rax,2),%xmm5
addsd  %xmm3,%xmm5
movsd  %xmm5,(%r9,%rax,2)
addsd  0x8(%r9,%rax,2),%xmm4
movsd  %xmm4,0x8(%r9,%rax,2)
addsd  (%r14,%rax,1),%xmm3
movsd  %xmm3,(%r14,%rax,1)
movsd  (%rdx,%rax,2),%xmm3
mulsd  %xmm1,%xmm3
addsd  (%r11,%rax,1),%xmm3
movsd  %xmm3,(%r11,%rax,1)
movsd  0x8(%rdx,%rax,2),%xmm3
mulsd  %xmm1,%xmm3
addsd  (%r10,%rax,1),%xmm3
movsd  %xmm3,(%r10,%rax,1)
add    $0x8,%rax
cmp    %rax,%rdi
jne    1140 <ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd+0x40>
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd(i32 %0, double %1, double %2, double %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12) {
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double*
%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 i32
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
store i32 %0, i32* %14
store double %1, double* %15
store double %2, double* %16
store double %3, double* %17
store double* %4, double** %18
store double* %5, double** %19
store double* %6, double** %20
store double* %7, double** %21
store double* %8, double** %22
store double* %9, double** %23
store double* %10, double** %24
store double* %11, double** %25
store double* %12, double** %26
store double 0x3FE5555555555555, double* %31
store double 0x3EB0C6F7A0B5ED8D, double* %32
store i32 0, i32* %27
br label %33
33: ; preds = %152, %13
%34 = load i32, i32* %27
%35 = load i32, i32* %14
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %155
37: ; preds = %33
%38 = load double*, double** %20
%39 = load i32, i32* %27
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = fcmp oge double %42, 0.000000e+00
br i1 %43, label %44, label %50
44: ; preds = %37
%45 = load double*, double** %20
%46 = load i32, i32* %27
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
%49 = load double, double* %48
br label %51
50: ; preds = %37
br label %51
51: ; preds = %50, %44
%52 = phi double [ %49, %44 ], [ 0.000000e+00, %50 ]
store double %52, double* %29
%53 = load double*, double** %18
%54 = load i32, i32* %27
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = fcmp oge double %57, 0.000000e+00
br i1 %58, label %59, label %65
59: ; preds = %51
%60 = load double*, double** %18
%61 = load i32, i32* %27
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
%64 = load double, double* %63
br label %66
65: ; preds = %51
br label %66
66: ; preds = %65, %59
%67 = phi double [ %64, %59 ], [ 0.000000e+00, %65 ]
store double %67, double* %30
%68 = load double, double* %17
%69 = load double, double* %30
%70 = fmul double %68, %69
%71 = load double, double* %30
%72 = fmul double %70, %71
%73 = load double, double* %29
%74 = fadd double %73, 0x3EB0C6F7A0B5ED8D
%75 = fdiv double %72, %74
store double %75, double* %28
%76 = load double, double* %28
%77 = load double*, double** %21
%78 = load i32, i32* %27
%79 = mul nsw i32 %78, 2
%80 = add nsw i32 %79, 0
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %77, i64 %81
%83 = load double, double* %82
%84 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %76, double %83)
store double %84, double* %82
%85 = load double, double* %28
%86 = load double*, double** %21
%87 = load i32, i32* %27
%88 = mul nsw i32 %87, 2
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %86, i64 %90
%92 = load double, double* %91
%93 = fadd double %92, %85
store double %93, double* %91
%94 = load double, double* %28
%95 = load double*, double** %23
%96 = load i32, i32* %27
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
%99 = load double, double* %98
%100 = fadd double %99, %94
store double %100, double* %98
%101 = load double, double* %28
%102 = load double*, double** %22
%103 = load i32, i32* %27
%104 = mul nsw i32 %103, 2
%105 = add nsw i32 %104, 0
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %102, i64 %106
%108 = load double, double* %107
%109 = fadd double %108, %101
store double %109, double* %107
%110 = load double, double* %28
%111 = load double*, double** %22
%112 = load i32, i32* %27
%113 = mul nsw i32 %112, 2
%114 = add nsw i32 %113, 1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %111, i64 %115
%117 = load double, double* %116
%118 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %110, double %117)
store double %118, double* %116
%119 = load double, double* %28
%120 = load double*, double** %24
%121 = load i32, i32* %27
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds double, double* %120, i64 %122
%124 = load double, double* %123
%125 = fadd double %124, %119
store double %125, double* %123
%126 = load double*, double** %19
%127 = load i32, i32* %27
%128 = mul nsw i32 %127, 2
%129 = add nsw i32 %128, 0
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %126, i64 %130
%132 = load double, double* %131
%133 = load double*, double** %25
%134 = load i32, i32* %27
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
%137 = load double, double* %136
%138 = call double @llvm.fmuladd.f64(double 0x3FE5555555555555, double %132, double %137)
store double %138, double* %136
%139 = load double*, double** %19
%140 = load i32, i32* %27
%141 = mul nsw i32 %140, 2
%142 = add nsw i32 %141, 1
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %139, i64 %143
%145 = load double, double* %144
%146 = load double*, double** %26
%147 = load i32, i32* %27
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %146, i64 %148
%150 = load double, double* %149
%151 = call double @llvm.fmuladd.f64(double 0x3FE5555555555555, double %145, double %150)
store double %151, double* %149
br label %152
152: ; preds = %66
%153 = load i32, i32* %27
%154 = add nsw i32 %153, 1
store i32 %154, i32* %27
br label %33
155: ; preds = %33
ret void
}

LLVM IR (-O2):
define void @ReynoldsAveragedNavierStokes_kEpsilon_2D_Update_sd(i32 %0, double %1, double %2, double %3, double* nocapture %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture %8, double* nocapture %9, double* nocapture %10, double* nocapture %11, double* nocapture %12) {
%14 = icmp sgt i32 %0, 0
br i1 %14, label %15, label %63
15: ; preds = %13
%16 = zext i32 %0 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %61, %17 ]
%19 = getelementptr inbounds double, double* %6, i64 %18
%20 = load double, double* %19
%21 = fcmp oge double %20, 0.000000e+00
%22 = select i1 %21, double %20, double 0.000000e+00
%23 = getelementptr inbounds double, double* %4, i64 %18
%24 = load double, double* %23
%25 = fcmp oge double %24, 0.000000e+00
%26 = select i1 %25, double %24, double 0.000000e+00
%27 = fmul double %26, %3
%28 = fmul double %26, %27
%29 = fadd double %22, 0x3EB0C6F7A0B5ED8D
%30 = fdiv double %28, %29
%31 = shl nuw nsw i64 %18, 1
%32 = getelementptr inbounds double, double* %7, i64 %31
%33 = load double, double* %32
%34 = tail call double @llvm.fmuladd.f64(double %30, double 2.000000e+00, double %33)
store double %34, double* %32
%35 = or i64 %31, 1
%36 = getelementptr inbounds double, double* %7, i64 %35
%37 = load double, double* %36
%38 = fadd double %37, %30
store double %38, double* %36
%39 = getelementptr inbounds double, double* %9, i64 %18
%40 = load double, double* %39
%41 = fadd double %40, %30
store double %41, double* %39
%42 = getelementptr inbounds double, double* %8, i64 %31
%43 = load double, double* %42
%44 = fadd double %30, %43
store double %44, double* %42
%45 = getelementptr inbounds double, double* %8, i64 %35
%46 = load double, double* %45
%47 = tail call double @llvm.fmuladd.f64(double %30, double 2.000000e+00, double %46)
store double %47, double* %45
%48 = getelementptr inbounds double, double* %10, i64 %18
%49 = load double, double* %48
%50 = fadd double %30, %49
store double %50, double* %48
%51 = getelementptr inbounds double, double* %5, i64 %31
%52 = load double, double* %51
%53 = getelementptr inbounds double, double* %11, i64 %18
%54 = load double, double* %53
%55 = tail call double @llvm.fmuladd.f64(double %52, double 0x3FE5555555555555, double %54)
store double %55, double* %53
%56 = getelementptr inbounds double, double* %5, i64 %35
%57 = load double, double* %56
%58 = getelementptr inbounds double, double* %12, i64 %18
%59 = load double, double* %58
%60 = tail call double @llvm.fmuladd.f64(double %57, double 0x3FE5555555555555, double %59)
store double %60, double* %58
%61 = add nuw nsw i64 %18, 1
%62 = icmp eq i64 %61, %16
br i1 %62, label %63, label %17
63: ; preds = %17, %13
ret void
}