void Stokes_2D_Evaluate(const int nPoints, const double rho, const double nu,
                        const double *g, const double *p, const double *grad_p,
                        const double *u, const double *v, double *mom_u_acc,
                        double *dmom_u_acc_u, double *mom_v_acc,
                        double *dmom_v_acc_v, double *mass_adv,
                        double *dmass_adv_u, double *dmass_adv_v,
                        double *mom_u_diff_ten, double *mom_v_diff_ten,
                        double *mom_u_source, double *mom_v_source,
                        double *mom_u_ham, double *dmom_u_ham_grad_p,
                        double *mom_v_ham, double *dmom_v_ham_grad_p) {
  int k;
  for (k = 0; k < nPoints; k++) {
    mom_u_acc[k] = u[k];
    dmom_u_acc_u[k] = 1.0;
    mom_v_acc[k] = v[k];
    dmom_v_acc_v[k] = 1.0;
    mass_adv[k * 2 + 0] = u[k];
    mass_adv[k * 2 + 1] = v[k];
    dmass_adv_u[k * 2 + 0] = 1.0;
    dmass_adv_v[k * 2 + 1] = 1.0;
    mom_u_diff_ten[k * 4 + 0] = nu;
    mom_u_diff_ten[k * 4 + 3] = nu;
    mom_v_diff_ten[k * 4 + 0] = nu;
    mom_v_diff_ten[k * 4 + 3] = nu;
    mom_u_source[k] = -g[0];
    mom_v_source[k] = -g[1];
    mom_u_ham[k] = grad_p[k * 2 + 0] / rho;
    dmom_u_ham_grad_p[k * 2 + 0] = 1.0 / rho;
    mom_v_ham[k] = grad_p[k * 2 + 1] / rho;
    dmom_v_ham_grad_p[k * 2 + 1] = 1.0 / rho;
  }
}


