void eddyViscosity_2D_Update(const int nPoints, const double *nu_t,
                             double *mom_u_diff_ten, double *mom_v_diff_ten,
                             double *mom_uv_diff_ten, double *mom_vu_diff_ten) {
  int i;
  for (i = 0; i < nPoints; i++) {
    mom_u_diff_ten[i * 4 + 0] += 2.0 * nu_t[i];
    mom_u_diff_ten[i * 4 + 3] += nu_t[i];
    mom_uv_diff_ten[i * 4 + 2] += nu_t[i];
    mom_v_diff_ten[i * 4 + 0] += nu_t[i];
    mom_v_diff_ten[i * 4 + 3] += 2.0 * nu_t[i];
    mom_vu_diff_ten[i * 4 + 1] += nu_t[i];
  }
}


x86 assembly (clang, -O0):
<eddyViscosity_2D_Update>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1236 <eddyViscosity_2D_Update+0x136>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1122 <eddyViscosity_2D_Update+0x22>
pop    %rbp
ret

x86 assembly (clang, -O2):
<eddyViscosity_2D_Update>:
test   %edi,%edi
jle    1187 <eddyViscosity_2D_Update+0x87>
mov    %edi,%eax
shl    $0x3,%rax
xor    %edi,%edi
movsd  (%rsi,%rdi,1),%xmm0
addsd  %xmm0,%xmm0
addsd  (%rdx,%rdi,4),%xmm0
movsd  %xmm0,(%rdx,%rdi,4)
movsd  (%rsi,%rdi,1),%xmm0
addsd  0x18(%rdx,%rdi,4),%xmm0
movsd  %xmm0,0x18(%rdx,%rdi,4)
movsd  (%rsi,%rdi,1),%xmm0
addsd  0x10(%r8,%rdi,4),%xmm0
movsd  %xmm0,0x10(%r8,%rdi,4)
movsd  (%rsi,%rdi,1),%xmm0
addsd  (%rcx,%rdi,4),%xmm0
movsd  %xmm0,(%rcx,%rdi,4)
movsd  (%rsi,%rdi,1),%xmm0
addsd  %xmm0,%xmm0
addsd  0x18(%rcx,%rdi,4),%xmm0
movsd  %xmm0,0x18(%rcx,%rdi,4)
movsd  (%rsi,%rdi,1),%xmm0
addsd  0x8(%r9,%rdi,4),%xmm0
movsd  %xmm0,0x8(%r9,%rdi,4)
add    $0x8,%rdi
cmp    %rdi,%rax
jne    1110 <eddyViscosity_2D_Update+0x10>
ret

LLVM IR (-O0):
define void @eddyViscosity_2D_Update(i32 %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
store i32 %0, i32* %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
store i32 0, i32* %13
br label %14
14: ; preds = %97, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %100
18: ; preds = %14
%19 = load double*, double** %8
%20 = load i32, i32* %13
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = load double*, double** %9
%25 = load i32, i32* %13
%26 = mul nsw i32 %25, 4
%27 = add nsw i32 %26, 0
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %24, i64 %28
%30 = load double, double* %29
%31 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %23, double %30)
store double %31, double* %29
%32 = load double*, double** %8
%33 = load i32, i32* %13
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = load double*, double** %9
%38 = load i32, i32* %13
%39 = mul nsw i32 %38, 4
%40 = add nsw i32 %39, 3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %37, i64 %41
%43 = load double, double* %42
%44 = fadd double %43, %36
store double %44, double* %42
%45 = load double*, double** %8
%46 = load i32, i32* %13
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
%49 = load double, double* %48
%50 = load double*, double** %11
%51 = load i32, i32* %13
%52 = mul nsw i32 %51, 4
%53 = add nsw i32 %52, 2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %50, i64 %54
%56 = load double, double* %55
%57 = fadd double %56, %49
store double %57, double* %55
%58 = load double*, double** %8
%59 = load i32, i32* %13
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = load double*, double** %10
%64 = load i32, i32* %13
%65 = mul nsw i32 %64, 4
%66 = add nsw i32 %65, 0
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %63, i64 %67
%69 = load double, double* %68
%70 = fadd double %69, %62
store double %70, double* %68
%71 = load double*, double** %8
%72 = load i32, i32* %13
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
%75 = load double, double* %74
%76 = load double*, double** %10
%77 = load i32, i32* %13
%78 = mul nsw i32 %77, 4
%79 = add nsw i32 %78, 3
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %76, i64 %80
%82 = load double, double* %81
%83 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %75, double %82)
store double %83, double* %81
%84 = load double*, double** %8
%85 = load i32, i32* %13
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = load double*, double** %12
%90 = load i32, i32* %13
%91 = mul nsw i32 %90, 4
%92 = add nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %89, i64 %93
%95 = load double, double* %94
%96 = fadd double %95, %88
store double %96, double* %94
br label %97
97: ; preds = %18
%98 = load i32, i32* %13
%99 = add nsw i32 %98, 1
store i32 %99, i32* %13
br label %14
100: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @eddyViscosity_2D_Update(i32 %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5) {
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %43
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %41, %10 ]
%12 = getelementptr inbounds double, double* %1, i64 %11
%13 = load double, double* %12
%14 = shl nsw i64 %11, 2
%15 = getelementptr inbounds double, double* %2, i64 %14
%16 = load double, double* %15
%17 = tail call double @llvm.fmuladd.f64(double %13, double 2.000000e+00, double %16)
store double %17, double* %15
%18 = load double, double* %12
%19 = or i64 %14, 3
%20 = getelementptr inbounds double, double* %2, i64 %19
%21 = load double, double* %20
%22 = fadd double %18, %21
store double %22, double* %20
%23 = load double, double* %12
%24 = or i64 %14, 2
%25 = getelementptr inbounds double, double* %4, i64 %24
%26 = load double, double* %25
%27 = fadd double %23, %26
store double %27, double* %25
%28 = load double, double* %12
%29 = getelementptr inbounds double, double* %3, i64 %14
%30 = load double, double* %29
%31 = fadd double %28, %30
store double %31, double* %29
%32 = load double, double* %12
%33 = getelementptr inbounds double, double* %3, i64 %19
%34 = load double, double* %33
%35 = tail call double @llvm.fmuladd.f64(double %32, double 2.000000e+00, double %34)
store double %35, double* %33
%36 = load double, double* %12
%37 = or i64 %14, 1
%38 = getelementptr inbounds double, double* %5, i64 %37
%39 = load double, double* %38
%40 = fadd double %36, %39
store double %40, double* %38
%41 = add nuw nsw i64 %11, 1
%42 = icmp eq i64 %41, %9
br i1 %42, label %43, label %10
43: ; preds = %10, %6
ret void
}