#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double sqrt(double);
void calculateSubgridErrorStokes2D_1(
    int nElements_global, int nQuadraturePoints_element, int nDOF_trial_element,
    int nSpace, double *elementDiameter, double *u, double *v, double *a,
    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_dp, double *dsubgridErrorP_du,
    double *dsubgridErrorP_dv, double *subgridErrorU, double *dsubgridErrorU_dp,
    double *dsubgridErrorU_du, double *dsubgridErrorU_dv, double *subgridErrorV,
    double *dsubgridErrorV_dp, double *dsubgridErrorV_du,
    double *dsubgridErrorV_dv) {
  int eN, k, nSpace2 = nSpace * nSpace, j;
  double h, velocity_norm, viscosity, tau1, tau2, U, V;
  for (eN = 0; eN < nElements_global; eN++) {
    h = elementDiameter[eN];
    for (k = 0; k < nQuadraturePoints_element; k++) {
      U = u[eN * nQuadraturePoints_element + k];
      V = v[eN * nQuadraturePoints_element + k];
      velocity_norm = sqrt(U * U + V * V);
      viscosity = a[eN * nQuadraturePoints_element * nSpace2 + k * nSpace2];
      tau1 =
          1.0 / (4.0 * viscosity / (h * h) + 2.0 * velocity_norm / h + 1.0e-8);
      tau2 = 4.0 * viscosity + 2.0 * velocity_norm * h;
      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];
      tau2 = 6.0 * viscosity;
      subgridErrorP[eN * nQuadraturePoints_element + k] =
          tau2 * 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] =
            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];
        dsubgridErrorP_du[eN * nQuadraturePoints_element * nDOF_trial_element +
                          k * nDOF_trial_element + j] =
            tau2 * 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] =
            tau2 * dpdeResidualP_dv[eN * nQuadraturePoints_element *
                                        nDOF_trial_element +
                                    k * nDOF_trial_element + j];
      }
    }
  }
}