x86 assembly (clang, -O0):
<Stokes_2D_Evaluate>:
push   %rbp
mov    %rsp,%rbp
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)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    13b7 <Stokes_2D_Evaluate+0x2b7>
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  0xe30(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x30(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x30(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  0xdcf(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xdb2(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    0x48(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    0x48(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    0x50(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    0x50(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x58(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x60(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    0x68(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xcbd(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    0x70(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    0x78(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xc74(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    0x80(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    116b <Stokes_2D_Evaluate+0x6b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Stokes_2D_Evaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edi,%edi
jle    1250 <Stokes_2D_Evaluate+0x150>
mov    %edi,%eax
mov    0x78(%rsp),%rdx
mov    0x70(%rsp),%rbx
mov    0x58(%rsp),%r10
mov    0x50(%rsp),%rdi
mov    0x48(%rsp),%r11
mov    0x40(%rsp),%r14
movsd  0xec6(%rip),%xmm2
divsd  %xmm0,%xmm2
mov    %eax,%r15d
shl    $0x3,%r15
movaps 0xec4(%rip),%xmm3
mov    0x38(%rsp),%r12
xor    %r13d,%r13d
movabs $0x3ff0000000000000,%rax
xchg   %ax,%ax
movsd  (%r8,%r13,1),%xmm4
movsd  %xmm4,(%r12,%r13,1)
mov    %rax,(%r14,%r13,1)
movsd  (%r9,%r13,1),%xmm4
movsd  %xmm4,(%r11,%r13,1)
mov    %rax,(%rdi,%r13,1)
movsd  (%r8,%r13,1),%xmm4
movsd  %xmm4,(%r10,%r13,2)
movsd  (%r9,%r13,1),%xmm4
movsd  %xmm4,0x8(%r10,%r13,2)
mov    0x60(%rsp),%rbp
mov    %rax,0x0(%rbp,%r13,2)
mov    0x68(%rsp),%rbp
mov    %rax,0x8(%rbp,%r13,2)
movsd  %xmm1,(%rbx,%r13,4)
movsd  %xmm1,0x18(%rbx,%r13,4)
movsd  %xmm1,(%rdx,%r13,4)
movsd  %xmm1,0x18(%rdx,%r13,4)
movsd  (%rsi),%xmm4
xorps  %xmm3,%xmm4
mov    0x80(%rsp),%rbp
movlps %xmm4,0x0(%rbp,%r13,1)
movsd  0x8(%rsi),%xmm4
xorps  %xmm3,%xmm4
mov    0x88(%rsp),%rbp
movlps %xmm4,0x0(%rbp,%r13,1)
movsd  (%rcx,%r13,2),%xmm4
divsd  %xmm0,%xmm4
mov    0x90(%rsp),%rbp
movsd  %xmm4,0x0(%rbp,%r13,1)
mov    0x98(%rsp),%rbp
movsd  %xmm2,0x0(%rbp,%r13,2)
movsd  0x8(%rcx,%r13,2),%xmm4
divsd  %xmm0,%xmm4
mov    0xa0(%rsp),%rbp
movsd  %xmm4,0x0(%rbp,%r13,1)
mov    0xa8(%rsp),%rbp
movsd  %xmm2,0x8(%rbp,%r13,2)
add    $0x8,%r13
cmp    %r13,%r15
jne    1160 <Stokes_2D_Evaluate+0x60>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @Stokes_2D_Evaluate(i32 %0, double %1, double %2, double* nocapture %3, double* nocapture readnone %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture writeonly %8, double* nocapture writeonly %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, double* nocapture writeonly %20, double* nocapture writeonly %21, double* nocapture writeonly %22) {
%24 = icmp sgt i32 %0, 0
br i1 %24, label %25, label %71
25: ; preds = %23
%26 = getelementptr inbounds double, double* %3, i64 1
%27 = fdiv double 1.000000e+00, %1
%28 = zext i32 %0 to i64
br label %29
29: ; preds = %25, %29
%30 = phi i64 [ 0, %25 ], [ %69, %29 ]
%31 = getelementptr inbounds double, double* %6, i64 %30
%32 = load double, double* %31
%33 = getelementptr inbounds double, double* %8, i64 %30
store double %32, double* %33
%34 = getelementptr inbounds double, double* %9, i64 %30
store double 1.000000e+00, double* %34
%35 = getelementptr inbounds double, double* %7, i64 %30
%36 = load double, double* %35
%37 = getelementptr inbounds double, double* %10, i64 %30
store double %36, double* %37
%38 = getelementptr inbounds double, double* %11, i64 %30
store double 1.000000e+00, double* %38
%39 = load double, double* %31
%40 = shl nuw nsw i64 %30, 1
%41 = getelementptr inbounds double, double* %12, i64 %40
store double %39, double* %41
%42 = load double, double* %35
%43 = or i64 %40, 1
%44 = getelementptr inbounds double, double* %12, i64 %43
store double %42, double* %44
%45 = getelementptr inbounds double, double* %13, i64 %40
store double 1.000000e+00, double* %45
%46 = getelementptr inbounds double, double* %14, i64 %43
store double 1.000000e+00, double* %46
%47 = shl nsw i64 %30, 2
%48 = getelementptr inbounds double, double* %15, i64 %47
store double %2, double* %48
%49 = or i64 %47, 3
%50 = getelementptr inbounds double, double* %15, i64 %49
store double %2, double* %50
%51 = getelementptr inbounds double, double* %16, i64 %47
store double %2, double* %51
%52 = getelementptr inbounds double, double* %16, i64 %49
store double %2, double* %52
%53 = load double, double* %3
%54 = fneg double %53
%55 = getelementptr inbounds double, double* %17, i64 %30
store double %54, double* %55
%56 = load double, double* %26
%57 = fneg double %56
%58 = getelementptr inbounds double, double* %18, i64 %30
store double %57, double* %58
%59 = getelementptr inbounds double, double* %5, i64 %40
%60 = load double, double* %59
%61 = fdiv double %60, %1
%62 = getelementptr inbounds double, double* %19, i64 %30
store double %61, double* %62
%63 = getelementptr inbounds double, double* %20, i64 %40
store double %27, double* %63
%64 = getelementptr inbounds double, double* %5, i64 %43
%65 = load double, double* %64
%66 = fdiv double %65, %1
%67 = getelementptr inbounds double, double* %21, i64 %30
store double %66, double* %67
%68 = getelementptr inbounds double, double* %22, i64 %43
store double %27, double* %68
%69 = add nuw nsw i64 %30, 1
%70 = icmp eq i64 %69, %28
br i1 %70, label %71, label %29
71: ; preds = %29, %23
ret void
}