void calculateSubgridErrorStokes3D_GLS_velocity_sd(
    int nElements_global, int nQuadraturePoints_element, int nDOF_trial_element,
    int nSpace, double *elementDiameter, double *a, double *pdeResidualU,
    double *dpdeResidualU_dp, double *dpdeResidualU_du, double *pdeResidualV,
    double *dpdeResidualV_dp, double *dpdeResidualV_dv, double *pdeResidualW,
    double *dpdeResidualW_dp, double *dpdeResidualW_dw, double *subgridErrorU,
    double *dsubgridErrorU_dp, double *dsubgridErrorU_du, double *subgridErrorV,
    double *dsubgridErrorV_dp, double *dsubgridErrorV_dv, double *subgridErrorW,
    double *dsubgridErrorW_dp, double *dsubgridErrorW_dw) {
  int eN, k, nSpace2 = nSpace * nSpace, j;
  double h, viscosity, tau1;
  for (eN = 0; eN < nElements_global; eN++) {
    h = elementDiameter[eN];
    for (k = 0; k < nQuadraturePoints_element; k++) {
      viscosity = a[eN * nQuadraturePoints_element * nSpace + k * nSpace];
      tau1 = h * h / (12.0 * viscosity);
      subgridErrorU[eN * nQuadraturePoints_element + k] =
          tau1 * pdeResidualU[eN * nQuadraturePoints_element + k];
      subgridErrorV[eN * nQuadraturePoints_element + k] =
          tau1 * pdeResidualV[eN * nQuadraturePoints_element + k];
      subgridErrorW[eN * nQuadraturePoints_element + k] =
          tau1 * pdeResidualW[eN * nQuadraturePoints_element + k];
      for (j = 0; j < nDOF_trial_element; j++) {
        dsubgridErrorU_dp[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            tau1 * dpdeResidualU_dp[eN * nQuadraturePoints_element *
                                        nDOF_trial_element +
                                    k * nDOF_trial_element + j];
        dsubgridErrorU_du[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            tau1 * dpdeResidualU_du[eN * nQuadraturePoints_element *
                                        nDOF_trial_element +
                                    k * nDOF_trial_element + j];
        dsubgridErrorV_dp[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            tau1 * dpdeResidualV_dp[eN * nQuadraturePoints_element *
                                        nDOF_trial_element +
                                    k * nDOF_trial_element + j];
        dsubgridErrorV_dv[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            tau1 * dpdeResidualV_dv[eN * nQuadraturePoints_element *
                                        nDOF_trial_element +
                                    k * nDOF_trial_element + j];
        dsubgridErrorW_dp[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            tau1 * dpdeResidualW_dp[eN * nQuadraturePoints_element *
                                        nDOF_trial_element +
                                    k * nDOF_trial_element + j];
        dsubgridErrorW_dw[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            tau1 * dpdeResidualW_dw[eN * nQuadraturePoints_element *
                                        nDOF_trial_element +
                                    k * nDOF_trial_element + j];
      }
    }
  }
}


x86 assembly (clang, -O0):
<calculateSubgridErrorStokes3D_GLS_velocity_sd>:
push   %rbp
mov    %rsp,%rbp
mov    0x98(%rbp),%rax
mov    0x90(%rbp),%rax
mov    0x88(%rbp),%rax
mov    0x80(%rbp),%rax
mov    0x78(%rbp),%rax
mov    0x70(%rbp),%rax
mov    0x68(%rbp),%rax
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    149b <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x39b>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1488 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x388>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0x10(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0x10(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xe1b(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x58(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    0x28(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x70(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    0x40(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x88(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1475 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x375>
movsd  -0x48(%rbp),%xmm0
mov    0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x60(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x68(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x78(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    0x38(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x80(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    0x48(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x90(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    0x50(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x98(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%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    1290 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x190>
jmp    147a <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x37a>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a2 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0xa2>
jmp    148d <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x38d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117d <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x7d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateSubgridErrorStokes3D_GLS_velocity_sd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,-0x18(%rsp)
mov    %r8,-0x30(%rsp)
mov    %ecx,-0x38(%rsp)
mov    %esi,-0x54(%rsp)
test   %edi,%edi
jle    136b <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x26b>
mov    %edx,%ebp
mov    %edi,%eax
mov    %rax,-0x28(%rsp)
mov    %edx,%r11d
mov    %edx,%ecx
mov    -0x54(%rsp),%eax
imul   %eax,%ecx
mov    %ecx,-0x40(%rsp)
shl    $0x3,%r11
movsd  0xeb7(%rip),%xmm0
mov    %eax,%eax
mov    %rax,-0x20(%rsp)
xor    %eax,%eax
mov    %rax,-0x48(%rsp)
xor    %eax,%eax
mov    %rax,-0x50(%rsp)
mov    %edx,-0x3c(%rsp)
jmp    119a <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x9a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    -0x50(%rsp),%rcx
add    $0x1,%rcx
mov    -0x48(%rsp),%rax
add    -0x40(%rsp),%eax
mov    %rax,-0x48(%rsp)
mov    %rcx,%rax
mov    %rcx,-0x50(%rsp)
cmp    -0x28(%rsp),%rcx
je     136b <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x26b>
cmpl   $0x0,-0x54(%rsp)
jle    1170 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x70>
mov    -0x30(%rsp),%rax
mov    -0x50(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm1
imul   -0x54(%rsp),%ecx
mov    %rcx,-0x10(%rsp)
mulsd  %xmm1,%xmm1
mov    -0x48(%rsp),%rax
mov    %eax,%esi
xor    %ecx,%ecx
jmp    11e6 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0xe6>
nopl   0x0(%rax)
mov    -0x8(%rsp),%rcx
add    $0x1,%rcx
mov    -0x3c(%rsp),%ebp
add    %ebp,%esi
cmp    -0x20(%rsp),%rcx
je     1170 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x70>
mov    -0x10(%rsp),%rax
mov    %rcx,-0x8(%rsp)
add    %ecx,%eax
movslq %eax,%rcx
imul   -0x38(%rsp),%eax
cltq
mov    -0x18(%rsp),%rdx
movsd  (%rdx,%rax,8),%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm1,%xmm2
divsd  %xmm3,%xmm2
mov    0x38(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm2,%xmm3
mov    0x80(%rsp),%rax
movsd  %xmm3,(%rax,%rcx,8)
mov    0x50(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm2,%xmm3
mov    0x98(%rsp),%rax
movsd  %xmm3,(%rax,%rcx,8)
mov    0x68(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm2,%xmm3
mov    0xb0(%rsp),%rax
movsd  %xmm3,(%rax,%rcx,8)
test   %ebp,%ebp
jle    11d0 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0xd0>
movslq %esi,%rdx
mov    0x40(%rsp),%rax
lea    (%rax,%rdx,8),%rax
mov    0x88(%rsp),%rcx
lea    (%rcx,%rdx,8),%rbx
mov    0x48(%rsp),%rcx
lea    (%rcx,%rdx,8),%r12
mov    0x90(%rsp),%rcx
lea    (%rcx,%rdx,8),%rbp
mov    0x58(%rsp),%rcx
lea    (%rcx,%rdx,8),%r8
mov    0xa0(%rsp),%rcx
lea    (%rcx,%rdx,8),%r15
mov    0x60(%rsp),%rcx
lea    (%rcx,%rdx,8),%r10
mov    0xa8(%rsp),%rcx
lea    (%rcx,%rdx,8),%rdi
mov    0x70(%rsp),%rcx
lea    (%rcx,%rdx,8),%r9
mov    0xb8(%rsp),%rcx
lea    (%rcx,%rdx,8),%rcx
mov    %esi,-0x34(%rsp)
mov    0x78(%rsp),%rsi
lea    (%rsi,%rdx,8),%r14
mov    0xc0(%rsp),%rsi
lea    (%rsi,%rdx,8),%r13
mov    -0x34(%rsp),%esi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movsd  (%rax,%rdx,1),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%rbx,%rdx,1)
movsd  (%r12,%rdx,1),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,0x0(%rbp,%rdx,1)
movsd  (%r8,%rdx,1),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%r15,%rdx,1)
movsd  (%r10,%rdx,1),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%rdi,%rdx,1)
movsd  (%r9,%rdx,1),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%rcx,%rdx,1)
movsd  (%r14,%rdx,1),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,0x0(%r13,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%r11
jne    1300 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0x200>
jmp    11d0 <calculateSubgridErrorStokes3D_GLS_velocity_sd+0xd0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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