#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 sqrt(double);
void calculateEddyViscosity_Smagorinsky_3D(
    const int nElements_global, const int nQuadraturePoints_element,
    const double smagorinskyConstant, 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;
  for (eN = 0; eN < nElements_global; eN++) {
    for (k = 0; k < nQuadraturePoints_element; k++) {
      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] = smagorinskyConstant *
                                                 smagorinskyConstant * h_e[eN] *
                                                 h_e[eN] * norm_S;
    }
  }
}


x86 assembly (clang, -O0):
<calculateEddyViscosity_Smagorinsky_3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x3,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    145a <calculateEddyViscosity_Smagorinsky_3D+0x34a>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1447 <calculateEddyViscosity_Smagorinsky_3D+0x337>
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xd94(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xd04(%rip),%xmm1
mulsd  %xmm2,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xc74(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x3,%ecx,%ecx
imul   $0x3,-0x38(%rbp),%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xc15(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1158 <calculateEddyViscosity_Smagorinsky_3D+0x48>
jmp    144c <calculateEddyViscosity_Smagorinsky_3D+0x33c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1145 <calculateEddyViscosity_Smagorinsky_3D+0x35>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateEddyViscosity_Smagorinsky_3D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
test   %edi,%edi
jle    12d3 <calculateEddyViscosity_Smagorinsky_3D+0x1c3>
mov    %r9,%r15
mov    %rcx,%rbx
movapd %xmm0,%xmm3
mov    0x90(%rsp),%r14
mulsd  %xmm0,%xmm3
mov    %edi,%eax
mov    %rax,0x28(%rsp)
mov    %esi,%eax
mov    %rax,0x20(%rsp)
lea    (%rsi,%rsi,2),%eax
mov    %eax,0x1c(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
movsd  0xea0(%rip),%xmm4
xorpd  %xmm5,%xmm5
movl   $0x0,0xc(%rsp)
xor    %r11d,%r11d
mov    %r8,0x48(%rsp)
movsd  %xmm3,0x40(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rdx,0x38(%rsp)
jmp    11b6 <calculateEddyViscosity_Smagorinsky_3D+0xa6>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r11
mov    0x30(%rsp),%rsi
add    %esi,0xc(%rsp)
mov    0x10(%rsp),%rax
add    0x1c(%rsp),%eax
mov    %rax,0x10(%rsp)
cmp    0x28(%rsp),%r11
je     12d3 <calculateEddyViscosity_Smagorinsky_3D+0x1c3>
test   %esi,%esi
jle    1190 <calculateEddyViscosity_Smagorinsky_3D+0x80>
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%rax
mov    %eax,%r12d
mov    0xc(%rsp),%eax
mov    %eax,%r13d
mov    %r11,0x50(%rsp)
jmp    1237 <calculateEddyViscosity_Smagorinsky_3D+0x127>
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <sqrt@plt>
mov    0x50(%rsp),%r11
xorpd  %xmm5,%xmm5
movsd  0xe0a(%rip),%xmm4
movsd  0x40(%rsp),%xmm3
mov    0x48(%rsp),%r8
mov    0x38(%rsp),%rdx
movsd  (%rdx,%r11,8),%xmm1
movapd %xmm3,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movslq %r13d,%r13
movsd  %xmm2,(%r14,%r13,8)
add    $0x1,%r13d
add    $0x3,%r12d
add    $0xffffffffffffffff,%rbp
je     1190 <calculateEddyViscosity_Smagorinsky_3D+0x80>
movslq %r12d,%rdi
movsd  (%rbx,%rdi,8),%xmm0
lea    0x1(%rdi),%eax
cltq
movsd  (%r8,%rax,8),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
lea    0x2(%rdi),%esi
movslq %esi,%rsi
movsd  (%r15,%rsi,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  (%rbx,%rax,8),%xmm0
addsd  (%r8,%rdi,8),%xmm0
movapd %xmm0,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  (%rbx,%rsi,8),%xmm0
addsd  (%r15,%rdi,8),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm4,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  (%r8,%rsi,8),%xmm2
addsd  (%r15,%rax,8),%xmm2
movapd %xmm2,%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
ucomisd %xmm5,%xmm0
jb     11e0 <calculateEddyViscosity_Smagorinsky_3D+0xd0>
sqrtsd %xmm0,%xmm0
jmp    1206 <calculateEddyViscosity_Smagorinsky_3D+0xf6>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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