#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 fabs(double);
double fmax(double, double);
int /*<<< orphan*/ printf(char *, double, double, double);
double sqrt(double);
void calculateSubgridErrorNavierStokes2D_GLS_tau(
    int nElements_global, int nQuadraturePoints_element, int nSpace,
    double hFactor, double *elementDiameter, double *dmt, double *dm, double *f,
    double *a, double *tau0, double *tau1, double *cfl) {
  int eN, k, nSpace2 = nSpace * nSpace, I;
  double h, oneByAbsdt, density, viscosity, Re_max = 0.0, CFL_max = 0.0, nrm_v;
  for (eN = 0; eN < nElements_global; eN++) {
    h = hFactor * elementDiameter[eN];
    for (k = 0; k < nQuadraturePoints_element; k++) {
      density = dm[eN * nQuadraturePoints_element + k];
      viscosity = a[eN * nQuadraturePoints_element * nSpace2 + k * nSpace2 +
                    nSpace + 1];
      nrm_v = 0.0;
      for (I = 0; I < nSpace; I++)
        nrm_v += f[eN * nQuadraturePoints_element * nSpace + k * nSpace + I] *
                 f[eN * nQuadraturePoints_element * nSpace + k * nSpace + I];
      nrm_v = sqrt(nrm_v);
      Re_max = fmax(nrm_v * h / (viscosity / density), Re_max);
      CFL_max = fmax(nrm_v / h, CFL_max);
      cfl[eN * nQuadraturePoints_element + k] = nrm_v / h;
      if (0) {
        oneByAbsdt = 10.0 * (density * nrm_v / h);
      } else {
        oneByAbsdt = fabs(dmt[eN * nQuadraturePoints_element + k]);
      }
      tau0[eN * nQuadraturePoints_element + k] =
          1.0 /
          (4.0 * viscosity / (h * h) + 2.0 * density * nrm_v / h + oneByAbsdt);
      tau1[eN * nQuadraturePoints_element + k] =
          4.0 * viscosity + 2.0 * density * nrm_v * h + oneByAbsdt * h * h;
      printf("nrm_v %12.5e tau_v %12.5e tau_p %12.5e \n", nrm_v,
             tau0[eN * nQuadraturePoints_element + k],
             tau1[eN * nQuadraturePoints_element + k]);
    }
  }
}


