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


x86 assembly (clang, -O0):
<cLevelSetCoefficientsEvaluate>:
push   %rbp
mov    %rsp,%rbp
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)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11fd <cLevelSetCoefficientsEvaluate+0xfd>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  0xea1(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ea <cLevelSetCoefficientsEvaluate+0xea>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%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    116b <cLevelSetCoefficientsEvaluate+0x6b>
jmp    11ef <cLevelSetCoefficientsEvaluate+0xef>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1129 <cLevelSetCoefficientsEvaluate+0x29>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cLevelSetCoefficientsEvaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,-0x8(%rsp)
mov    %rdx,-0x50(%rsp)
mov    %esi,-0x6c(%rsp)
test   %edi,%edi
jle    1421 <cLevelSetCoefficientsEvaluate+0x321>
mov    %r8,%rdx
mov    0x40(%rsp),%r8
mov    0x38(%rsp),%r9
movslq -0x6c(%rsp),%rbp
mov    %edi,%eax
mov    %rax,-0x10(%rsp)
mov    %ebp,%ebx
mov    %ebx,%eax
and    $0xfffffffc,%eax
mov    %rax,-0x40(%rsp)
mov    %rbx,%rax
neg    %rax
mov    %rax,-0x38(%rsp)
lea    0x10(%r8),%rax
mov    %rbp,-0x20(%rsp)
lea    0x0(,%rbp,8),%rdi
mov    %rdi,-0x18(%rsp)
lea    0x10(%r9),%rbp
mov    -0x50(%rsp),%rdi
lea    0x10(%rdi),%r14
lea    0x0(,%rbx,8),%rsi
and    $0xffffffffffffffe0,%rsi
mov    %rsi,-0x48(%rsp)
lea    0x8(%rdi),%r11
lea    0x8(%r9),%r15
lea    0x8(%r8),%r12
xor    %r13d,%r13d
mov    %rdx,-0x58(%rsp)
jmp    11c6 <cLevelSetCoefficientsEvaluate+0xc6>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13
mov    -0x18(%rsp),%rsi
add    %rsi,%rax
add    %rsi,%rbp
add    %rsi,%r14
add    %rsi,%r11
add    %rsi,%r15
add    %rsi,%r12
cmp    -0x10(%rsp),%r13
je     1421 <cLevelSetCoefficientsEvaluate+0x321>
movsd  (%rcx,%r13,8),%xmm0
movsd  %xmm0,(%rdx,%r13,8)
mov    -0x8(%rsp),%rsi
movabs $0x3ff0000000000000,%rdi
mov    %rdi,(%rsi,%r13,8)
cmpl   $0x0,-0x6c(%rsp)
jle    11a0 <cLevelSetCoefficientsEvaluate+0xa0>
mov    %r13,%r9
imul   -0x20(%rsp),%r9
cmpl   $0x4,-0x6c(%rsp)
jae    12a0 <cLevelSetCoefficientsEvaluate+0x1a0>
xor    %r10d,%r10d
mov    %r10,%r8
test   $0x1,%bl
je     1242 <cLevelSetCoefficientsEvaluate+0x142>
add    %r10,%r9
mov    -0x50(%rsp),%rdi
movsd  (%rdi,%r9,8),%xmm0
mulsd  (%rcx,%r13,8),%xmm0
mov    0x38(%rsp),%rsi
movsd  %xmm0,(%rsi,%r9,8)
movsd  (%rdi,%r9,8),%xmm0
mov    0x40(%rsp),%rdi
movsd  %xmm0,(%rdi,%r9,8)
mov    %r10,%r8
or     $0x1,%r8
not    %r10
cmp    -0x38(%rsp),%r10
je     11a0 <cLevelSetCoefficientsEvaluate+0xa0>
movsd  -0x8(%r11,%r8,8),%xmm0
mulsd  (%rcx,%r13,8),%xmm0
movsd  %xmm0,-0x8(%r15,%r8,8)
movsd  -0x8(%r11,%r8,8),%xmm0
movsd  %xmm0,-0x8(%r12,%r8,8)
movsd  (%r11,%r8,8),%xmm0
mulsd  (%rcx,%r13,8),%xmm0
movsd  %xmm0,(%r15,%r8,8)
movsd  (%r11,%r8,8),%xmm0
movsd  %xmm0,(%r12,%r8,8)
add    $0x2,%r8
cmp    %r8,%rbx
jne    1250 <cLevelSetCoefficientsEvaluate+0x150>
jmp    11a0 <cLevelSetCoefficientsEvaluate+0xa0>
xchg   %ax,%ax
lea    (%r9,%rbx,1),%rdx
mov    0x38(%rsp),%rsi
lea    (%rsi,%r9,8),%r8
lea    (%rsi,%rdx,8),%rsi
mov    %rsi,-0x68(%rsp)
mov    0x40(%rsp),%rsi
lea    (%rsi,%r9,8),%rdi
mov    %rdi,-0x30(%rsp)
lea    (%rsi,%rdx,8),%rdi
mov    %rdi,-0x28(%rsp)
mov    -0x50(%rsp),%rsi
lea    (%rsi,%r9,8),%r10
mov    %r10,-0x60(%rsp)
lea    (%rsi,%rdx,8),%r10
lea    (%rcx,%r13,8),%rdx
add    $0x8,%rdx
cmp    %rdi,%r8
setb   -0x6d(%rsp)
mov    -0x30(%rsp),%rdi
mov    -0x68(%rsp),%rsi
cmp    %rsi,%rdi
setb   -0x6e(%rsp)
cmp    %r10,%r8
setb   -0x6f(%rsp)
cmp    %rsi,-0x60(%rsp)
setb   -0x70(%rsp)
cmp    %rdx,%r8
mov    %rdx,%r8
lea    (%rcx,%r13,8),%rsi
setb   -0x71(%rsp)
cmp    -0x68(%rsp),%rsi
setb   -0x68(%rsp)
cmp    %r10,%rdi
setb   %r10b
mov    -0x28(%rsp),%rdx
cmp    %rdx,-0x60(%rsp)
setb   -0x60(%rsp)
cmp    %r8,%rdi
setb   %r8b
cmp    %rdx,%rsi
setb   %dil
mov    -0x6e(%rsp),%dl
test   %dl,-0x6d(%rsp)
jne    1414 <cLevelSetCoefficientsEvaluate+0x314>
mov    -0x70(%rsp),%dl
and    %dl,-0x6f(%rsp)
mov    -0x58(%rsp),%rsi
jne    1409 <cLevelSetCoefficientsEvaluate+0x309>
mov    -0x68(%rsp),%dl
and    %dl,-0x71(%rsp)
jne    1409 <cLevelSetCoefficientsEvaluate+0x309>
and    -0x60(%rsp),%r10b
jne    1409 <cLevelSetCoefficientsEvaluate+0x309>
mov    $0x0,%r10d
and    %dil,%r8b
mov    %rsi,%rdx
jne    1203 <cLevelSetCoefficientsEvaluate+0x103>
movsd  (%rcx,%r13,8),%xmm0
unpcklpd %xmm0,%xmm0
xor    %edx,%edx
mov    -0x48(%rsp),%rsi
nopl   (%rax)
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,%rsi
jne    13b0 <cLevelSetCoefficientsEvaluate+0x2b0>
mov    -0x40(%rsp),%rdx
mov    %rdx,%r10
cmp    %rbx,%rdx
mov    -0x58(%rsp),%rdx
je     11a0 <cLevelSetCoefficientsEvaluate+0xa0>
jmp    1203 <cLevelSetCoefficientsEvaluate+0x103>
xor    %r10d,%r10d
mov    %rsi,%rdx
jmp    1203 <cLevelSetCoefficientsEvaluate+0x103>
xor    %r10d,%r10d
mov    -0x58(%rsp),%rdx
jmp    1203 <cLevelSetCoefficientsEvaluate+0x103>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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