#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 smoothedHeaviside(double const, double const);
double sqrt(double);
void calculateEddyViscosity_Smagorinsky2P_3D(
    const int nElements_global, const int nQuadraturePoints_element,
    const double smagorinskyConstant_0, const double smagorinskyConstant_1,
    const double eps, const double *phi_ls, const double *h_e,
    const double *grad_u, const double *grad_v, const double *grad_w,
    double *nu_t) {
  int eN, k;
  const int nSpace = 3;
  double norm_S2, norm_S, H_smc, smc;
  for (eN = 0; eN < nElements_global; eN++) {
    for (k = 0; k < nQuadraturePoints_element; k++) {
      H_smc = smoothedHeaviside(eps, phi_ls[k]);
      smc =
          smagorinskyConstant_0 * (1.0 - H_smc) + smagorinskyConstant_1 * H_smc;
      norm_S2 =
          grad_u[eN * nQuadraturePoints_element * nSpace + k * nSpace + 0] *
              grad_u[eN * nQuadraturePoints_element * nSpace + k * nSpace + 0] +
          grad_v[eN * nQuadraturePoints_element * nSpace + k * nSpace + 1] *
              grad_v[eN * nQuadraturePoints_element * nSpace + k * nSpace + 1] +
          grad_w[eN * nQuadraturePoints_element * nSpace + k * nSpace + 2] *
              grad_w[eN * nQuadraturePoints_element * nSpace + k * nSpace + 2] +
          0.5 *
              (grad_u[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      1] +
               grad_v[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      0]) *
              (grad_u[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      1] +
               grad_v[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      0]) +
          0.5 *
              (grad_u[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      2] +
               grad_w[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      0]) *
              (grad_u[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      2] +
               grad_w[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      0]) +
          0.5 *
              (grad_v[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      2] +
               grad_w[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      1]) *
              (grad_v[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      2] +
               grad_w[eN * nQuadraturePoints_element * nSpace + k * nSpace +
                      1]);
      norm_S = sqrt(2.0 * norm_S2);
      nu_t[eN * nQuadraturePoints_element + k] =
          smc * smc * h_e[eN] * h_e[eN] * norm_S;
    }
  }
}