x86 assembly (clang, -O0):
<calculateSubgridErrorNavierStokes2D_GLS_tau>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
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)
movsd  %xmm0,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1452 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x332>
movsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    143f <calculateSubgridErrorNavierStokes2D_GLS_tau+0x31f>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
add    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1277 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x157>
mov    0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x38(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x38(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1205 <calculateSubgridErrorNavierStokes2D_GLS_tau+0xe5>
movsd  -0x78(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm3
mulsd  -0x48(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
divsd  %xmm0,%xmm3
movsd  -0x68(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x78(%rbp),%xmm3
divsd  -0x48(%rbp),%xmm3
movsd  -0x70(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x78(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xceb(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xcba(%rip),%xmm1
mulsd  -0x60(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xca7(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
addsd  %xmm0,%xmm1
addsd  -0x50(%rbp),%xmm1
movsd  0xc8f(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm1
movsd  0xc60(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  0xc41(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
mov    0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xc04(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11a4 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x84>
jmp    1444 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x324>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117a <calculateSubgridErrorNavierStokes2D_GLS_tau+0x5a>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateSubgridErrorNavierStokes2D_GLS_tau>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r9,0x78(%rsp)
mov    %r8,0x70(%rsp)
mov    %rcx,0x38(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    %esi,0xc(%rsp)
test   %edi,%edi
jle    1417 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x2f7>
mov    %edx,%ebx
mov    0xd0(%rsp),%rcx
lea    0x1(%rbx),%eax
mov    %eax,0x24(%rsp)
mov    0xc(%rsp),%eax
movslq %eax,%rdx
mov    %edi,%esi
mov    %rsi,0x40(%rsp)
mov    %rdx,0x28(%rsp)
mov    %edx,%edx
mov    %rdx,0x68(%rsp)
mov    %ebx,%r12d
lea    -0x1(%r12),%rdx
mov    %rdx,0x50(%rsp)
mov    %r12d,%r14d
and    $0x3,%r14d
and    $0xfffffffc,%r12d
add    $0x18,%rcx
mov    %rcx,0x48(%rsp)
mov    %ebx,%ecx
imul   %eax,%ecx
mov    %ecx,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    11ea <calculateSubgridErrorNavierStokes2D_GLS_tau+0xca>
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rcx
add    $0x1,%rcx
mov    0x18(%rsp),%rax
add    0x20(%rsp),%eax
mov    %rax,0x18(%rsp)
mov    %rcx,%rax
mov    %rcx,0x10(%rsp)
cmp    0x40(%rsp),%rcx
je     1417 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x2f7>
cmpl   $0x0,0xc(%rsp)
jle    11c0 <calculateSubgridErrorNavierStokes2D_GLS_tau+0xa0>
mov    0x38(%rsp),%rax
mov    0x10(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  0x30(%rsp),%xmm0
imul   0x28(%rsp),%rcx
mov    %rcx,0x88(%rsp)
movsd  %xmm0,0x90(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x80(%rsp)
mov    0x18(%rsp),%rax
mov    %eax,%r13d
xor    %ebp,%ebp
jmp    131c <calculateSubgridErrorNavierStokes2D_GLS_tau+0x1fc>
nopl   0x0(%rax)
movsd  %xmm5,0x60(%rsp)
movsd  %xmm6,0x58(%rsp)
call   1040 <sqrt@plt>
movsd  0x58(%rsp),%xmm6
movsd  0x60(%rsp),%xmm5
movapd %xmm0,%xmm1
movsd  0x90(%rsp),%xmm4
divsd  %xmm4,%xmm1
mov    0xf0(%rsp),%rax
movsd  %xmm1,(%rax,%r15,8)
mov    0x70(%rsp),%rax
movsd  (%rax,%r15,8),%xmm2
andpd  0xd71(%rip),%xmm2
mulsd  0xd79(%rip),%xmm5
movapd %xmm5,%xmm1
divsd  0x80(%rsp),%xmm1
addsd  %xmm6,%xmm6
mulsd  %xmm0,%xmm6
movapd %xmm4,%xmm3
mulsd  %xmm6,%xmm3
divsd  %xmm4,%xmm6
addsd  %xmm1,%xmm6
addsd  %xmm2,%xmm6
movsd  0xd50(%rip),%xmm1
divsd  %xmm6,%xmm1
mov    0xe0(%rsp),%rcx
movsd  %xmm1,(%rcx,%r15,8)
addsd  %xmm5,%xmm3
mulsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mov    0xe8(%rsp),%rax
movsd  %xmm2,(%rax,%r15,8)
movsd  (%rcx,%r15,8),%xmm1
lea    0xd23(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%rbp
add    %ebx,%r13d
cmp    0x68(%rsp),%rbp
je     11c0 <calculateSubgridErrorNavierStokes2D_GLS_tau+0xa0>
mov    0x88(%rsp),%rax
lea    (%rax,%rbp,1),%r15
mov    %r15d,%eax
imul   %ebx,%eax
imul   %ebx,%eax
add    0x24(%rsp),%eax
test   %ebx,%ebx
jle    1350 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x230>
movslq %r13d,%rcx
cmpq   $0x3,0x50(%rsp)
jae    1360 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x240>
xorpd  %xmm0,%xmm0
xor    %edx,%edx
jmp    13b0 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x290>
nopl   0x0(%rax)
xorpd  %xmm0,%xmm0
jmp    13e6 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x2c6>
nopl   0x0(%rax)
mov    0x48(%rsp),%rdx
lea    (%rdx,%rcx,8),%rsi
xorpd  %xmm0,%xmm0
xor    %edx,%edx
nop
movsd  -0x18(%rsi,%rdx,8),%xmm1
movsd  -0x10(%rsi,%rdx,8),%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x8(%rsi,%rdx,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  (%rsi,%rdx,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
add    $0x4,%rdx
cmp    %rdx,%r12
jne    1370 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x250>
test   %r14,%r14
je     13e6 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x2c6>
add    %rcx,%rdx
mov    0xd0(%rsp),%rcx
lea    (%rcx,%rdx,8),%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movsd  (%rcx,%rdx,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%rdx
cmp    %rdx,%r14
jne    13d0 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x2b0>
mov    0x78(%rsp),%rcx
movsd  (%rcx,%r15,8),%xmm6
cltq
mov    0xd8(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm5
ucomisd 0xc18(%rip),%xmm0
jb     1240 <calculateSubgridErrorNavierStokes2D_GLS_tau+0x120>
sqrtsd %xmm0,%xmm0
jmp    125d <calculateSubgridErrorNavierStokes2D_GLS_tau+0x13d>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"nrm_v %12.5e tau_v %12.5e tau_p %12.5e \0A\00"
define void @calculateSubgridErrorNavierStokes2D_GLS_tau(i32 %0, i32 %1, i32 %2, double %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11) {
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%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
store i32 %0, i32* %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store double %3, double* %16
store double* %4, double** %17
store double* %5, double** %18
store double* %6, double** %19
store double* %7, double** %20
store double* %8, double** %21
store double* %9, double** %22
store double* %10, double** %23
store double* %11, double** %24
%36 = load i32, i32* %15
%37 = load i32, i32* %15
%38 = mul nsw i32 %36, %37
store i32 %38, i32* %27
store double 0.000000e+00, double* %33
store double 0.000000e+00, double* %34
store i32 0, i32* %25
br label %39
39: ; preds = %228, %12
%40 = load i32, i32* %25
%41 = load i32, i32* %13
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %231
43: ; preds = %39
%44 = load double, double* %16
%45 = load double*, double** %17
%46 = load i32, i32* %25
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
%49 = load double, double* %48
%50 = fmul double %44, %49
store double %50, double* %29
store i32 0, i32* %26
br label %51
51: ; preds = %224, %43
%52 = load i32, i32* %26
%53 = load i32, i32* %14
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %227
55: ; preds = %51
%56 = load double*, double** %19
%57 = load i32, i32* %25
%58 = load i32, i32* %14
%59 = mul nsw i32 %57, %58
%60 = load i32, i32* %26
%61 = add nsw i32 %59, %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %56, i64 %62
%64 = load double, double* %63
store double %64, double* %31
%65 = load double*, double** %21
%66 = load i32, i32* %25
%67 = load i32, i32* %14
%68 = mul nsw i32 %66, %67
%69 = load i32, i32* %27
%70 = mul nsw i32 %68, %69
%71 = load i32, i32* %26
%72 = load i32, i32* %27
%73 = mul nsw i32 %71, %72
%74 = add nsw i32 %70, %73
%75 = load i32, i32* %15
%76 = add nsw i32 %74, %75
%77 = add nsw i32 %76, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %65, i64 %78
%80 = load double, double* %79
store double %80, double* %32
store double 0.000000e+00, double* %35
store i32 0, i32* %28
br label %81
81: ; preds = %118, %55
%82 = load i32, i32* %28
%83 = load i32, i32* %15
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %121
85: ; preds = %81
%86 = load double*, double** %20
%87 = load i32, i32* %25
%88 = load i32, i32* %14
%89 = mul nsw i32 %87, %88
%90 = load i32, i32* %15
%91 = mul nsw i32 %89, %90
%92 = load i32, i32* %26
%93 = load i32, i32* %15
%94 = mul nsw i32 %92, %93
%95 = add nsw i32 %91, %94
%96 = load i32, i32* %28
%97 = add nsw i32 %95, %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %86, i64 %98
%100 = load double, double* %99
%101 = load double*, double** %20
%102 = load i32, i32* %25
%103 = load i32, i32* %14
%104 = mul nsw i32 %102, %103
%105 = load i32, i32* %15
%106 = mul nsw i32 %104, %105
%107 = load i32, i32* %26
%108 = load i32, i32* %15
%109 = mul nsw i32 %107, %108
%110 = add nsw i32 %106, %109
%111 = load i32, i32* %28
%112 = add nsw i32 %110, %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %101, i64 %113
%115 = load double, double* %114
%116 = load double, double* %35
%117 = call double @llvm.fmuladd.f64(double %100, double %115, double %116)
store double %117, double* %35
br label %118
118: ; preds = %85
%119 = load i32, i32* %28
%120 = add nsw i32 %119, 1
store i32 %120, i32* %28
br label %81
121: ; preds = %81
%122 = load double, double* %35
%123 = call double @sqrt(double %122)
store double %123, double* %35
%124 = load double, double* %35
%125 = load double, double* %29
%126 = fmul double %124, %125
%127 = load double, double* %32
%128 = load double, double* %31
%129 = fdiv double %127, %128
%130 = fdiv double %126, %129
%131 = load double, double* %33
%132 = call double @llvm.maxnum.f64(double %130, double %131)
store double %132, double* %33
%133 = load double, double* %35
%134 = load double, double* %29
%135 = fdiv double %133, %134
%136 = load double, double* %34
%137 = call double @llvm.maxnum.f64(double %135, double %136)
store double %137, double* %34
%138 = load double, double* %35
%139 = load double, double* %29
%140 = fdiv double %138, %139
%141 = load double*, double** %24
%142 = load i32, i32* %25
%143 = load i32, i32* %14
%144 = mul nsw i32 %142, %143
%145 = load i32, i32* %26
%146 = add nsw i32 %144, %145
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %141, i64 %147
store double %140, double* %148
%149 = load double*, double** %18
%150 = load i32, i32* %25
%151 = load i32, i32* %14
%152 = mul nsw i32 %150, %151
%153 = load i32, i32* %26
%154 = add nsw i32 %152, %153
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double, double* %149, i64 %155
%157 = load double, double* %156
%158 = call double @llvm.fabs.f64(double %157)
store double %158, double* %30
%159 = load double, double* %32
%160 = fmul double 4.000000e+00, %159
%161 = load double, double* %29
%162 = load double, double* %29
%163 = fmul double %161, %162
%164 = fdiv double %160, %163
%165 = load double, double* %31
%166 = fmul double 2.000000e+00, %165
%167 = load double, double* %35
%168 = fmul double %166, %167
%169 = load double, double* %29
%170 = fdiv double %168, %169
%171 = fadd double %164, %170
%172 = load double, double* %30
%173 = fadd double %171, %172
%174 = fdiv double 1.000000e+00, %173
%175 = load double*, double** %22
%176 = load i32, i32* %25
%177 = load i32, i32* %14
%178 = mul nsw i32 %176, %177
%179 = load i32, i32* %26
%180 = add nsw i32 %178, %179
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %175, i64 %181
store double %174, double* %182
%183 = load double, double* %32
%184 = load double, double* %31
%185 = fmul double 2.000000e+00, %184
%186 = load double, double* %35
%187 = fmul double %185, %186
%188 = load double, double* %29
%189 = fmul double %187, %188
%190 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %183, double %189)
%191 = load double, double* %30
%192 = load double, double* %29
%193 = fmul double %191, %192
%194 = load double, double* %29
%195 = call double @llvm.fmuladd.f64(double %193, double %194, double %190)
%196 = load double*, double** %23
%197 = load i32, i32* %25
%198 = load i32, i32* %14
%199 = mul nsw i32 %197, %198
%200 = load i32, i32* %26
%201 = add nsw i32 %199, %200
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %196, i64 %202
store double %195, double* %203
%204 = load double, double* %35
%205 = load double*, double** %22
%206 = load i32, i32* %25
%207 = load i32, i32* %14
%208 = mul nsw i32 %206, %207
%209 = load i32, i32* %26
%210 = add nsw i32 %208, %209
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds double, double* %205, i64 %211
%213 = load double, double* %212
%214 = load double*, double** %23
%215 = load i32, i32* %25
%216 = load i32, i32* %14
%217 = mul nsw i32 %215, %216
%218 = load i32, i32* %26
%219 = add nsw i32 %217, %218
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds double, double* %214, i64 %220
%222 = load double, double* %221
%223 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), double %204, double %213, double %222)
br label %224
224: ; preds = %121
%225 = load i32, i32* %26
%226 = add nsw i32 %225, 1
store i32 %226, i32* %26
br label %51
227: ; preds = %51
br label %228
228: ; preds = %227
%229 = load i32, i32* %25
%230 = add nsw i32 %229, 1
store i32 %230, i32* %25
br label %39
231: ; preds = %39
ret void
}

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