void calculateSubgridErrorStokes_GLS_tau_sd(int nElements_global,
                                            int nQuadraturePoints_element,
                                            int nSpace, double *elementDiameter,
                                            double *pfac, double *a,
                                            double *tau0, double *tau1) {
  int eN, k;
  double h, viscosity, density;
  for (eN = 0; eN < nElements_global; eN++) {
    h = elementDiameter[eN];
    for (k = 0; k < nQuadraturePoints_element; k++) {
      viscosity = a[eN * nQuadraturePoints_element * nSpace * nSpace +
                    k * nSpace * nSpace];
      density = pfac[eN * nQuadraturePoints_element * nSpace + k * nSpace + 0];
      tau0[eN * nQuadraturePoints_element + k] =
          1.0 / (4.0 * viscosity / (h * h));
      tau1[eN * nQuadraturePoints_element + k] = 4.0 * viscosity / density;
    }
  }
}


x86 assembly (clang, -O0):
<calculateSubgridErrorStokes_GLS_tau_sd>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1234 <calculateSubgridErrorStokes_GLS_tau_sd+0x134>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1221 <calculateSubgridErrorStokes_GLS_tau_sd+0x121>
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x30(%rbp),%edx
imul   -0xc(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x30(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe4a(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe37(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xe0d(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    114d <calculateSubgridErrorStokes_GLS_tau_sd+0x4d>
jmp    1226 <calculateSubgridErrorStokes_GLS_tau_sd+0x126>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1128 <calculateSubgridErrorStokes_GLS_tau_sd+0x28>
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateSubgridErrorStokes_GLS_tau_sd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x8(%rsp)
test   %edi,%edi
jle    1487 <calculateSubgridErrorStokes_GLS_tau_sd+0x387>
mov    %edx,%r11d
mov    0x58(%rsp),%r12
mov    0x50(%rsp),%r10
movslq %esi,%rax
mov    %edi,%ecx
mov    %rcx,0x10(%rsp)
mov    %eax,%ebx
lea    -0x1(%rbx),%rcx
mov    %rcx,-0x20(%rsp)
lea    (%r9,%rbx,8),%rcx
mov    %rcx,-0x30(%rsp)
lea    (%r8,%rbx,8),%rcx
mov    %rcx,-0x38(%rsp)
mov    %ebx,%ecx
and    $0xfffffffe,%ecx
mov    %rcx,-0x40(%rsp)
mov    %rax,-0x28(%rsp)
lea    0x0(,%rax,8),%rdi
mov    %edx,%eax
imul   %esi,%eax
mov    %eax,-0x44(%rsp)
lea    (%r11,%r11,1),%eax
mov    %eax,-0x48(%rsp)
mov    %edx,%r15d
imul   %r15d,%r15d
mov    %r15d,%ecx
imul   %esi,%ecx
lea    (%r15,%r15,1),%eax
mov    %eax,-0x4c(%rsp)
movsd  0xe8c(%rip),%xmm0
movsd  0xe8c(%rip),%xmm1
movapd 0xe5b(%rip),%xmm8
movapd 0xe62(%rip),%xmm9
xor    %r13d,%r13d
movl   $0x0,-0x64(%rsp)
movl   $0x0,-0x74(%rsp)
xor    %ebp,%ebp
mov    %esi,-0x78(%rsp)
mov    %rdi,-0x70(%rsp)
mov    %ecx,-0x7c(%rsp)
jmp    1208 <calculateSubgridErrorStokes_GLS_tau_sd+0x108>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbp
add    %rdi,%r12
add    %rdi,%r10
mov    -0x74(%rsp),%eax
add    -0x44(%rsp),%eax
mov    %eax,-0x74(%rsp)
add    %ecx,-0x64(%rsp)
add    %esi,%r13d
cmp    0x10(%rsp),%rbp
je     1487 <calculateSubgridErrorStokes_GLS_tau_sd+0x387>
test   %esi,%esi
jle    11e0 <calculateSubgridErrorStokes_GLS_tau_sd+0xe0>
mov    0x8(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm4
mulsd  %xmm4,%xmm4
cmp    $0x1,%esi
je     1400 <calculateSubgridErrorStokes_GLS_tau_sd+0x300>
cmp    $0x1,%r11d
jne    1400 <calculateSubgridErrorStokes_GLS_tau_sd+0x300>
mov    %ebp,%edx
imul   %esi,%edx
mov    -0x20(%rsp),%rdi
lea    (%rdx,%rdi,1),%eax
cmp    %edx,%eax
jl     1466 <calculateSubgridErrorStokes_GLS_tau_sd+0x366>
mov    %rdi,%rax
shr    $0x20,%rax
mov    $0x0,%eax
mov    -0x70(%rsp),%rdi
jne    1402 <calculateSubgridErrorStokes_GLS_tau_sd+0x302>
mov    %rbp,%rax
imul   -0x28(%rsp),%rax
lea    (%rax,%rbx,1),%rdi
mov    0x50(%rsp),%rsi
lea    (%rsi,%rax,8),%r14
lea    (%rsi,%rdi,8),%rcx
mov    %rcx,-0x58(%rsp)
mov    0x58(%rsp),%rsi
lea    (%rsi,%rax,8),%rax
mov    %rax,-0x8(%rsp)
lea    (%rsi,%rdi,8),%rax
mov    %rax,(%rsp)
movslq %edx,%rdx
lea    (%r9,%rdx,8),%rcx
mov    %rcx,-0x60(%rsp)
mov    -0x30(%rsp),%rsi
lea    (%rsi,%rdx,8),%rcx
mov    %rcx,-0x18(%rsp)
mov    -0x38(%rsp),%rsi
lea    (%rsi,%rdx,8),%rsi
mov    %rsi,-0x10(%rsp)
cmp    %rax,%r14
setb   -0x80(%rsp)
mov    -0x58(%rsp),%rsi
mov    -0x8(%rsp),%rdi
cmp    %rsi,%rdi
setb   -0x7d(%rsp)
cmp    %rcx,%r14
setb   -0x7e(%rsp)
cmp    %rsi,-0x60(%rsp)
setb   -0x7f(%rsp)
mov    -0x10(%rsp),%rax
cmp    %rax,%r14
lea    (%r8,%rdx,8),%rdx
setb   %r14b
cmp    %rsi,%rdx
setb   -0x58(%rsp)
mov    %rdi,%rcx
cmp    -0x18(%rsp),%rdi
setb   %sil
mov    (%rsp),%rdi
cmp    %rdi,-0x60(%rsp)
setb   -0x60(%rsp)
cmp    %rax,%rcx
setb   %al
cmp    %rdi,%rdx
setb   %dl
mov    -0x7d(%rsp),%cl
test   %cl,-0x80(%rsp)
jne    146f <calculateSubgridErrorStokes_GLS_tau_sd+0x36f>
mov    %dl,-0x80(%rsp)
mov    %esi,%edx
mov    -0x7f(%rsp),%cl
and    %cl,-0x7e(%rsp)
mov    -0x78(%rsp),%esi
mov    -0x70(%rsp),%rdi
jne    147c <calculateSubgridErrorStokes_GLS_tau_sd+0x37c>
and    -0x58(%rsp),%r14b
mov    -0x7c(%rsp),%ecx
jne    1400 <calculateSubgridErrorStokes_GLS_tau_sd+0x300>
and    -0x60(%rsp),%dl
jne    1400 <calculateSubgridErrorStokes_GLS_tau_sd+0x300>
mov    %eax,%edx
mov    $0x0,%eax
and    -0x80(%rsp),%dl
jne    1402 <calculateSubgridErrorStokes_GLS_tau_sd+0x302>
movapd %xmm4,%xmm5
unpcklpd %xmm4,%xmm5
mov    -0x64(%rsp),%eax
mov    -0x74(%rsp),%ecx
mov    %ecx,%edx
xor    %edi,%edi
mov    -0x40(%rsp),%rsi
mov    -0x48(%rsp),%ecx
mov    -0x4c(%rsp),%r14d
nopw   0x0(%rax,%rax,1)
cltq
movupd (%r9,%rax,8),%xmm6
movslq %edx,%rdx
mulpd  %xmm8,%xmm6
movapd %xmm6,%xmm7
divpd  %xmm5,%xmm7
movupd (%r8,%rdx,8),%xmm2
movapd %xmm9,%xmm3
divpd  %xmm7,%xmm3
movupd %xmm3,(%r10,%rdi,8)
divpd  %xmm2,%xmm6
movupd %xmm6,(%r12,%rdi,8)
add    $0x2,%rdi
add    %ecx,%edx
add    %r14d,%eax
cmp    %rdi,%rsi
jne    13a0 <calculateSubgridErrorStokes_GLS_tau_sd+0x2a0>
mov    %rsi,%rax
cmp    %rbx,%rsi
mov    -0x78(%rsp),%esi
mov    -0x70(%rsp),%rdi
mov    -0x7c(%rsp),%ecx
je     11e0 <calculateSubgridErrorStokes_GLS_tau_sd+0xe0>
jmp    1402 <calculateSubgridErrorStokes_GLS_tau_sd+0x302>
xor    %eax,%eax
lea    (%rax,%r13,1),%r14d
mov    %r15d,%edx
imul   %r14d,%edx
imul   %r11d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %edx,%rdx
movslq %r14d,%r14
movsd  (%r9,%rdx,8),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm3
divsd  %xmm4,%xmm3
movapd %xmm1,%xmm5
divsd  %xmm3,%xmm5
divsd  (%r8,%r14,8),%xmm2
movsd  %xmm5,(%r10,%rax,8)
movsd  %xmm2,(%r12,%rax,8)
add    $0x1,%rax
add    %r15d,%edx
add    %r11d,%r14d
cmp    %rax,%rbx
jne    1420 <calculateSubgridErrorStokes_GLS_tau_sd+0x320>
jmp    11e0 <calculateSubgridErrorStokes_GLS_tau_sd+0xe0>
xor    %eax,%eax
mov    -0x70(%rsp),%rdi
jmp    1402 <calculateSubgridErrorStokes_GLS_tau_sd+0x302>
xor    %eax,%eax
mov    -0x78(%rsp),%esi
mov    -0x70(%rsp),%rdi
jmp    147e <calculateSubgridErrorStokes_GLS_tau_sd+0x37e>
xor    %eax,%eax
mov    -0x7c(%rsp),%ecx
jmp    1402 <calculateSubgridErrorStokes_GLS_tau_sd+0x302>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @calculateSubgridErrorStokes_GLS_tau_sd(i32 %0, i32 %1, i32 %2, double* nocapture %3, double* nocapture %4, double* nocapture %5, double* nocapture writeonly %6, double* nocapture writeonly %7) {
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %124
10: ; preds = %8
%11 = icmp sgt i32 %1, 0
%12 = sext i32 %1 to i64
%13 = zext i32 %0 to i64
%14 = zext i32 %1 to i64
%15 = add nsw i64 %14, -1
%16 = getelementptr double, double* %5, i64 %14
%17 = getelementptr double, double* %4, i64 %14
%18 = icmp eq i32 %1, 1
%19 = icmp ne i32 %2, 1
%20 = trunc i64 %15 to i32
%21 = icmp ugt i64 %15, 4294967295
%22 = and i64 %14, 4294967294
%23 = icmp eq i64 %22, %14
br label %24
24: ; preds = %10, %121
%25 = phi i64 [ 0, %10 ], [ %122, %121 ]
%26 = mul i64 %25, %12
%27 = getelementptr double, double* %6, i64 %26
%28 = add i64 %26, %14
%29 = getelementptr double, double* %6, i64 %28
%30 = getelementptr double, double* %7, i64 %26
%31 = getelementptr double, double* %7, i64 %28
%32 = trunc i64 %25 to i32
%33 = mul i32 %32, %1
%34 = sext i32 %33 to i64
%35 = getelementptr double, double* %5, i64 %34
%36 = getelementptr double, double* %16, i64 %34
%37 = getelementptr double, double* %4, i64 %34
%38 = getelementptr double, double* %17, i64 %34
%39 = trunc i64 %25 to i32
%40 = mul i32 %39, %1
br i1 %11, label %41, label %121
41: ; preds = %24
%42 = getelementptr inbounds double, double* %3, i64 %25
%43 = load double, double* %42
%44 = mul nsw i64 %25, %12
%45 = fmul double %43, %43
br i1 %18, label %99, label %46
46: ; preds = %41
%47 = add i32 %40, %20
%48 = icmp slt i32 %47, %40
%49 = or i1 %48, %21
%50 = or i1 %19, %49
br i1 %50, label %99, label %51
51: ; preds = %46
%52 = icmp ult double* %27, %31
%53 = icmp ult double* %30, %29
%54 = and i1 %52, %53
%55 = icmp ult double* %27, %36
%56 = icmp ult double* %35, %29
%57 = and i1 %55, %56
%58 = or i1 %54, %57
%59 = icmp ult double* %27, %38
%60 = icmp ult double* %37, %29
%61 = and i1 %59, %60
%62 = or i1 %58, %61
%63 = icmp ult double* %30, %36
%64 = icmp ult double* %35, %31
%65 = and i1 %63, %64
%66 = or i1 %62, %65
%67 = icmp ult double* %30, %38
%68 = icmp ult double* %37, %31
%69 = and i1 %67, %68
%70 = or i1 %66, %69
br i1 %70, label %99, label %71
71: ; preds = %51
%72 = insertelement <2 x double> poison, double %45, i64 0
%73 = shufflevector <2 x double> %72, <2 x double> poison, <2 x i32> zeroinitializer
br label %74
74: ; preds = %74, %71
%75 = phi i64 [ 0, %71 ], [ %96, %74 ]
%76 = add nsw i64 %75, %44
%77 = trunc i64 %76 to i32
%78 = mul i32 %77, %2
%79 = mul i32 %78, %2
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %5, i64 %80
%82 = bitcast double* %81 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = sext i32 %78 to i64
%85 = getelementptr inbounds double, double* %4, i64 %84
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = fmul <2 x double> %83, <double 4.000000e+00, double 4.000000e+00>
%89 = fdiv <2 x double> %88, %73
%90 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %89
%91 = getelementptr inbounds double, double* %6, i64 %76
%92 = bitcast double* %91 to <2 x double>*
store <2 x double> %90, <2 x double>* %92
%93 = fdiv <2 x double> %88, %87
%94 = getelementptr inbounds double, double* %7, i64 %76
%95 = bitcast double* %94 to <2 x double>*
store <2 x double> %93, <2 x double>* %95
%96 = add nuw i64 %75, 2
%97 = icmp eq i64 %96, %22
br i1 %97, label %98, label %74
98: ; preds = %74
br i1 %23, label %121, label %99
99: ; preds = %51, %46, %41, %98
%100 = phi i64 [ 0, %51 ], [ 0, %46 ], [ 0, %41 ], [ %22, %98 ]
br label %101
101: ; preds = %99, %101
%102 = phi i64 [ %119, %101 ], [ %100, %99 ]
%103 = add nsw i64 %102, %44
%104 = trunc i64 %103 to i32
%105 = mul i32 %104, %2
%106 = mul i32 %105, %2
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %5, i64 %107
%109 = load double, double* %108
%110 = sext i32 %105 to i64
%111 = getelementptr inbounds double, double* %4, i64 %110
%112 = load double, double* %111
%113 = fmul double %109, 4.000000e+00
%114 = fdiv double %113, %45
%115 = fdiv double 1.000000e+00, %114
%116 = getelementptr inbounds double, double* %6, i64 %103
store double %115, double* %116
%117 = fdiv double %113, %112
%118 = getelementptr inbounds double, double* %7, i64 %103
store double %117, double* %118
%119 = add nuw nsw i64 %102, 1
%120 = icmp eq i64 %119, %14
br i1 %120, label %121, label %101
121: ; preds = %101, %98, %24
%122 = add nuw nsw i64 %25, 1
%123 = icmp eq i64 %122, %13
br i1 %123, label %124, label %24
124: ; preds = %121, %8
ret void
}