void twophasePotentialFlowEvaluate(int nPoints, int nSpace, double *M,
                                   double *A, double *B, double *Bcon,
                                   double *C, double t, double *x, double *u,
                                   double *m, double *dm, double *f, double *df,
                                   double *a, double *da, double *phi,
                                   double *dphi, double *r, double *dr) {
  int k, I, J;
  const int nSpace2 = nSpace * nSpace;
  for (k = 0; k < nPoints; k++) {
    m[k] = M[k] * u[k];
    dm[k] = M[k];
    for (I = 0; I < nSpace; I++) {
      f[k * nSpace + I] = B[k * nSpace + I] * u[k] + Bcon[k * nSpace + I];
      df[k * nSpace + I] = B[k * nSpace + I];
      for (J = 0; J < nSpace; J++) {
        a[k * nSpace2 + I * nSpace + J] = A[k * nSpace2 + I * nSpace + J];
        da[k * nSpace2 + I * nSpace + J] = 0.0;
      }
    }
    phi[k] = u[k];
    dphi[k] = 1.0;
    r[k] = C[k] * u[k];
    dr[k] = C[k];
  }
}


x86 assembly (clang, -O0):
<twophasePotentialFlowEvaluate>:
push   %rbp
mov    %rsp,%rbp
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    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1359 <twophasePotentialFlowEvaluate+0x259>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12db <twophasePotentialFlowEvaluate+0x1db>
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x38(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x40(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c8 <twophasePotentialFlowEvaluate+0x1c8>
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x40(%rbp),%ecx
mov    -0x38(%rbp),%edx
imul   -0x8(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x48(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x40(%rbp),%ecx
mov    -0x38(%rbp),%edx
imul   -0x8(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x50(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x40(%rbp),%ecx
mov    -0x38(%rbp),%edx
imul   -0x8(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    124e <twophasePotentialFlowEvaluate+0x14e>
jmp    12cd <twophasePotentialFlowEvaluate+0x1cd>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11b8 <twophasePotentialFlowEvaluate+0xb8>
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x58(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xcfb(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x68(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x70(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1164 <twophasePotentialFlowEvaluate+0x64>
pop    %rbp
ret

x86 assembly (clang, -O2):
<twophasePotentialFlowEvaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,-0x40(%rsp)
test   %edi,%edi
jle    152b <twophasePotentialFlowEvaluate+0x42b>
mov    %r8,%r14
mov    %edi,%r10d
mov    0xa0(%rsp),%r11
mov    0x98(%rsp),%rax
movslq %esi,%rdx
mov    %edx,%r13d
mov    %rdx,-0x50(%rsp)
imul   %edx,%edx
mov    %rdx,-0x60(%rsp)
lea    (%rax,%r13,8),%r15
lea    (%r11,%r13,8),%r8
mov    %r13d,%edx
and    $0xfffffffc,%edx
mov    %rdx,-0x20(%rsp)
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x28(%rsp)
mov    %rdx,%rbp
shr    $0x2,%rbp
add    $0x1,%rbp
cmp    %rax,%r8
seta   %bl
lea    (%rcx,%r13,8),%r12
cmp    %r11,%r15
seta   %dl
and    %bl,%dl
cmp    %rax,%r12
seta   %dil
cmp    %rcx,%r15
seta   %bl
and    %dil,%bl
mov    %r10d,%edi
mov    %rdi,-0x48(%rsp)
or     %dl,%bl
cmp    %r11,%r12
seta   %dil
cmp    %rcx,%r8
seta   %dl
and    %dil,%dl
or     %bl,%dl
mov    %dl,-0x7d(%rsp)
mov    %rbp,%rdx
mov    %rbp,-0x30(%rsp)
and    $0xfffffffffffffffe,%rbp
mov    %rbp,-0x38(%rsp)
mov    %r13,%rdx
neg    %rdx
mov    %rdx,0x10(%rsp)
xorps  %xmm0,%xmm0
mov    0x70(%rsp),%rbx
lea    -0x1(%r13),%rdx
mov    %rdx,(%rsp)
movl   $0x4,-0x78(%rsp)
movl   $0x1,-0x7c(%rsp)
xor    %edx,%edx
mov    %rdx,-0x70(%rsp)
xor    %r10d,%r10d
mov    %r9,-0x8(%rsp)
mov    %r14,-0x10(%rsp)
mov    %esi,-0x64(%rsp)
mov    %r13,-0x18(%rsp)
jmp    1295 <twophasePotentialFlowEvaluate+0x195>
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%r10,8),%xmm1
mov    0xa8(%rsp),%rdx
movsd  %xmm1,(%rdx,%r10,8)
mov    0xb0(%rsp),%rdx
movabs $0x3ff0000000000000,%rdi
mov    %rdi,(%rdx,%r10,8)
mov    0x60(%rsp),%rdi
movsd  (%rdi,%r10,8),%xmm1
mulsd  (%rbx,%r10,8),%xmm1
mov    0xb8(%rsp),%rdx
movsd  %xmm1,(%rdx,%r10,8)
movsd  (%rdi,%r10,8),%xmm1
mov    0xc0(%rsp),%rdx
movsd  %xmm1,(%rdx,%r10,8)
add    $0x1,%r10
mov    -0x60(%rsp),%rdx
add    %edx,-0x78(%rsp)
add    %edx,-0x7c(%rsp)
mov    -0x70(%rsp),%rdi
add    %edx,%edi
mov    %rdi,-0x70(%rsp)
cmp    -0x48(%rsp),%r10
je     152b <twophasePotentialFlowEvaluate+0x42b>
mov    -0x40(%rsp),%rdx
movsd  (%rdx,%r10,8),%xmm1
mulsd  (%rbx,%r10,8),%xmm1
mov    0x78(%rsp),%rdi
movsd  %xmm1,(%rdi,%r10,8)
movsd  (%rdx,%r10,8),%xmm1
mov    0x80(%rsp),%rdx
movsd  %xmm1,(%rdx,%r10,8)
test   %esi,%esi
jle    1210 <twophasePotentialFlowEvaluate+0x110>
mov    %r10,%rdx
imul   -0x60(%rsp),%rdx
mov    %rdx,0x8(%rsp)
mov    %r10,%rdx
imul   -0x50(%rsp),%rdx
mov    %rdx,0x20(%rsp)
mov    %r10d,%edx
imul   %esi,%edx
mov    %rdx,0x18(%rsp)
mov    -0x70(%rsp),%r8
mov    -0x7c(%rsp),%edx
mov    %edx,%r15d
mov    -0x78(%rsp),%edx
mov    %edx,-0x74(%rsp)
xor    %r12d,%r12d
mov    %r10,-0x58(%rsp)
jmp    133c <twophasePotentialFlowEvaluate+0x23c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r12
add    %esi,-0x74(%rsp)
add    %esi,%r15d
add    %esi,%r8d
cmp    %r13,%r12
mov    0x70(%rsp),%rbx
je     1210 <twophasePotentialFlowEvaluate+0x110>
mov    0x20(%rsp),%rdx
add    %r12,%rdx
mov    0x18(%rsp),%rdi
lea    (%rdi,%r12,1),%ebp
imul   %esi,%ebp
movsd  (%r14,%rdx,8),%xmm1
mulsd  (%rbx,%r10,8),%xmm1
addsd  (%r9,%rdx,8),%xmm1
mov    0x88(%rsp),%rdi
movsd  %xmm1,(%rdi,%rdx,8)
movsd  (%r14,%rdx,8),%xmm1
mov    0x90(%rsp),%rdi
movsd  %xmm1,(%rdi,%rdx,8)
cmp    $0x4,%esi
jae    1390 <twophasePotentialFlowEvaluate+0x290>
xor    %edx,%edx
jmp    14a0 <twophasePotentialFlowEvaluate+0x3a0>
xchg   %ax,%ax
mov    %r12d,%edx
imul   %r13d,%edx
add    0x8(%rsp),%edx
mov    (%rsp),%r10
mov    %r10,%rdi
shr    $0x20,%rdi
setne  %bl
lea    (%rdx,%r10,1),%edi
cmp    %edx,%edi
setl   %dl
or     %bl,%dl
or     -0x7d(%rsp),%dl
je     13d0 <twophasePotentialFlowEvaluate+0x2d0>
xor    %edx,%edx
mov    -0x58(%rsp),%r10
jmp    14a0 <twophasePotentialFlowEvaluate+0x3a0>
cs nopw 0x0(%rax,%rax,1)
cmpq   $0x0,-0x28(%rsp)
je     1448 <twophasePotentialFlowEvaluate+0x348>
mov    -0x38(%rsp),%r10
mov    -0x74(%rsp),%edx
mov    %edx,%r14d
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
lea    -0x4(%r14),%edx
movslq %edx,%rdx
movups (%rcx,%rdx,8),%xmm1
movups 0x10(%rcx,%rdx,8),%xmm2
movups %xmm1,(%rax,%rdx,8)
movups %xmm2,0x10(%rax,%rdx,8)
movups %xmm0,(%r11,%rdx,8)
movups %xmm0,0x10(%r11,%rdx,8)
movslq %r14d,%r14
movups (%rcx,%r14,8),%xmm1
movups 0x10(%rcx,%r14,8),%xmm2
movups %xmm1,(%rax,%r14,8)
movups %xmm2,0x10(%rax,%r14,8)
movups %xmm0,(%r11,%r14,8)
movups %xmm0,0x10(%r11,%r14,8)
add    $0x8,%r13
add    $0x8,%r14d
add    $0xfffffffffffffffe,%r10
jne    13f0 <twophasePotentialFlowEvaluate+0x2f0>
jmp    144b <twophasePotentialFlowEvaluate+0x34b>
xor    %r13d,%r13d
testb  $0x1,-0x30(%rsp)
mov    -0x8(%rsp),%r9
mov    -0x10(%rsp),%r14
je     147f <twophasePotentialFlowEvaluate+0x37f>
add    %ebp,%r13d
movslq %r13d,%rdx
movups (%rcx,%rdx,8),%xmm1
movups 0x10(%rcx,%rdx,8),%xmm2
movups %xmm1,(%rax,%rdx,8)
movups %xmm2,0x10(%rax,%rdx,8)
movups %xmm0,(%r11,%rdx,8)
movups %xmm0,0x10(%r11,%rdx,8)
mov    -0x20(%rsp),%rsi
mov    %rsi,%rdx
mov    -0x18(%rsp),%r13
cmp    %r13,%rsi
mov    -0x64(%rsp),%esi
mov    -0x58(%rsp),%r10
je     1320 <twophasePotentialFlowEvaluate+0x220>
xchg   %ax,%ax
mov    %rdx,%rdi
test   $0x1,%r13b
je     14c7 <twophasePotentialFlowEvaluate+0x3c7>
add    %edx,%ebp
movslq %ebp,%rdi
movsd  (%rcx,%rdi,8),%xmm1
movsd  %xmm1,(%rax,%rdi,8)
movq   $0x0,(%r11,%rdi,8)
mov    %rdx,%rdi
or     $0x1,%rdi
not    %rdx
cmp    0x10(%rsp),%rdx
je     1320 <twophasePotentialFlowEvaluate+0x220>
lea    (%r15,%rdi,1),%ebp
mov    %r13,%rbx
sub    %rdi,%rbx
lea    (%r8,%rdi,1),%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %edx,%rdx
movsd  (%rcx,%rdx,8),%xmm1
movsd  %xmm1,(%rax,%rdx,8)
movq   $0x0,(%r11,%rdx,8)
movslq %ebp,%rbp
movsd  (%rcx,%rbp,8),%xmm1
movsd  %xmm1,(%rax,%rbp,8)
movq   $0x0,(%r11,%rbp,8)
add    $0x2,%ebp
add    $0x2,%edx
add    $0xfffffffffffffffe,%rbx
jne    14f0 <twophasePotentialFlowEvaluate+0x3f0>
jmp    1320 <twophasePotentialFlowEvaluate+0x220>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @twophasePotentialFlowEvaluate(i32 %0, i32 %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5, double* nocapture %6, double %7, double* nocapture readnone %8, double* nocapture %9, double* nocapture writeonly %10, double* nocapture writeonly %11, double* nocapture writeonly %12, double* nocapture writeonly %13, double* nocapture writeonly %14, double* nocapture writeonly %15, double* nocapture writeonly %16, double* nocapture writeonly %17, double* nocapture writeonly %18, double* nocapture writeonly %19) {
%21 = icmp sgt i32 %0, 0
br i1 %21, label %22, label %211
22: ; preds = %20
%23 = icmp sgt i32 %1, 0
%24 = sext i32 %1 to i64
%25 = zext i32 %0 to i64
%26 = zext i32 %1 to i64
%27 = add nsw i64 %26, -1
%28 = mul i32 %1, %1
%29 = zext i32 %28 to i64
%30 = getelementptr double, double* %14, i64 %26
%31 = getelementptr double, double* %15, i64 %26
%32 = getelementptr double, double* %3, i64 %26
%33 = and i64 %26, 4294967292
%34 = add nsw i64 %33, -4
%35 = lshr exact i64 %34, 2
%36 = add nuw nsw i64 %35, 1
%37 = icmp ult i32 %1, 4
%38 = trunc i64 %27 to i32
%39 = icmp ugt i64 %27, 4294967295
%40 = icmp ugt double* %31, %14
%41 = icmp ugt double* %30, %15
%42 = and i1 %40, %41
%43 = icmp ugt double* %32, %14
%44 = icmp ugt double* %30, %3
%45 = and i1 %43, %44
%46 = or i1 %42, %45
%47 = icmp ugt double* %32, %15
%48 = icmp ugt double* %31, %3
%49 = and i1 %47, %48
%50 = or i1 %46, %49
%51 = and i64 %26, 4294967292
%52 = and i64 %36, 1
%53 = icmp eq i64 %34, 0
%54 = and i64 %36, 9223372036854775806
%55 = icmp eq i64 %52, 0
%56 = icmp eq i64 %51, %26
%57 = and i64 %26, 1
%58 = icmp eq i64 %57, 0
%59 = sub nsw i64 0, %26
br label %60
60: ; preds = %22, %198
%61 = phi i64 [ 0, %22 ], [ %209, %198 ]
%62 = mul i64 %61, %29
%63 = getelementptr inbounds double, double* %2, i64 %61
%64 = load double, double* %63
%65 = getelementptr inbounds double, double* %9, i64 %61
%66 = load double, double* %65
%67 = fmul double %64, %66
%68 = getelementptr inbounds double, double* %10, i64 %61
store double %67, double* %68
%69 = load double, double* %63
%70 = getelementptr inbounds double, double* %11, i64 %61
store double %69, double* %70
br i1 %23, label %71, label %198
71: ; preds = %60
%72 = mul nsw i64 %61, %24
%73 = trunc i64 %61 to i32
%74 = mul i32 %73, %1
br label %75
75: ; preds = %195, %71
%76 = phi i64 [ 0, %71 ], [ %196, %195 ]
%77 = mul i64 %76, %26
%78 = add i64 %62, %77
%79 = trunc i64 %78 to i32
%80 = add nsw i64 %76, %72
%81 = getelementptr inbounds double, double* %4, i64 %80
%82 = load double, double* %81
%83 = load double, double* %65
%84 = getelementptr inbounds double, double* %5, i64 %80
%85 = load double, double* %84
%86 = tail call double @llvm.fmuladd.f64(double %82, double %83, double %85)
%87 = getelementptr inbounds double, double* %12, i64 %80
store double %86, double* %87
%88 = load double, double* %81
%89 = getelementptr inbounds double, double* %13, i64 %80
store double %88, double* %89
%90 = trunc i64 %76 to i32
%91 = add i32 %74, %90
%92 = mul i32 %91, %1
br i1 %37, label %161, label %93
93: ; preds = %75
%94 = add i32 %79, %38
%95 = icmp slt i32 %94, %79
%96 = or i1 %95, %39
%97 = or i1 %96, %50
br i1 %97, label %161, label %98
98: ; preds = %93
br i1 %53, label %140, label %99
99: ; preds = %98, %99
%100 = phi i64 [ %137, %99 ], [ 0, %98 ]
%101 = phi i64 [ %138, %99 ], [ 0, %98 ]
%102 = trunc i64 %100 to i32
%103 = add i32 %92, %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %3, i64 %104
%106 = bitcast double* %105 to <2 x double>*
%107 = load <2 x double>, <2 x double>* %106
%108 = getelementptr inbounds double, double* %105, i64 2
%109 = bitcast double* %108 to <2 x double>*
%110 = load <2 x double>, <2 x double>* %109
%111 = getelementptr inbounds double, double* %14, i64 %104
%112 = bitcast double* %111 to <2 x double>*
store <2 x double> %107, <2 x double>* %112
%113 = getelementptr inbounds double, double* %111, i64 2
%114 = bitcast double* %113 to <2 x double>*
store <2 x double> %110, <2 x double>* %114
%115 = getelementptr inbounds double, double* %15, i64 %104
%116 = bitcast double* %115 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %116
%117 = getelementptr inbounds double, double* %115, i64 2
%118 = bitcast double* %117 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %118
%119 = trunc i64 %100 to i32
%120 = or i32 %119, 4
%121 = add i32 %92, %120
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds double, double* %3, i64 %122
%124 = bitcast double* %123 to <2 x double>*
%125 = load <2 x double>, <2 x double>* %124
%126 = getelementptr inbounds double, double* %123, i64 2
%127 = bitcast double* %126 to <2 x double>*
%128 = load <2 x double>, <2 x double>* %127
%129 = getelementptr inbounds double, double* %14, i64 %122
%130 = bitcast double* %129 to <2 x double>*
store <2 x double> %125, <2 x double>* %130
%131 = getelementptr inbounds double, double* %129, i64 2
%132 = bitcast double* %131 to <2 x double>*
store <2 x double> %128, <2 x double>* %132
%133 = getelementptr inbounds double, double* %15, i64 %122
%134 = bitcast double* %133 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %134
%135 = getelementptr inbounds double, double* %133, i64 2
%136 = bitcast double* %135 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %136
%137 = add nuw i64 %100, 8
%138 = add i64 %101, 2
%139 = icmp eq i64 %138, %54
br i1 %139, label %140, label %99
140: ; preds = %99, %98
%141 = phi i64 [ 0, %98 ], [ %137, %99 ]
br i1 %55, label %160, label %142
142: ; preds = %140
%143 = trunc i64 %141 to i32
%144 = add i32 %92, %143
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double, double* %3, i64 %145
%147 = bitcast double* %146 to <2 x double>*
%148 = load <2 x double>, <2 x double>* %147
%149 = getelementptr inbounds double, double* %146, i64 2
%150 = bitcast double* %149 to <2 x double>*
%151 = load <2 x double>, <2 x double>* %150
%152 = getelementptr inbounds double, double* %14, i64 %145
%153 = bitcast double* %152 to <2 x double>*
store <2 x double> %148, <2 x double>* %153
%154 = getelementptr inbounds double, double* %152, i64 2
%155 = bitcast double* %154 to <2 x double>*
store <2 x double> %151, <2 x double>* %155
%156 = getelementptr inbounds double, double* %15, i64 %145
%157 = bitcast double* %156 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %157
%158 = getelementptr inbounds double, double* %156, i64 2
%159 = bitcast double* %158 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %159
br label %160
160: ; preds = %140, %142
br i1 %56, label %195, label %161
161: ; preds = %93, %75, %160
%162 = phi i64 [ 0, %93 ], [ 0, %75 ], [ %51, %160 ]
%163 = xor i64 %162, -1
br i1 %58, label %173, label %164
164: ; preds = %161
%165 = trunc i64 %162 to i32
%166 = add i32 %92, %165
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %3, i64 %167
%169 = load double, double* %168
%170 = getelementptr inbounds double, double* %14, i64 %167
store double %169, double* %170
%171 = getelementptr inbounds double, double* %15, i64 %167
store double 0.000000e+00, double* %171
%172 = or i64 %162, 1
br label %173
173: ; preds = %164, %161
%174 = phi i64 [ %162, %161 ], [ %172, %164 ]
%175 = icmp eq i64 %163, %59
br i1 %175, label %195, label %176
176: ; preds = %173, %176
%177 = phi i64 [ %193, %176 ], [ %174, %173 ]
%178 = trunc i64 %177 to i32
%179 = add i32 %92, %178
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds double, double* %3, i64 %180
%182 = load double, double* %181
%183 = getelementptr inbounds double, double* %14, i64 %180
store double %182, double* %183
%184 = getelementptr inbounds double, double* %15, i64 %180
store double 0.000000e+00, double* %184
%185 = trunc i64 %177 to i32
%186 = add i32 %185, 1
%187 = add i32 %92, %186
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds double, double* %3, i64 %188
%190 = load double, double* %189
%191 = getelementptr inbounds double, double* %14, i64 %188
store double %190, double* %191
%192 = getelementptr inbounds double, double* %15, i64 %188
store double 0.000000e+00, double* %192
%193 = add nuw nsw i64 %177, 2
%194 = icmp eq i64 %193, %26
br i1 %194, label %195, label %176
195: ; preds = %173, %176, %160
%196 = add nuw nsw i64 %76, 1
%197 = icmp eq i64 %196, %26
br i1 %197, label %198, label %75
198: ; preds = %195, %60
%199 = load double, double* %65
%200 = getelementptr inbounds double, double* %16, i64 %61
store double %199, double* %200
%201 = getelementptr inbounds double, double* %17, i64 %61
store double 1.000000e+00, double* %201
%202 = getelementptr inbounds double, double* %6, i64 %61
%203 = load double, double* %202
%204 = load double, double* %65
%205 = fmul double %203, %204
%206 = getelementptr inbounds double, double* %18, i64 %61
store double %205, double* %206
%207 = load double, double* %202
%208 = getelementptr inbounds double, double* %19, i64 %61
store double %207, double* %208
%209 = add nuw nsw i64 %61, 1
%210 = icmp eq i64 %209, %25
br i1 %210, label %211, label %60
211: ; preds = %198, %20
ret void
}