void calculateSubgridErrorStokes2D_GLS_tauRes(
    int nElements_global, int nQuadraturePoints_element, int nDOF_trial_element,
    int nSpace, double *tau0, double *tau1, double *pdeResidualP,
    double *dpdeResidualP_du, double *dpdeResidualP_dv, double *pdeResidualU,
    double *dpdeResidualU_dp, double *dpdeResidualU_du, double *pdeResidualV,
    double *dpdeResidualV_dp, double *dpdeResidualV_dv, double *subgridErrorP,
    double *dsubgridErrorP_du, double *dsubgridErrorP_dv, double *subgridErrorU,
    double *dsubgridErrorU_dp, double *dsubgridErrorU_du, double *subgridErrorV,
    double *dsubgridErrorV_dp, double *dsubgridErrorV_dv) {
  int eN, k, j;
  for (eN = 0; eN < nElements_global; eN++) {
    for (k = 0; k < nQuadraturePoints_element; k++) {
      subgridErrorU[eN * nQuadraturePoints_element + k] =
          -tau0[eN * nQuadraturePoints_element + k] *
          pdeResidualU[eN * nQuadraturePoints_element + k];
      subgridErrorV[eN * nQuadraturePoints_element + k] =
          -tau0[eN * nQuadraturePoints_element + k] *
          pdeResidualV[eN * nQuadraturePoints_element + k];
      subgridErrorP[eN * nQuadraturePoints_element + k] =
          -tau1[eN * nQuadraturePoints_element + k] *
          pdeResidualP[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] =
            -tau0[eN * nQuadraturePoints_element + k] *
            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] =
            -tau0[eN * nQuadraturePoints_element + k] *
            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] =
            -tau0[eN * nQuadraturePoints_element + k] *
            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] =
            -tau0[eN * nQuadraturePoints_element + k] *
            dpdeResidualV_dv[eN * nQuadraturePoints_element *
                                 nDOF_trial_element +
                             k * nDOF_trial_element + j];
        dsubgridErrorP_du[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            -tau1[eN * nQuadraturePoints_element + k] *
            dpdeResidualP_du[eN * nQuadraturePoints_element *
                                 nDOF_trial_element +
                             k * nDOF_trial_element + j];
        dsubgridErrorP_dv[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            -tau1[eN * nQuadraturePoints_element + k] *
            dpdeResidualP_dv[eN * nQuadraturePoints_element *
                                 nDOF_trial_element +
                             k * nDOF_trial_element + j];
      }
    }
  }
}