x86 assembly (clang, -O0):
<calculateEddyViscosity_Smagorinsky2P_3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movl   $0x3,-0x4c(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    14bd <calculateEddyViscosity_Smagorinsky2P_3D+0x39d>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14aa <calculateEddyViscosity_Smagorinsky2P_3D+0x38a>
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1040 <smoothedHeaviside@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe65(%rip),%xmm2
subsd  -0x68(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xd31(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xca1(%rip),%xmm1
mulsd  %xmm2,%xmm1
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xc11(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x48(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xbb2(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x70(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  -0x60(%rbp),%xmm0
mov    0x18(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1176 <calculateEddyViscosity_Smagorinsky2P_3D+0x56>
jmp    14af <calculateEddyViscosity_Smagorinsky2P_3D+0x38f>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1163 <calculateEddyViscosity_Smagorinsky2P_3D+0x43>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateEddyViscosity_Smagorinsky2P_3D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rcx,0x60(%rsp)
mov    %rdx,0x58(%rsp)
movsd  %xmm2,0x50(%rsp)
movsd  %xmm1,0x48(%rsp)
movsd  %xmm0,0x40(%rsp)
mov    %rsi,0x20(%rsp)
test   %edi,%edi
jle    132c <calculateEddyViscosity_Smagorinsky2P_3D+0x20c>
mov    %r9,%r14
mov    %r8,%rbx
mov    0xa0(%rsp),%r13
mov    %edi,%eax
mov    %rax,0x30(%rsp)
mov    0x20(%rsp),%rax
mov    %eax,%ecx
mov    %rcx,0x28(%rsp)
lea    (%rax,%rax,2),%eax
mov    %eax,0x1c(%rsp)
xor    %eax,%eax
mov    %rax,(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    11d7 <calculateEddyViscosity_Smagorinsky2P_3D+0xb7>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%rcx
add    $0x1,%rcx
mov    0x10(%rsp),%rax
add    0x28(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    (%rsp),%rax
add    0x1c(%rsp),%eax
mov    %rax,(%rsp)
mov    %rcx,%rax
mov    %rcx,0x8(%rsp)
cmp    0x30(%rsp),%rcx
je     132c <calculateEddyViscosity_Smagorinsky2P_3D+0x20c>
cmpl   $0x0,0x20(%rsp)
jle    11a0 <calculateEddyViscosity_Smagorinsky2P_3D+0x80>
mov    (%rsp),%rax
mov    %eax,%ebp
xor    %r15d,%r15d
jmp    125e <calculateEddyViscosity_Smagorinsky2P_3D+0x13e>
nopl   0x0(%rax)
movsd  %xmm4,0x38(%rsp)
call   1030 <sqrt@plt>
movsd  0x38(%rsp),%xmm4
movsd  0xdf7(%rip),%xmm1
subsd  %xmm4,%xmm1
mulsd  0x48(%rsp),%xmm4
mulsd  0x40(%rsp),%xmm1
addsd  %xmm4,%xmm1
mulsd  %xmm1,%xmm1
mov    0x60(%rsp),%rax
mov    0x8(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movslq %r12d,%rax
mov    0xa8(%rsp),%rcx
movsd  %xmm1,(%rcx,%rax,8)
add    $0x1,%r15
add    $0x3,%ebp
cmp    %r15,0x28(%rsp)
je     11a0 <calculateEddyViscosity_Smagorinsky2P_3D+0x80>
mov    0x58(%rsp),%rax
movsd  (%rax,%r15,8),%xmm1
movsd  0x50(%rsp),%xmm0
call   1040 <smoothedHeaviside@plt>
movapd %xmm0,%xmm4
mov    0x10(%rsp),%rax
lea    (%rax,%r15,1),%r12
movslq %ebp,%rcx
movsd  (%rbx,%rcx,8),%xmm0
lea    0x1(%rcx),%eax
cltq
movsd  (%r14,%rax,8),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
lea    0x2(%rcx),%edx
movslq %edx,%rdx
movsd  0x0(%r13,%rdx,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  (%rbx,%rax,8),%xmm0
addsd  (%r14,%rcx,8),%xmm0
movapd %xmm0,%xmm2
movsd  0xd3c(%rip),%xmm3
mulsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  (%rbx,%rdx,8),%xmm0
addsd  0x0(%r13,%rcx,8),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  (%r14,%rdx,8),%xmm2
addsd  0x0(%r13,%rax,8),%xmm2
movapd %xmm2,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
ucomisd 0xcf3(%rip),%xmm0
jb     11f0 <calculateEddyViscosity_Smagorinsky2P_3D+0xd0>
sqrtsd %xmm0,%xmm0
jmp    1201 <calculateEddyViscosity_Smagorinsky2P_3D+0xe1>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @calculateEddyViscosity_Smagorinsky2P_3D(i32 %0, i32 %1, double %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%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 i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
store i32 %0, i32* %12
store i32 %1, i32* %13
store double %2, double* %14
store double %3, double* %15
store double %4, double* %16
store double* %5, double** %17
store double* %6, double** %18
store double* %7, double** %19
store double* %8, double** %20
store double* %9, double** %21
store double* %10, double** %22
store i32 3, i32* %25
store i32 0, i32* %23
br label %30
30: ; preds = %317, %11
%31 = load i32, i32* %23
%32 = load i32, i32* %12
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %320
34: ; preds = %30
store i32 0, i32* %24
br label %35
35: ; preds = %313, %34
%36 = load i32, i32* %24
%37 = load i32, i32* %13
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %316
39: ; preds = %35
%40 = load double, double* %16
%41 = load double*, double** %17
%42 = load i32, i32* %24
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
%45 = load double, double* %44
%46 = call double @smoothedHeaviside(double %40, double %45)
store double %46, double* %28
%47 = load double, double* %14
%48 = load double, double* %28
%49 = fsub double 1.000000e+00, %48
%50 = load double, double* %15
%51 = load double, double* %28
%52 = fmul double %50, %51
%53 = call double @llvm.fmuladd.f64(double %47, double %49, double %52)
store double %53, double* %29
%54 = load double*, double** %19
%55 = load i32, i32* %23
%56 = load i32, i32* %13
%57 = mul nsw i32 %55, %56
%58 = mul nsw i32 %57, 3
%59 = load i32, i32* %24
%60 = mul nsw i32 %59, 3
%61 = add nsw i32 %58, %60
%62 = add nsw i32 %61, 0
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %54, i64 %63
%65 = load double, double* %64
%66 = load double*, double** %19
%67 = load i32, i32* %23
%68 = load i32, i32* %13
%69 = mul nsw i32 %67, %68
%70 = mul nsw i32 %69, 3
%71 = load i32, i32* %24
%72 = mul nsw i32 %71, 3
%73 = add nsw i32 %70, %72
%74 = add nsw i32 %73, 0
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %66, i64 %75
%77 = load double, double* %76
%78 = load double*, double** %20
%79 = load i32, i32* %23
%80 = load i32, i32* %13
%81 = mul nsw i32 %79, %80
%82 = mul nsw i32 %81, 3
%83 = load i32, i32* %24
%84 = mul nsw i32 %83, 3
%85 = add nsw i32 %82, %84
%86 = add nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %78, i64 %87
%89 = load double, double* %88
%90 = load double*, double** %20
%91 = load i32, i32* %23
%92 = load i32, i32* %13
%93 = mul nsw i32 %91, %92
%94 = mul nsw i32 %93, 3
%95 = load i32, i32* %24
%96 = mul nsw i32 %95, 3
%97 = add nsw i32 %94, %96
%98 = add nsw i32 %97, 1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %90, i64 %99
%101 = load double, double* %100
%102 = fmul double %89, %101
%103 = call double @llvm.fmuladd.f64(double %65, double %77, double %102)
%104 = load double*, double** %21
%105 = load i32, i32* %23
%106 = load i32, i32* %13
%107 = mul nsw i32 %105, %106
%108 = mul nsw i32 %107, 3
%109 = load i32, i32* %24
%110 = mul nsw i32 %109, 3
%111 = add nsw i32 %108, %110
%112 = add nsw i32 %111, 2
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %104, i64 %113
%115 = load double, double* %114
%116 = load double*, double** %21
%117 = load i32, i32* %23
%118 = load i32, i32* %13
%119 = mul nsw i32 %117, %118
%120 = mul nsw i32 %119, 3
%121 = load i32, i32* %24
%122 = mul nsw i32 %121, 3
%123 = add nsw i32 %120, %122
%124 = add nsw i32 %123, 2
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %116, i64 %125
%127 = load double, double* %126
%128 = call double @llvm.fmuladd.f64(double %115, double %127, double %103)
%129 = load double*, double** %19
%130 = load i32, i32* %23
%131 = load i32, i32* %13
%132 = mul nsw i32 %130, %131
%133 = mul nsw i32 %132, 3
%134 = load i32, i32* %24
%135 = mul nsw i32 %134, 3
%136 = add nsw i32 %133, %135
%137 = add nsw i32 %136, 1
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %129, i64 %138
%140 = load double, double* %139
%141 = load double*, double** %20
%142 = load i32, i32* %23
%143 = load i32, i32* %13
%144 = mul nsw i32 %142, %143
%145 = mul nsw i32 %144, 3
%146 = load i32, i32* %24
%147 = mul nsw i32 %146, 3
%148 = add nsw i32 %145, %147
%149 = add nsw i32 %148, 0
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %141, i64 %150
%152 = load double, double* %151
%153 = fadd double %140, %152
%154 = fmul double 5.000000e-01, %153
%155 = load double*, double** %19
%156 = load i32, i32* %23
%157 = load i32, i32* %13
%158 = mul nsw i32 %156, %157
%159 = mul nsw i32 %158, 3
%160 = load i32, i32* %24
%161 = mul nsw i32 %160, 3
%162 = add nsw i32 %159, %161
%163 = add nsw i32 %162, 1
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds double, double* %155, i64 %164
%166 = load double, double* %165
%167 = load double*, double** %20
%168 = load i32, i32* %23
%169 = load i32, i32* %13
%170 = mul nsw i32 %168, %169
%171 = mul nsw i32 %170, 3
%172 = load i32, i32* %24
%173 = mul nsw i32 %172, 3
%174 = add nsw i32 %171, %173
%175 = add nsw i32 %174, 0
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %167, i64 %176
%178 = load double, double* %177
%179 = fadd double %166, %178
%180 = call double @llvm.fmuladd.f64(double %154, double %179, double %128)
%181 = load double*, double** %19
%182 = load i32, i32* %23
%183 = load i32, i32* %13
%184 = mul nsw i32 %182, %183
%185 = mul nsw i32 %184, 3
%186 = load i32, i32* %24
%187 = mul nsw i32 %186, 3
%188 = add nsw i32 %185, %187
%189 = add nsw i32 %188, 2
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds double, double* %181, i64 %190
%192 = load double, double* %191
%193 = load double*, double** %21
%194 = load i32, i32* %23
%195 = load i32, i32* %13
%196 = mul nsw i32 %194, %195
%197 = mul nsw i32 %196, 3
%198 = load i32, i32* %24
%199 = mul nsw i32 %198, 3
%200 = add nsw i32 %197, %199
%201 = add nsw i32 %200, 0
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %193, i64 %202
%204 = load double, double* %203
%205 = fadd double %192, %204
%206 = fmul double 5.000000e-01, %205
%207 = load double*, double** %19
%208 = load i32, i32* %23
%209 = load i32, i32* %13
%210 = mul nsw i32 %208, %209
%211 = mul nsw i32 %210, 3
%212 = load i32, i32* %24
%213 = mul nsw i32 %212, 3
%214 = add nsw i32 %211, %213
%215 = add nsw i32 %214, 2
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %207, i64 %216
%218 = load double, double* %217
%219 = load double*, double** %21
%220 = load i32, i32* %23
%221 = load i32, i32* %13
%222 = mul nsw i32 %220, %221
%223 = mul nsw i32 %222, 3
%224 = load i32, i32* %24
%225 = mul nsw i32 %224, 3
%226 = add nsw i32 %223, %225
%227 = add nsw i32 %226, 0
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds double, double* %219, i64 %228
%230 = load double, double* %229
%231 = fadd double %218, %230
%232 = call double @llvm.fmuladd.f64(double %206, double %231, double %180)
%233 = load double*, double** %20
%234 = load i32, i32* %23
%235 = load i32, i32* %13
%236 = mul nsw i32 %234, %235
%237 = mul nsw i32 %236, 3
%238 = load i32, i32* %24
%239 = mul nsw i32 %238, 3
%240 = add nsw i32 %237, %239
%241 = add nsw i32 %240, 2
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds double, double* %233, i64 %242
%244 = load double, double* %243
%245 = load double*, double** %21
%246 = load i32, i32* %23
%247 = load i32, i32* %13
%248 = mul nsw i32 %246, %247
%249 = mul nsw i32 %248, 3
%250 = load i32, i32* %24
%251 = mul nsw i32 %250, 3
%252 = add nsw i32 %249, %251
%253 = add nsw i32 %252, 1
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds double, double* %245, i64 %254
%256 = load double, double* %255
%257 = fadd double %244, %256
%258 = fmul double 5.000000e-01, %257
%259 = load double*, double** %20
%260 = load i32, i32* %23
%261 = load i32, i32* %13
%262 = mul nsw i32 %260, %261
%263 = mul nsw i32 %262, 3
%264 = load i32, i32* %24
%265 = mul nsw i32 %264, 3
%266 = add nsw i32 %263, %265
%267 = add nsw i32 %266, 2
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds double, double* %259, i64 %268
%270 = load double, double* %269
%271 = load double*, double** %21
%272 = load i32, i32* %23
%273 = load i32, i32* %13
%274 = mul nsw i32 %272, %273
%275 = mul nsw i32 %274, 3
%276 = load i32, i32* %24
%277 = mul nsw i32 %276, 3
%278 = add nsw i32 %275, %277
%279 = add nsw i32 %278, 1
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds double, double* %271, i64 %280
%282 = load double, double* %281
%283 = fadd double %270, %282
%284 = call double @llvm.fmuladd.f64(double %258, double %283, double %232)
store double %284, double* %26
%285 = load double, double* %26
%286 = fmul double 2.000000e+00, %285
%287 = call double @sqrt(double %286)
store double %287, double* %27
%288 = load double, double* %29
%289 = load double, double* %29
%290 = fmul double %288, %289
%291 = load double*, double** %18
%292 = load i32, i32* %23
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds double, double* %291, i64 %293
%295 = load double, double* %294
%296 = fmul double %290, %295
%297 = load double*, double** %18
%298 = load i32, i32* %23
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds double, double* %297, i64 %299
%301 = load double, double* %300
%302 = fmul double %296, %301
%303 = load double, double* %27
%304 = fmul double %302, %303
%305 = load double*, double** %22
%306 = load i32, i32* %23
%307 = load i32, i32* %13
%308 = mul nsw i32 %306, %307
%309 = load i32, i32* %24
%310 = add nsw i32 %308, %309
%311 = sext i32 %310 to i64
%312 = getelementptr inbounds double, double* %305, i64 %311
store double %304, double* %312
br label %313
313: ; preds = %39
%314 = load i32, i32* %24
%315 = add nsw i32 %314, 1
store i32 %315, i32* %24
br label %35
316: ; preds = %35
br label %317
317: ; preds = %316
%318 = load i32, i32* %23
%319 = add nsw i32 %318, 1
store i32 %319, i32* %23
br label %30
320: ; preds = %30
ret void
}

LLVM IR (-O2):
define void @calculateEddyViscosity_Smagorinsky2P_3D(i32 %0, i32 %1, double %2, double %3, double %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture %8, double* nocapture %9, double* nocapture writeonly %10) {
%12 = icmp sgt i32 %0, 0
br i1 %12, label %13, label %83
13: ; preds = %11
%14 = icmp sgt i32 %1, 0
%15 = zext i32 %0 to i64
%16 = zext i32 %1 to i64
br label %17
17: ; preds = %13, %80
%18 = phi i64 [ 0, %13 ], [ %81, %80 ]
br i1 %14, label %19, label %80
19: ; preds = %17
%20 = trunc i64 %18 to i32
%21 = mul nsw i32 %20, %1
%22 = getelementptr inbounds double, double* %6, i64 %18
br label %23
23: ; preds = %19, %23
%24 = phi i64 [ 0, %19 ], [ %78, %23 ]
%25 = getelementptr inbounds double, double* %5, i64 %24
%26 = load double, double* %25
%27 = tail call double @smoothedHeaviside(double %4, double %26)
%28 = fsub double 1.000000e+00, %27
%29 = fmul double %27, %3
%30 = tail call double @llvm.fmuladd.f64(double %2, double %28, double %29)
%31 = trunc i64 %24 to i32
%32 = add i32 %21, %31
%33 = mul i32 %32, 3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %7, i64 %34
%36 = load double, double* %35
%37 = add nsw i32 %33, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %8, i64 %38
%40 = load double, double* %39
%41 = fmul double %40, %40
%42 = tail call double @llvm.fmuladd.f64(double %36, double %36, double %41)
%43 = add nsw i32 %33, 2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %9, i64 %44
%46 = load double, double* %45
%47 = tail call double @llvm.fmuladd.f64(double %46, double %46, double %42)
%48 = getelementptr inbounds double, double* %7, i64 %38
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %8, i64 %34
%51 = load double, double* %50
%52 = fadd double %49, %51
%53 = fmul double %52, 5.000000e-01
%54 = tail call double @llvm.fmuladd.f64(double %53, double %52, double %47)
%55 = getelementptr inbounds double, double* %7, i64 %44
%56 = load double, double* %55
%57 = getelementptr inbounds double, double* %9, i64 %34
%58 = load double, double* %57
%59 = fadd double %56, %58
%60 = fmul double %59, 5.000000e-01
%61 = tail call double @llvm.fmuladd.f64(double %60, double %59, double %54)
%62 = getelementptr inbounds double, double* %8, i64 %44
%63 = load double, double* %62
%64 = getelementptr inbounds double, double* %9, i64 %38
%65 = load double, double* %64
%66 = fadd double %63, %65
%67 = fmul double %66, 5.000000e-01
%68 = tail call double @llvm.fmuladd.f64(double %67, double %66, double %61)
%69 = fmul double %68, 2.000000e+00
%70 = tail call double @sqrt(double %69)
%71 = fmul double %30, %30
%72 = load double, double* %22
%73 = fmul double %71, %72
%74 = fmul double %72, %73
%75 = fmul double %70, %74
%76 = sext i32 %32 to i64
%77 = getelementptr inbounds double, double* %10, i64 %76
store double %75, double* %77
%78 = add nuw nsw i64 %24, 1
%79 = icmp eq i64 %78, %16
br i1 %79, label %80, label %23
80: ; preds = %23, %17
%81 = add nuw nsw i64 %18, 1
%82 = icmp eq i64 %81, %15
br i1 %82, label %83, label %17
83: ; preds = %80, %11
ret void
}