x86 assembly (clang, -O0):
<calculateSubgridErrorStokes2D_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0xc0(%rbp),%rax
mov    0xb8(%rbp),%rax
mov    0xb0(%rbp),%rax
mov    0xa8(%rbp),%rax
mov    0xa0(%rbp),%rax
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    15c3 <calculateSubgridErrorStokes2D_1+0x4b3>
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    15b0 <calculateSubgridErrorStokes2D_1+0x4a0>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
mov    0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%edx
imul   -0x2c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xda2(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd8f(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xd89(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xd75(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0xd57(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  0xd3d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xd16(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    0x38(%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)
movsd  -0x50(%rbp),%xmm0
mov    0x50(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0xa8(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xc90(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x68(%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    159d <calculateSubgridErrorStokes2D_1+0x48d>
movsd  -0x50(%rbp),%xmm0
mov    0x40(%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  -0x50(%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    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)
movsd  -0x50(%rbp),%xmm0
mov    0x58(%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    0xb0(%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  -0x50(%rbp),%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
mulsd  (%rax,%rcx,8),%xmm0
mov    0xc0(%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  -0x58(%rbp),%xmm0
mov    0x28(%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  -0x58(%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    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)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    13b2 <calculateSubgridErrorStokes2D_1+0x2a2>
jmp    15a2 <calculateSubgridErrorStokes2D_1+0x492>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d9 <calculateSubgridErrorStokes2D_1+0xc9>
jmp    15b5 <calculateSubgridErrorStokes2D_1+0x4a5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b4 <calculateSubgridErrorStokes2D_1+0xa4>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateSubgridErrorStokes2D_1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,-0x28(%rsp)
mov    %ecx,-0x54(%rsp)
mov    %esi,-0x50(%rsp)
test   %edi,%edi
jle    138b <calculateSubgridErrorStokes2D_1+0x28b>
mov    -0x54(%rsp),%eax
imul   %eax,%eax
mov    %eax,-0x54(%rsp)
mov    %edi,%eax
mov    %rax,-0x20(%rsp)
mov    %edx,%r8d
mov    %edx,%ecx
mov    -0x50(%rsp),%eax
imul   %eax,%ecx
mov    %ecx,-0x38(%rsp)
shl    $0x3,%r8
movsd  0xeb3(%rip),%xmm0
movsd  0xeb3(%rip),%xmm1
cltq
mov    %rax,-0x30(%rsp)
mov    %eax,%eax
mov    %rax,-0x18(%rsp)
xor    %eax,%eax
mov    %rax,-0x40(%rsp)
xor    %eax,%eax
mov    %rax,-0x48(%rsp)
mov    %edx,-0x34(%rsp)
jmp    11aa <calculateSubgridErrorStokes2D_1+0xaa>
nopw   0x0(%rax,%rax,1)
mov    -0x48(%rsp),%rcx
add    $0x1,%rcx
mov    -0x40(%rsp),%rax
add    -0x38(%rsp),%eax
mov    %rax,-0x40(%rsp)
mov    %rcx,%rax
mov    %rcx,-0x48(%rsp)
cmp    -0x20(%rsp),%rcx
je     138b <calculateSubgridErrorStokes2D_1+0x28b>
cmpl   $0x0,-0x50(%rsp)
jle    1180 <calculateSubgridErrorStokes2D_1+0x80>
mov    -0x28(%rsp),%rax
mov    -0x48(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm2
imul   -0x30(%rsp),%rcx
mov    %rcx,-0x10(%rsp)
mulsd  %xmm2,%xmm2
mov    -0x40(%rsp),%rax
mov    %eax,-0x4c(%rsp)
xor    %ecx,%ecx
jmp    11f8 <calculateSubgridErrorStokes2D_1+0xf8>
nopl   0x0(%rax)
mov    -0x8(%rsp),%rcx
add    $0x1,%rcx
mov    -0x34(%rsp),%edx
add    %edx,-0x4c(%rsp)
cmp    -0x18(%rsp),%rcx
je     1180 <calculateSubgridErrorStokes2D_1+0x80>
mov    -0x10(%rsp),%rax
mov    %rcx,-0x8(%rsp)
add    %rcx,%rax
mov    -0x54(%rsp),%ecx
imul   %eax,%ecx
movslq %ecx,%rcx
mov    0x40(%rsp),%rsi
movsd  (%rsi,%rcx,8),%xmm3
movapd %xmm3,%xmm5
mulsd  %xmm0,%xmm5
movapd %xmm2,%xmm4
divsd  %xmm5,%xmm4
mov    0x60(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm5
mulsd  %xmm4,%xmm5
mov    0xb0(%rsp),%rcx
movsd  %xmm5,(%rcx,%rax,8)
mov    0x78(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm5
mulsd  %xmm4,%xmm5
mov    0xd0(%rsp),%rcx
movsd  %xmm5,(%rcx,%rax,8)
mulsd  %xmm1,%xmm3
mov    0x48(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm5
mulsd  %xmm3,%xmm5
mov    0x90(%rsp),%rcx
movsd  %xmm5,(%rcx,%rax,8)
test   %edx,%edx
jle    11e0 <calculateSubgridErrorStokes2D_1+0xe0>
movslq -0x4c(%rsp),%rdx
mov    0x68(%rsp),%rax
lea    (%rax,%rdx,8),%r13
mov    0xb8(%rsp),%rax
lea    (%rax,%rdx,8),%rbx
mov    0x70(%rsp),%rax
lea    (%rax,%rdx,8),%rax
mov    0xc0(%rsp),%rcx
lea    (%rcx,%rdx,8),%rdi
mov    0x80(%rsp),%rcx
lea    (%rcx,%rdx,8),%r14
mov    0xd8(%rsp),%rcx
lea    (%rcx,%rdx,8),%r11
mov    0x88(%rsp),%rcx
lea    (%rcx,%rdx,8),%r12
mov    0xe8(%rsp),%rcx
lea    (%rcx,%rdx,8),%rbp
mov    0x50(%rsp),%rcx
lea    (%rcx,%rdx,8),%r9
mov    0xa0(%rsp),%rcx
lea    (%rcx,%rdx,8),%rcx
mov    0x58(%rsp),%rsi
lea    (%rsi,%rdx,8),%r10
mov    0xa8(%rsp),%rsi
lea    (%rsi,%rdx,8),%r15
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  0x0(%r13,%rdx,1),%xmm5
mulsd  %xmm4,%xmm5
movsd  %xmm5,(%rbx,%rdx,1)
movsd  (%rax,%rdx,1),%xmm5
mulsd  %xmm4,%xmm5
movsd  %xmm5,(%rdi,%rdx,1)
movsd  (%r14,%rdx,1),%xmm5
mulsd  %xmm4,%xmm5
movsd  %xmm5,(%r11,%rdx,1)
movsd  (%r12,%rdx,1),%xmm5
mulsd  %xmm4,%xmm5
movsd  %xmm5,0x0(%rbp,%rdx,1)
movsd  (%r9,%rdx,1),%xmm5
mulsd  %xmm3,%xmm5
movsd  %xmm5,(%rcx,%rdx,1)
movsd  (%r10,%rdx,1),%xmm5
mulsd  %xmm3,%xmm5
movsd  %xmm5,(%r15,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%r8
jne    1320 <calculateSubgridErrorStokes2D_1+0x220>
jmp    11e0 <calculateSubgridErrorStokes2D_1+0xe0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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