x86 assembly (clang, -O0):
<calculateSubgridErrorStokes2D_GLS_tauRes>:
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)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    15a2 <calculateSubgridErrorStokes2D_GLS_tauRes+0x4a2>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    158f <calculateSubgridErrorStokes2D_GLS_tauRes+0x48f>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    157c <calculateSubgridErrorStokes2D_GLS_tauRes+0x47c>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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    -0x2c(%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    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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    -0x2c(%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    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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    -0x2c(%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    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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    -0x2c(%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    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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    -0x2c(%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    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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    -0x2c(%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    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12a7 <calculateSubgridErrorStokes2D_GLS_tauRes+0x1a7>
jmp    1581 <calculateSubgridErrorStokes2D_GLS_tauRes+0x481>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1186 <calculateSubgridErrorStokes2D_GLS_tauRes+0x86>
jmp    1594 <calculateSubgridErrorStokes2D_GLS_tauRes+0x494>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1173 <calculateSubgridErrorStokes2D_GLS_tauRes+0x73>
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateSubgridErrorStokes2D_GLS_tauRes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %esi,-0x60(%rsp)
test   %edi,%edi
jle    137d <calculateSubgridErrorStokes2D_GLS_tauRes+0x27d>
mov    %edi,%eax
mov    %rax,-0x38(%rsp)
mov    %edx,%ecx
mov    %edx,%esi
mov    -0x60(%rsp),%eax
imul   %eax,%esi
mov    %esi,-0x48(%rsp)
shl    $0x3,%rcx
mov    %rcx,-0x18(%rsp)
movapd 0xec3(%rip),%xmm0
cltq
mov    %rax,-0x40(%rsp)
mov    %eax,%eax
mov    %rax,-0x30(%rsp)
xor    %eax,%eax
mov    %rax,-0x50(%rsp)
xor    %eax,%eax
mov    %rax,-0x58(%rsp)
mov    %edx,-0x44(%rsp)
jmp    118a <calculateSubgridErrorStokes2D_GLS_tauRes+0x8a>
nop
mov    -0x58(%rsp),%rcx
add    $0x1,%rcx
mov    -0x50(%rsp),%rax
add    -0x48(%rsp),%eax
mov    %rax,-0x50(%rsp)
mov    %rcx,%rax
mov    %rcx,-0x58(%rsp)
cmp    -0x38(%rsp),%rcx
je     137d <calculateSubgridErrorStokes2D_GLS_tauRes+0x27d>
cmpl   $0x0,-0x60(%rsp)
jle    1160 <calculateSubgridErrorStokes2D_GLS_tauRes+0x60>
mov    -0x58(%rsp),%rax
imul   -0x40(%rsp),%rax
mov    %rax,-0x28(%rsp)
mov    -0x50(%rsp),%rax
mov    %eax,-0x5c(%rsp)
xor    %ecx,%ecx
jmp    11c8 <calculateSubgridErrorStokes2D_GLS_tauRes+0xc8>
xchg   %ax,%ax
mov    -0x20(%rsp),%rcx
add    $0x1,%rcx
mov    -0x44(%rsp),%edx
add    %edx,-0x5c(%rsp)
cmp    -0x30(%rsp),%rcx
je     1160 <calculateSubgridErrorStokes2D_GLS_tauRes+0x60>
mov    -0x28(%rsp),%rax
mov    %rcx,-0x20(%rsp)
lea    (%rcx,%rax,1),%r12
movsd  (%r8,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mov    0x50(%rsp),%rax
mulsd  (%rax,%r12,8),%xmm1
mov    0x98(%rsp),%rax
movsd  %xmm1,(%rax,%r12,8)
movsd  (%r8,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mov    0x68(%rsp),%rax
mulsd  (%rax,%r12,8),%xmm1
mov    0xb0(%rsp),%rax
movsd  %xmm1,(%rax,%r12,8)
movsd  (%r9,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mov    0x38(%rsp),%rax
mulsd  (%rax,%r12,8),%xmm1
mov    0x80(%rsp),%rax
movsd  %xmm1,(%rax,%r12,8)
test   %edx,%edx
jle    11b0 <calculateSubgridErrorStokes2D_GLS_tauRes+0xb0>
movslq -0x5c(%rsp),%rax
mov    0x58(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    %rcx,-0x8(%rsp)
mov    0xa0(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    %rcx,-0x10(%rsp)
mov    0x60(%rsp),%rdx
lea    (%rdx,%rax,8),%rbx
mov    0xa8(%rsp),%rdx
lea    (%rdx,%rax,8),%rdi
mov    0x70(%rsp),%rdx
lea    (%rdx,%rax,8),%r15
mov    0xb8(%rsp),%rdx
lea    (%rdx,%rax,8),%rbp
mov    0x78(%rsp),%rdx
lea    (%rdx,%rax,8),%r10
mov    0xc0(%rsp),%rdx
lea    (%rdx,%rax,8),%r14
mov    0x40(%rsp),%rdx
lea    (%rdx,%rax,8),%r13
mov    0x88(%rsp),%rdx
lea    (%rdx,%rax,8),%rdx
mov    0x48(%rsp),%rsi
lea    (%rsi,%rax,8),%r11
mov    0x90(%rsp),%rsi
lea    (%rsi,%rax,8),%rsi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movsd  (%r8,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mov    -0x8(%rsp),%rcx
mulsd  (%rcx,%rax,1),%xmm1
mov    -0x10(%rsp),%rcx
movsd  %xmm1,(%rcx,%rax,1)
movsd  (%r8,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mulsd  (%rbx,%rax,1),%xmm1
movsd  %xmm1,(%rdi,%rax,1)
movsd  (%r8,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mulsd  (%r15,%rax,1),%xmm1
movsd  %xmm1,0x0(%rbp,%rax,1)
movsd  (%r8,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mulsd  (%r10,%rax,1),%xmm1
movsd  %xmm1,(%r14,%rax,1)
movsd  (%r9,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mulsd  0x0(%r13,%rax,1),%xmm1
movsd  %xmm1,(%rdx,%rax,1)
movsd  (%r9,%r12,8),%xmm1
xorpd  %xmm0,%xmm1
mulsd  (%r11,%rax,1),%xmm1
movsd  %xmm1,(%rsi,%rax,1)
add    $0x8,%rax
cmp    %rax,-0x18(%rsp)
jne    12e0 <calculateSubgridErrorStokes2D_GLS_tauRes+0x1e0>
jmp    11b0 <calculateSubgridErrorStokes2D_GLS_tauRes+0xb0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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