#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_2D(
    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, double *nu_t) {
  int eN, k;
  const int nSpace = 2;
  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] +
          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]);
      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_2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
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   $0x2,-0x4c(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1363 <calculateEddyViscosity_Smagorinsky2P_2D+0x243>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1350 <calculateEddyViscosity_Smagorinsky2P_2D+0x230>
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  0xe69(%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
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%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
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%edx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%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
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xd6f(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%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
shl    $0x1,%ecx
mov    -0x48(%rbp),%edx
shl    $0x1,%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xd0c(%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    0x10(%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    1172 <calculateEddyViscosity_Smagorinsky2P_2D+0x52>
jmp    1355 <calculateEddyViscosity_Smagorinsky2P_2D+0x235>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    115f <calculateEddyViscosity_Smagorinsky2P_2D+0x3f>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateEddyViscosity_Smagorinsky2P_2D>:
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    12b9 <calculateEddyViscosity_Smagorinsky2P_2D+0x199>
mov    %r9,%r14
mov    %r8,%rbx
mov    %edi,%eax
mov    %rax,0x30(%rsp)
mov    0x20(%rsp),%rax
mov    %eax,%ecx
mov    %rcx,0x28(%rsp)
add    %eax,%eax
mov    %eax,0x1c(%rsp)
movl   $0x1,0xc(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %r15d,%r15d
jmp    11ba <calculateEddyViscosity_Smagorinsky2P_2D+0x9a>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
mov    0x10(%rsp),%rax
add    0x28(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%eax
add    0x1c(%rsp),%eax
mov    %eax,0xc(%rsp)
cmp    0x30(%rsp),%r15
je     12b9 <calculateEddyViscosity_Smagorinsky2P_2D+0x199>
cmpl   $0x0,0x20(%rsp)
jle    1190 <calculateEddyViscosity_Smagorinsky2P_2D+0x70>
mov    0xc(%rsp),%eax
mov    %eax,%r12d
xor    %r13d,%r13d
jmp    123b <calculateEddyViscosity_Smagorinsky2P_2D+0x11b>
nopl   (%rax)
movsd  %xmm3,0x38(%rsp)
call   1030 <sqrt@plt>
movsd  0x38(%rsp),%xmm3
movsd  0xe17(%rip),%xmm1
subsd  %xmm3,%xmm1
mulsd  0x48(%rsp),%xmm3
mulsd  0x40(%rsp),%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm1
mov    0x60(%rsp),%rax
movsd  (%rax,%r15,8),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movslq %ebp,%rax
mov    0xa0(%rsp),%rcx
movsd  %xmm1,(%rcx,%rax,8)
add    $0x1,%r13
add    $0x2,%r12d
cmp    %r13,0x28(%rsp)
je     1190 <calculateEddyViscosity_Smagorinsky2P_2D+0x70>
mov    0x58(%rsp),%rax
movsd  (%rax,%r13,8),%xmm1
movsd  0x50(%rsp),%xmm0
call   1040 <smoothedHeaviside@plt>
movapd %xmm0,%xmm3
mov    0x10(%rsp),%rax
lea    (%rax,%r13,1),%rbp
lea    -0x1(%r12),%eax
cltq
movsd  (%rbx,%rax,8),%xmm1
movslq %r12d,%rcx
movsd  (%r14,%rcx,8),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  (%rbx,%rcx,8),%xmm2
addsd  (%r14,%rax,8),%xmm2
movapd %xmm2,%xmm0
mulsd  0xd72(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
ucomisd 0xd66(%rip),%xmm0
jb     11d0 <calculateEddyViscosity_Smagorinsky2P_2D+0xb0>
sqrtsd %xmm0,%xmm0
jmp    11e1 <calculateEddyViscosity_Smagorinsky2P_2D+0xc1>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @calculateEddyViscosity_Smagorinsky2P_2D(i32 %0, i32 %1, double %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8, double* %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
store i32 %0, i32* %11
store i32 %1, i32* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double* %5, double** %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
store double* %9, double** %20
store i32 2, i32* %23
store i32 0, i32* %21
br label %28
28: ; preds = %186, %10
%29 = load i32, i32* %21
%30 = load i32, i32* %11
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %189
32: ; preds = %28
store i32 0, i32* %22
br label %33
33: ; preds = %182, %32
%34 = load i32, i32* %22
%35 = load i32, i32* %12
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %185
37: ; preds = %33
%38 = load double, double* %15
%39 = load double*, double** %16
%40 = load i32, i32* %22
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = call double @smoothedHeaviside(double %38, double %43)
store double %44, double* %26
%45 = load double, double* %13
%46 = load double, double* %26
%47 = fsub double 1.000000e+00, %46
%48 = load double, double* %14
%49 = load double, double* %26
%50 = fmul double %48, %49
%51 = call double @llvm.fmuladd.f64(double %45, double %47, double %50)
store double %51, double* %27
%52 = load double*, double** %18
%53 = load i32, i32* %21
%54 = load i32, i32* %12
%55 = mul nsw i32 %53, %54
%56 = mul nsw i32 %55, 2
%57 = load i32, i32* %22
%58 = mul nsw i32 %57, 2
%59 = add nsw i32 %56, %58
%60 = add nsw i32 %59, 0
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %52, i64 %61
%63 = load double, double* %62
%64 = load double*, double** %18
%65 = load i32, i32* %21
%66 = load i32, i32* %12
%67 = mul nsw i32 %65, %66
%68 = mul nsw i32 %67, 2
%69 = load i32, i32* %22
%70 = mul nsw i32 %69, 2
%71 = add nsw i32 %68, %70
%72 = add nsw i32 %71, 0
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %64, i64 %73
%75 = load double, double* %74
%76 = load double*, double** %19
%77 = load i32, i32* %21
%78 = load i32, i32* %12
%79 = mul nsw i32 %77, %78
%80 = mul nsw i32 %79, 2
%81 = load i32, i32* %22
%82 = mul nsw i32 %81, 2
%83 = add nsw i32 %80, %82
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %76, i64 %85
%87 = load double, double* %86
%88 = load double*, double** %19
%89 = load i32, i32* %21
%90 = load i32, i32* %12
%91 = mul nsw i32 %89, %90
%92 = mul nsw i32 %91, 2
%93 = load i32, i32* %22
%94 = mul nsw i32 %93, 2
%95 = add nsw i32 %92, %94
%96 = add nsw i32 %95, 1
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %88, i64 %97
%99 = load double, double* %98
%100 = fmul double %87, %99
%101 = call double @llvm.fmuladd.f64(double %63, double %75, double %100)
%102 = load double*, double** %18
%103 = load i32, i32* %21
%104 = load i32, i32* %12
%105 = mul nsw i32 %103, %104
%106 = mul nsw i32 %105, 2
%107 = load i32, i32* %22
%108 = mul nsw i32 %107, 2
%109 = add nsw i32 %106, %108
%110 = add nsw i32 %109, 1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %102, i64 %111
%113 = load double, double* %112
%114 = load double*, double** %19
%115 = load i32, i32* %21
%116 = load i32, i32* %12
%117 = mul nsw i32 %115, %116
%118 = mul nsw i32 %117, 2
%119 = load i32, i32* %22
%120 = mul nsw i32 %119, 2
%121 = add nsw i32 %118, %120
%122 = add nsw i32 %121, 0
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %114, i64 %123
%125 = load double, double* %124
%126 = fadd double %113, %125
%127 = fmul double 5.000000e-01, %126
%128 = load double*, double** %18
%129 = load i32, i32* %21
%130 = load i32, i32* %12
%131 = mul nsw i32 %129, %130
%132 = mul nsw i32 %131, 2
%133 = load i32, i32* %22
%134 = mul nsw i32 %133, 2
%135 = add nsw i32 %132, %134
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %128, i64 %137
%139 = load double, double* %138
%140 = load double*, double** %19
%141 = load i32, i32* %21
%142 = load i32, i32* %12
%143 = mul nsw i32 %141, %142
%144 = mul nsw i32 %143, 2
%145 = load i32, i32* %22
%146 = mul nsw i32 %145, 2
%147 = add nsw i32 %144, %146
%148 = add nsw i32 %147, 0
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds double, double* %140, i64 %149
%151 = load double, double* %150
%152 = fadd double %139, %151
%153 = call double @llvm.fmuladd.f64(double %127, double %152, double %101)
store double %153, double* %24
%154 = load double, double* %24
%155 = fmul double 2.000000e+00, %154
%156 = call double @sqrt(double %155)
store double %156, double* %25
%157 = load double, double* %27
%158 = load double, double* %27
%159 = fmul double %157, %158
%160 = load double*, double** %17
%161 = load i32, i32* %21
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds double, double* %160, i64 %162
%164 = load double, double* %163
%165 = fmul double %159, %164
%166 = load double*, double** %17
%167 = load i32, i32* %21
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %166, i64 %168
%170 = load double, double* %169
%171 = fmul double %165, %170
%172 = load double, double* %25
%173 = fmul double %171, %172
%174 = load double*, double** %20
%175 = load i32, i32* %21
%176 = load i32, i32* %12
%177 = mul nsw i32 %175, %176
%178 = load i32, i32* %22
%179 = add nsw i32 %177, %178
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds double, double* %174, i64 %180
store double %173, double* %181
br label %182
182: ; preds = %37
%183 = load i32, i32* %22
%184 = add nsw i32 %183, 1
store i32 %184, i32* %22
br label %33
185: ; preds = %33
br label %186
186: ; preds = %185
%187 = load i32, i32* %21
%188 = add nsw i32 %187, 1
store i32 %188, i32* %21
br label %28
189: ; preds = %28
ret void
}

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