void twophaseLevelSetCoefficientsEvaluateCI(int nPoints, int nSpace, double *B,
                                            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 i, I;
  for (i = 0; i < nPoints; i++) {
    m[i] = u[i];
    dm[i] = 1.0;
    for (I = 0; I < nSpace; I++) {
      f[i * nSpace + I] = B[i * nSpace + I] * u[i];
      df[i * nSpace + I] = B[i * nSpace + I];
    }
  }
}


x86 assembly (clang, -O0):
<twophaseLevelSetCoefficientsEvaluateCI>:
push   %rbp
mov    %rsp,%rbp
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)
movsd  %xmm0,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    121e <twophaseLevelSetCoefficientsEvaluateCI+0x11e>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xe80(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120b <twophaseLevelSetCoefficientsEvaluateCI+0x10b>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%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
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    118c <twophaseLevelSetCoefficientsEvaluateCI+0x8c>
jmp    1210 <twophaseLevelSetCoefficientsEvaluateCI+0x110>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    114a <twophaseLevelSetCoefficientsEvaluateCI+0x4a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<twophaseLevelSetCoefficientsEvaluateCI>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,-0x58(%rsp)
test   %edi,%edi
jle    1412 <twophaseLevelSetCoefficientsEvaluateCI+0x312>
mov    0x48(%rsp),%r10
mov    0x40(%rsp),%rdx
movslq %esi,%rcx
mov    %edi,%eax
mov    %rax,-0x8(%rsp)
mov    %ecx,%ebx
mov    %ebx,%eax
and    $0xfffffffc,%eax
mov    %rax,-0x40(%rsp)
mov    %rbx,%rax
neg    %rax
mov    %rax,-0x38(%rsp)
lea    0x10(%r10),%rax
mov    %rcx,-0x18(%rsp)
lea    0x0(,%rcx,8),%rcx
mov    %rcx,-0x10(%rsp)
lea    0x10(%rdx),%rbp
mov    -0x58(%rsp),%rcx
lea    0x10(%rcx),%r14
lea    0x0(,%rbx,8),%rdi
and    $0xffffffffffffffe0,%rdi
mov    %rdi,-0x48(%rsp)
lea    0x8(%rcx),%r11
lea    0x8(%rdx),%r15
lea    0x8(%r10),%r12
xor    %r13d,%r13d
mov    %r9,-0x70(%rsp)
mov    %esi,-0x64(%rsp)
jmp    11b6 <twophaseLevelSetCoefficientsEvaluateCI+0xb6>
add    $0x1,%r13
mov    -0x10(%rsp),%rcx
add    %rcx,%rax
add    %rcx,%rbp
add    %rcx,%r14
add    %rcx,%r11
add    %rcx,%r15
add    %rcx,%r12
cmp    -0x8(%rsp),%r13
je     1412 <twophaseLevelSetCoefficientsEvaluateCI+0x312>
movsd  (%r8,%r13,8),%xmm0
movsd  %xmm0,(%r9,%r13,8)
mov    0x38(%rsp),%rcx
movabs $0x3ff0000000000000,%rdx
mov    %rdx,(%rcx,%r13,8)
test   %esi,%esi
jle    1190 <twophaseLevelSetCoefficientsEvaluateCI+0x90>
mov    %r13,%rdi
imul   -0x18(%rsp),%rdi
cmp    $0x4,%esi
jae    1290 <twophaseLevelSetCoefficientsEvaluateCI+0x190>
xor    %r10d,%r10d
mov    %r10,%rcx
test   $0x1,%bl
je     1229 <twophaseLevelSetCoefficientsEvaluateCI+0x129>
add    %r10,%rdi
mov    -0x58(%rsp),%rcx
movsd  (%rcx,%rdi,8),%xmm0
mulsd  (%r8,%r13,8),%xmm0
mov    0x40(%rsp),%rdx
movsd  %xmm0,(%rdx,%rdi,8)
movsd  (%rcx,%rdi,8),%xmm0
mov    0x48(%rsp),%rcx
movsd  %xmm0,(%rcx,%rdi,8)
mov    %r10,%rcx
or     $0x1,%rcx
not    %r10
cmp    -0x38(%rsp),%r10
je     1190 <twophaseLevelSetCoefficientsEvaluateCI+0x90>
nopw   0x0(%rax,%rax,1)
movsd  -0x8(%r11,%rcx,8),%xmm0
mulsd  (%r8,%r13,8),%xmm0
movsd  %xmm0,-0x8(%r15,%rcx,8)
movsd  -0x8(%r11,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%r12,%rcx,8)
movsd  (%r11,%rcx,8),%xmm0
mulsd  (%r8,%r13,8),%xmm0
movsd  %xmm0,(%r15,%rcx,8)
movsd  (%r11,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rbx
jne    1240 <twophaseLevelSetCoefficientsEvaluateCI+0x140>
jmp    1190 <twophaseLevelSetCoefficientsEvaluateCI+0x90>
xchg   %ax,%ax
lea    (%rdi,%rbx,1),%rdx
mov    0x40(%rsp),%rcx
lea    (%rcx,%rdi,8),%rsi
lea    (%rcx,%rdx,8),%r9
mov    0x48(%rsp),%r10
lea    (%r10,%rdi,8),%rcx
mov    %rcx,-0x30(%rsp)
lea    (%r10,%rdx,8),%rcx
mov    %rcx,-0x50(%rsp)
mov    -0x58(%rsp),%rcx
lea    (%rcx,%rdi,8),%r10
mov    %r10,-0x60(%rsp)
lea    (%rcx,%rdx,8),%rcx
mov    %rcx,-0x28(%rsp)
lea    (%r8,%r13,8),%r10
add    $0x8,%r10
mov    %r10,-0x20(%rsp)
cmp    -0x50(%rsp),%rsi
setb   -0x71(%rsp)
mov    -0x30(%rsp),%rdx
cmp    %r9,%rdx
setb   -0x72(%rsp)
cmp    %rcx,%rsi
setb   -0x73(%rsp)
mov    -0x60(%rsp),%rcx
cmp    %r9,%rcx
setb   -0x74(%rsp)
cmp    %r10,%rsi
lea    (%r8,%r13,8),%rsi
setb   -0x75(%rsp)
cmp    %r9,%rsi
setb   -0x76(%rsp)
cmp    -0x28(%rsp),%rdx
mov    %rdx,%r10
setb   %r9b
mov    -0x50(%rsp),%rdx
cmp    %rdx,%rcx
setb   -0x60(%rsp)
cmp    -0x20(%rsp),%r10
setb   %cl
cmp    %rdx,%rsi
setb   %r10b
mov    -0x72(%rsp),%dl
test   %dl,-0x71(%rsp)
jne    1401 <twophaseLevelSetCoefficientsEvaluateCI+0x301>
mov    -0x74(%rsp),%dl
and    %dl,-0x73(%rsp)
mov    -0x64(%rsp),%esi
jne    13f4 <twophaseLevelSetCoefficientsEvaluateCI+0x2f4>
mov    -0x76(%rsp),%dl
and    %dl,-0x75(%rsp)
jne    13f4 <twophaseLevelSetCoefficientsEvaluateCI+0x2f4>
and    -0x60(%rsp),%r9b
jne    13f4 <twophaseLevelSetCoefficientsEvaluateCI+0x2f4>
mov    %r10d,%edx
mov    $0x0,%r10d
and    %dl,%cl
mov    -0x70(%rsp),%r9
jne    11ee <twophaseLevelSetCoefficientsEvaluateCI+0xee>
movsd  (%r8,%r13,8),%xmm0
unpcklpd %xmm0,%xmm0
xor    %edx,%edx
mov    -0x48(%rsp),%rcx
movupd -0x10(%r14,%rdx,1),%xmm1
movupd (%r14,%rdx,1),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,-0x10(%rbp,%rdx,1)
movupd %xmm2,0x0(%rbp,%rdx,1)
movups -0x10(%r14,%rdx,1),%xmm1
movups (%r14,%rdx,1),%xmm2
movups %xmm1,-0x10(%rax,%rdx,1)
movups %xmm2,(%rax,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%rcx
jne    13a0 <twophaseLevelSetCoefficientsEvaluateCI+0x2a0>
mov    -0x40(%rsp),%rcx
mov    %rcx,%r10
cmp    %rbx,%rcx
je     1190 <twophaseLevelSetCoefficientsEvaluateCI+0x90>
jmp    11ee <twophaseLevelSetCoefficientsEvaluateCI+0xee>
xor    %r10d,%r10d
mov    -0x70(%rsp),%r9
jmp    11ee <twophaseLevelSetCoefficientsEvaluateCI+0xee>
xor    %r10d,%r10d
mov    -0x70(%rsp),%r9
mov    -0x64(%rsp),%esi
jmp    11ee <twophaseLevelSetCoefficientsEvaluateCI+0xee>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @twophaseLevelSetCoefficientsEvaluateCI(i32 %0, i32 %1, double* nocapture %2, double %3, double* nocapture readnone %4, double* nocapture %5, double* nocapture writeonly %6, double* nocapture writeonly %7, double* nocapture writeonly %8, double* nocapture writeonly %9, double* nocapture readnone %10, double* nocapture readnone %11, double* nocapture readnone %12, double* nocapture readnone %13, double* nocapture readnone %14, double* nocapture readnone %15) {
%17 = icmp sgt i32 %0, 0
br i1 %17, label %18, label %140
18: ; preds = %16
%19 = icmp sgt i32 %1, 0
%20 = sext i32 %1 to i64
%21 = zext i32 %0 to i64
%22 = zext i32 %1 to i64
%23 = icmp ult i32 %1, 4
%24 = and i64 %22, 4294967292
%25 = icmp eq i64 %24, %22
%26 = and i64 %22, 1
%27 = icmp eq i64 %26, 0
%28 = sub nsw i64 0, %22
br label %29
29: ; preds = %18, %137
%30 = phi i64 [ 0, %18 ], [ %138, %137 ]
%31 = mul i64 %30, %20
%32 = getelementptr double, double* %8, i64 %31
%33 = add i64 %31, %22
%34 = getelementptr double, double* %8, i64 %33
%35 = getelementptr double, double* %9, i64 %31
%36 = getelementptr double, double* %9, i64 %33
%37 = getelementptr double, double* %2, i64 %31
%38 = getelementptr double, double* %2, i64 %33
%39 = getelementptr double, double* %5, i64 %30
%40 = add nuw i64 %30, 1
%41 = getelementptr double, double* %5, i64 %40
%42 = getelementptr inbounds double, double* %5, i64 %30
%43 = load double, double* %42
%44 = getelementptr inbounds double, double* %6, i64 %30
store double %43, double* %44
%45 = getelementptr inbounds double, double* %7, i64 %30
store double 1.000000e+00, double* %45
br i1 %19, label %46, label %137
46: ; preds = %29
%47 = mul nsw i64 %30, %20
br i1 %23, label %100, label %48
48: ; preds = %46
%49 = icmp ult double* %32, %36
%50 = icmp ult double* %35, %34
%51 = and i1 %49, %50
%52 = icmp ult double* %32, %38
%53 = icmp ult double* %37, %34
%54 = and i1 %52, %53
%55 = or i1 %51, %54
%56 = icmp ult double* %32, %41
%57 = icmp ult double* %39, %34
%58 = and i1 %56, %57
%59 = or i1 %55, %58
%60 = icmp ult double* %35, %38
%61 = icmp ult double* %37, %36
%62 = and i1 %60, %61
%63 = or i1 %59, %62
%64 = icmp ult double* %35, %41
%65 = icmp ult double* %39, %36
%66 = and i1 %64, %65
%67 = or i1 %63, %66
br i1 %67, label %100, label %68
68: ; preds = %48
%69 = load double, double* %42
%70 = insertelement <2 x double> poison, double %69, i64 0
%71 = shufflevector <2 x double> %70, <2 x double> poison, <2 x i32> zeroinitializer
%72 = insertelement <2 x double> poison, double %69, i64 0
%73 = shufflevector <2 x double> %72, <2 x double> poison, <2 x i32> zeroinitializer
br label %74
74: ; preds = %74, %68
%75 = phi i64 [ 0, %68 ], [ %97, %74 ]
%76 = add nsw i64 %75, %47
%77 = getelementptr inbounds double, double* %2, i64 %76
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %77, i64 2
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = fmul <2 x double> %79, %71
%84 = fmul <2 x double> %82, %73
%85 = getelementptr inbounds double, double* %8, i64 %76
%86 = bitcast double* %85 to <2 x double>*
store <2 x double> %83, <2 x double>* %86
%87 = getelementptr inbounds double, double* %85, i64 2
%88 = bitcast double* %87 to <2 x double>*
store <2 x double> %84, <2 x double>* %88
%89 = bitcast double* %77 to <2 x double>*
%90 = load <2 x double>, <2 x double>* %89
%91 = bitcast double* %80 to <2 x double>*
%92 = load <2 x double>, <2 x double>* %91
%93 = getelementptr inbounds double, double* %9, i64 %76
%94 = bitcast double* %93 to <2 x double>*
store <2 x double> %90, <2 x double>* %94
%95 = getelementptr inbounds double, double* %93, i64 2
%96 = bitcast double* %95 to <2 x double>*
store <2 x double> %92, <2 x double>* %96
%97 = add nuw i64 %75, 4
%98 = icmp eq i64 %97, %24
br i1 %98, label %99, label %74
99: ; preds = %74
br i1 %25, label %137, label %100
100: ; preds = %48, %46, %99
%101 = phi i64 [ 0, %48 ], [ 0, %46 ], [ %24, %99 ]
%102 = xor i64 %101, -1
br i1 %27, label %113, label %103
103: ; preds = %100
%104 = add nsw i64 %101, %47
%105 = getelementptr inbounds double, double* %2, i64 %104
%106 = load double, double* %105
%107 = load double, double* %42
%108 = fmul double %106, %107
%109 = getelementptr inbounds double, double* %8, i64 %104
store double %108, double* %109
%110 = load double, double* %105
%111 = getelementptr inbounds double, double* %9, i64 %104
store double %110, double* %111
%112 = or i64 %101, 1
br label %113
113: ; preds = %103, %100
%114 = phi i64 [ %101, %100 ], [ %112, %103 ]
%115 = icmp eq i64 %102, %28
br i1 %115, label %137, label %116
116: ; preds = %113, %116
%117 = phi i64 [ %135, %116 ], [ %114, %113 ]
%118 = add nsw i64 %117, %47
%119 = getelementptr inbounds double, double* %2, i64 %118
%120 = load double, double* %119
%121 = load double, double* %42
%122 = fmul double %120, %121
%123 = getelementptr inbounds double, double* %8, i64 %118
store double %122, double* %123
%124 = load double, double* %119
%125 = getelementptr inbounds double, double* %9, i64 %118
store double %124, double* %125
%126 = add nuw nsw i64 %117, 1
%127 = add nsw i64 %126, %47
%128 = getelementptr inbounds double, double* %2, i64 %127
%129 = load double, double* %128
%130 = load double, double* %42
%131 = fmul double %129, %130
%132 = getelementptr inbounds double, double* %8, i64 %127
store double %131, double* %132
%133 = load double, double* %128
%134 = getelementptr inbounds double, double* %9, i64 %127
store double %133, double* %134
%135 = add nuw nsw i64 %117, 2
%136 = icmp eq i64 %135, %22
br i1 %136, label %137, label %116
137: ; preds = %113, %116, %99, %29
%138 = add nuw nsw i64 %30, 1
%139 = icmp eq i64 %138, %21
br i1 %139, label %140, label %29
140: ; preds = %137, %16
ret void
}