void setCornerCP(double *cpw, int ncp, int kcp, double *dirOffset,
                 double *sgnDistDiff) {
  int ind;
  ind = 0;
  cpw[4 * ind] -= cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind];
  cpw[4 * ind + 1] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 1];
  cpw[4 * ind + 2] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 2];
  ind = ncp - 1;
  cpw[4 * ind] -= cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind];
  cpw[4 * ind + 1] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 1];
  cpw[4 * ind + 2] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 2];
  ind = (kcp - 1) * ncp;
  cpw[4 * ind] -= cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind];
  cpw[4 * ind + 1] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 1];
  cpw[4 * ind + 2] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 2];
  ind = ncp * kcp - 1;
  cpw[4 * ind] -= cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind];
  cpw[4 * ind + 1] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 1];
  cpw[4 * ind + 2] -=
      cpw[4 * ind + 3] * sgnDistDiff[ind] * dirOffset[3 * ind + 2];
}


x86 assembly (clang, -O0):
<setCornerCP>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setCornerCP>:
push   %rbx
movsd  0x18(%rdi),%xmm0
movsd  (%r8),%xmm1
mulsd  %xmm0,%xmm1
mulsd  (%rcx),%xmm1
movsd  (%rdi),%xmm2
subsd  %xmm1,%xmm2
movsd  0x8(%rdi),%xmm1
movsd  %xmm2,(%rdi)
movsd  (%r8),%xmm2
mulsd  %xmm0,%xmm2
mulsd  0x8(%rcx),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rdi)
movsd  0x10(%rdi),%xmm1
mulsd  (%r8),%xmm0
mulsd  0x10(%rcx),%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rdi)
lea    -0x4(,%rsi,4),%r10d
ff
lea    -0x1(,%rsi,4),%eax
cltq
movsd  (%rdi,%rax,8),%xmm0
movslq %esi,%r9
lea    -0x3(%rsi,%rsi,2),%eax
movslq %eax,%r11
movslq %r10d,%rax
movsd  (%rdi,%rax,8),%xmm1
movsd  -0x8(%r8,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
mulsd  (%rcx,%r11,8),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
lea    -0x3(,%rsi,4),%eax
cltq
movsd  (%rdi,%rax,8),%xmm1
movsd  -0x8(%r8,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
mulsd  0x8(%rcx,%r11,8),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
lea    -0x2(,%rsi,4),%eax
cltq
mulsd  -0x8(%r8,%r9,8),%xmm0
mulsd  0x10(%rcx,%r11,8),%xmm0
movsd  (%rdi,%rax,8),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
lea    -0x1(%rdx),%esi
imul   %r9d,%esi
lea    0x0(,%rsi,4),%r10d
lea    0x3(,%rsi,4),%eax
cltq
movsd  (%rdi,%rax,8),%xmm0
movslq %esi,%r11
lea    (%rsi,%rsi,2),%eax
movslq %eax,%rbx
movslq %r10d,%rax
movsd  (%rdi,%rax,8),%xmm1
movsd  (%r8,%r11,8),%xmm2
mulsd  %xmm0,%xmm2
mulsd  (%rcx,%rbx,8),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
lea    0x1(,%rsi,4),%eax
cltq
movsd  (%rdi,%rax,8),%xmm1
movsd  (%r8,%r11,8),%xmm2
mulsd  %xmm0,%xmm2
mulsd  0x8(%rcx,%rbx,8),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
lea    0x2(,%rsi,4),%eax
cltq
movsd  (%rdi,%rax,8),%xmm1
mulsd  (%r8,%r11,8),%xmm0
mulsd  0x10(%rcx,%rbx,8),%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
imul   %r9d,%edx
lea    -0x4(,%rdx,4),%eax
lea    -0x1(,%rdx,4),%esi
movslq %esi,%rsi
movsd  (%rdi,%rsi,8),%xmm0
movslq %edx,%rsi
lea    -0x3(%rdx,%rdx,2),%ebx
movslq %ebx,%rbx
cltq
movsd  (%rdi,%rax,8),%xmm1
movsd  -0x8(%r8,%rsi,8),%xmm2
mulsd  %xmm0,%xmm2
mulsd  (%rcx,%rbx,8),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
lea    -0x3(,%rdx,4),%eax
cltq
movsd  -0x8(%r8,%rsi,8),%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x8(%rcx,%rbx,8),%xmm1
movsd  (%rdi,%rax,8),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%rdi,%rax,8)
lea    -0x2(,%rdx,4),%eax
cltq
movsd  (%rdi,%rax,8),%xmm1
mulsd  -0x8(%r8,%rsi,8),%xmm0
mulsd  0x10(%rcx,%rbx,8),%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
pop    %rbx
ret

LLVM IR (-O0):
define void @setCornerCP(double* %0, i32 %1, i32 %2, double* %3, double* %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store double* %4, double** %10
store i32 0, i32* %11
%12 = load double*, double** %6
%13 = load i32, i32* %11
%14 = mul nsw i32 4, %13
%15 = add nsw i32 %14, 3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %12, i64 %16
%18 = load double, double* %17
%19 = load double*, double** %10
%20 = load i32, i32* %11
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = fmul double %18, %23
%25 = load double*, double** %9
%26 = load i32, i32* %11
%27 = mul nsw i32 3, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %25, i64 %28
%30 = load double, double* %29
%31 = load double*, double** %6
%32 = load i32, i32* %11
%33 = mul nsw i32 4, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %31, i64 %34
%36 = load double, double* %35
%37 = fneg double %24
%38 = call double @llvm.fmuladd.f64(double %37, double %30, double %36)
store double %38, double* %35
%39 = load double*, double** %6
%40 = load i32, i32* %11
%41 = mul nsw i32 4, %40
%42 = add nsw i32 %41, 3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %39, i64 %43
%45 = load double, double* %44
%46 = load double*, double** %10
%47 = load i32, i32* %11
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
%50 = load double, double* %49
%51 = fmul double %45, %50
%52 = load double*, double** %9
%53 = load i32, i32* %11
%54 = mul nsw i32 3, %53
%55 = add nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %52, i64 %56
%58 = load double, double* %57
%59 = load double*, double** %6
%60 = load i32, i32* %11
%61 = mul nsw i32 4, %60
%62 = add nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %59, i64 %63
%65 = load double, double* %64
%66 = fneg double %51
%67 = call double @llvm.fmuladd.f64(double %66, double %58, double %65)
store double %67, double* %64
%68 = load double*, double** %6
%69 = load i32, i32* %11
%70 = mul nsw i32 4, %69
%71 = add nsw i32 %70, 3
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %68, i64 %72
%74 = load double, double* %73
%75 = load double*, double** %10
%76 = load i32, i32* %11
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
%79 = load double, double* %78
%80 = fmul double %74, %79
%81 = load double*, double** %9
%82 = load i32, i32* %11
%83 = mul nsw i32 3, %82
%84 = add nsw i32 %83, 2
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %81, i64 %85
%87 = load double, double* %86
%88 = load double*, double** %6
%89 = load i32, i32* %11
%90 = mul nsw i32 4, %89
%91 = add nsw i32 %90, 2
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %88, i64 %92
%94 = load double, double* %93
%95 = fneg double %80
%96 = call double @llvm.fmuladd.f64(double %95, double %87, double %94)
store double %96, double* %93
%97 = load i32, i32* %7
%98 = sub nsw i32 %97, 1
store i32 %98, i32* %11
%99 = load double*, double** %6
%100 = load i32, i32* %11
%101 = mul nsw i32 4, %100
%102 = add nsw i32 %101, 3
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %99, i64 %103
%105 = load double, double* %104
%106 = load double*, double** %10
%107 = load i32, i32* %11
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = fmul double %105, %110
%112 = load double*, double** %9
%113 = load i32, i32* %11
%114 = mul nsw i32 3, %113
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %112, i64 %115
%117 = load double, double* %116
%118 = load double*, double** %6
%119 = load i32, i32* %11
%120 = mul nsw i32 4, %119
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %118, i64 %121
%123 = load double, double* %122
%124 = fneg double %111
%125 = call double @llvm.fmuladd.f64(double %124, double %117, double %123)
store double %125, double* %122
%126 = load double*, double** %6
%127 = load i32, i32* %11
%128 = mul nsw i32 4, %127
%129 = add nsw i32 %128, 3
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %126, i64 %130
%132 = load double, double* %131
%133 = load double*, double** %10
%134 = load i32, i32* %11
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
%137 = load double, double* %136
%138 = fmul double %132, %137
%139 = load double*, double** %9
%140 = load i32, i32* %11
%141 = mul nsw i32 3, %140
%142 = add nsw i32 %141, 1
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %139, i64 %143
%145 = load double, double* %144
%146 = load double*, double** %6
%147 = load i32, i32* %11
%148 = mul nsw i32 4, %147
%149 = add nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %146, i64 %150
%152 = load double, double* %151
%153 = fneg double %138
%154 = call double @llvm.fmuladd.f64(double %153, double %145, double %152)
store double %154, double* %151
%155 = load double*, double** %6
%156 = load i32, i32* %11
%157 = mul nsw i32 4, %156
%158 = add nsw i32 %157, 3
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds double, double* %155, i64 %159
%161 = load double, double* %160
%162 = load double*, double** %10
%163 = load i32, i32* %11
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds double, double* %162, i64 %164
%166 = load double, double* %165
%167 = fmul double %161, %166
%168 = load double*, double** %9
%169 = load i32, i32* %11
%170 = mul nsw i32 3, %169
%171 = add nsw i32 %170, 2
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %168, i64 %172
%174 = load double, double* %173
%175 = load double*, double** %6
%176 = load i32, i32* %11
%177 = mul nsw i32 4, %176
%178 = add nsw i32 %177, 2
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %175, i64 %179
%181 = load double, double* %180
%182 = fneg double %167
%183 = call double @llvm.fmuladd.f64(double %182, double %174, double %181)
store double %183, double* %180
%184 = load i32, i32* %8
%185 = sub nsw i32 %184, 1
%186 = load i32, i32* %7
%187 = mul nsw i32 %185, %186
store i32 %187, i32* %11
%188 = load double*, double** %6
%189 = load i32, i32* %11
%190 = mul nsw i32 4, %189
%191 = add nsw i32 %190, 3
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds double, double* %188, i64 %192
%194 = load double, double* %193
%195 = load double*, double** %10
%196 = load i32, i32* %11
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds double, double* %195, i64 %197
%199 = load double, double* %198
%200 = fmul double %194, %199
%201 = load double*, double** %9
%202 = load i32, i32* %11
%203 = mul nsw i32 3, %202
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds double, double* %201, i64 %204
%206 = load double, double* %205
%207 = load double*, double** %6
%208 = load i32, i32* %11
%209 = mul nsw i32 4, %208
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double, double* %207, i64 %210
%212 = load double, double* %211
%213 = fneg double %200
%214 = call double @llvm.fmuladd.f64(double %213, double %206, double %212)
store double %214, double* %211
%215 = load double*, double** %6
%216 = load i32, i32* %11
%217 = mul nsw i32 4, %216
%218 = add nsw i32 %217, 3
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds double, double* %215, i64 %219
%221 = load double, double* %220
%222 = load double*, double** %10
%223 = load i32, i32* %11
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds double, double* %222, i64 %224
%226 = load double, double* %225
%227 = fmul double %221, %226
%228 = load double*, double** %9
%229 = load i32, i32* %11
%230 = mul nsw i32 3, %229
%231 = add nsw i32 %230, 1
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds double, double* %228, i64 %232
%234 = load double, double* %233
%235 = load double*, double** %6
%236 = load i32, i32* %11
%237 = mul nsw i32 4, %236
%238 = add nsw i32 %237, 1
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds double, double* %235, i64 %239
%241 = load double, double* %240
%242 = fneg double %227
%243 = call double @llvm.fmuladd.f64(double %242, double %234, double %241)
store double %243, double* %240
%244 = load double*, double** %6
%245 = load i32, i32* %11
%246 = mul nsw i32 4, %245
%247 = add nsw i32 %246, 3
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds double, double* %244, i64 %248
%250 = load double, double* %249
%251 = load double*, double** %10
%252 = load i32, i32* %11
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds double, double* %251, i64 %253
%255 = load double, double* %254
%256 = fmul double %250, %255
%257 = load double*, double** %9
%258 = load i32, i32* %11
%259 = mul nsw i32 3, %258
%260 = add nsw i32 %259, 2
%261 = sext i32 %260 to i64
%262 = getelementptr inbounds double, double* %257, i64 %261
%263 = load double, double* %262
%264 = load double*, double** %6
%265 = load i32, i32* %11
%266 = mul nsw i32 4, %265
%267 = add nsw i32 %266, 2
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds double, double* %264, i64 %268
%270 = load double, double* %269
%271 = fneg double %256
%272 = call double @llvm.fmuladd.f64(double %271, double %263, double %270)
store double %272, double* %269
%273 = load i32, i32* %7
%274 = load i32, i32* %8
%275 = mul nsw i32 %273, %274
%276 = sub nsw i32 %275, 1
store i32 %276, i32* %11
%277 = load double*, double** %6
%278 = load i32, i32* %11
%279 = mul nsw i32 4, %278
%280 = add nsw i32 %279, 3
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds double, double* %277, i64 %281
%283 = load double, double* %282
%284 = load double*, double** %10
%285 = load i32, i32* %11
%286 = sext i32 %285 to i64
%287 = getelementptr inbounds double, double* %284, i64 %286
%288 = load double, double* %287
%289 = fmul double %283, %288
%290 = load double*, double** %9
%291 = load i32, i32* %11
%292 = mul nsw i32 3, %291
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds double, double* %290, i64 %293
%295 = load double, double* %294
%296 = load double*, double** %6
%297 = load i32, i32* %11
%298 = mul nsw i32 4, %297
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds double, double* %296, i64 %299
%301 = load double, double* %300
%302 = fneg double %289
%303 = call double @llvm.fmuladd.f64(double %302, double %295, double %301)
store double %303, double* %300
%304 = load double*, double** %6
%305 = load i32, i32* %11
%306 = mul nsw i32 4, %305
%307 = add nsw i32 %306, 3
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds double, double* %304, i64 %308
%310 = load double, double* %309
%311 = load double*, double** %10
%312 = load i32, i32* %11
%313 = sext i32 %312 to i64
%314 = getelementptr inbounds double, double* %311, i64 %313
%315 = load double, double* %314
%316 = fmul double %310, %315
%317 = load double*, double** %9
%318 = load i32, i32* %11
%319 = mul nsw i32 3, %318
%320 = add nsw i32 %319, 1
%321 = sext i32 %320 to i64
%322 = getelementptr inbounds double, double* %317, i64 %321
%323 = load double, double* %322
%324 = load double*, double** %6
%325 = load i32, i32* %11
%326 = mul nsw i32 4, %325
%327 = add nsw i32 %326, 1
%328 = sext i32 %327 to i64
%329 = getelementptr inbounds double, double* %324, i64 %328
%330 = load double, double* %329
%331 = fneg double %316
%332 = call double @llvm.fmuladd.f64(double %331, double %323, double %330)
store double %332, double* %329
%333 = load double*, double** %6
%334 = load i32, i32* %11
%335 = mul nsw i32 4, %334
%336 = add nsw i32 %335, 3
%337 = sext i32 %336 to i64
%338 = getelementptr inbounds double, double* %333, i64 %337
%339 = load double, double* %338
%340 = load double*, double** %10
%341 = load i32, i32* %11
%342 = sext i32 %341 to i64
%343 = getelementptr inbounds double, double* %340, i64 %342
%344 = load double, double* %343
%345 = fmul double %339, %344
%346 = load double*, double** %9
%347 = load i32, i32* %11
%348 = mul nsw i32 3, %347
%349 = add nsw i32 %348, 2
%350 = sext i32 %349 to i64
%351 = getelementptr inbounds double, double* %346, i64 %350
%352 = load double, double* %351
%353 = load double*, double** %6
%354 = load i32, i32* %11
%355 = mul nsw i32 4, %354
%356 = add nsw i32 %355, 2
%357 = sext i32 %356 to i64
%358 = getelementptr inbounds double, double* %353, i64 %357
%359 = load double, double* %358
%360 = fneg double %345
%361 = call double @llvm.fmuladd.f64(double %360, double %352, double %359)
store double %361, double* %358
ret void
}

LLVM IR (-O2):
define void @setCornerCP(double* nocapture %0, i32 %1, i32 %2, double* nocapture %3, double* nocapture %4) {
%6 = getelementptr inbounds double, double* %0, i64 3
%7 = load double, double* %6
%8 = load double, double* %4
%9 = load double, double* %3
%10 = load double, double* %0
%11 = fneg double %7
%12 = fmul double %8, %11
%13 = tail call double @llvm.fmuladd.f64(double %12, double %9, double %10)
store double %13, double* %0
%14 = load double, double* %4
%15 = getelementptr inbounds double, double* %3, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %0, i64 1
%18 = load double, double* %17
%19 = fmul double %14, %11
%20 = tail call double @llvm.fmuladd.f64(double %19, double %16, double %18)
store double %20, double* %17
%21 = load double, double* %4
%22 = getelementptr inbounds double, double* %3, i64 2
%23 = load double, double* %22
%24 = getelementptr inbounds double, double* %0, i64 2
%25 = load double, double* %24
%26 = fmul double %21, %11
%27 = tail call double @llvm.fmuladd.f64(double %26, double %23, double %25)
store double %27, double* %24
%28 = add nsw i32 %1, -1
%29 = shl nsw i32 %28, 2
%30 = or i32 %29, 3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %0, i64 %31
%33 = load double, double* %32
%34 = sext i32 %28 to i64
%35 = getelementptr inbounds double, double* %4, i64 %34
%36 = load double, double* %35
%37 = mul nsw i32 %28, 3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %3, i64 %38
%40 = load double, double* %39
%41 = sext i32 %29 to i64
%42 = getelementptr inbounds double, double* %0, i64 %41
%43 = load double, double* %42
%44 = fneg double %33
%45 = fmul double %36, %44
%46 = tail call double @llvm.fmuladd.f64(double %45, double %40, double %43)
store double %46, double* %42
%47 = load double, double* %35
%48 = add nsw i32 %37, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %3, i64 %49
%51 = load double, double* %50
%52 = or i32 %29, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %0, i64 %53
%55 = load double, double* %54
%56 = fmul double %47, %44
%57 = tail call double @llvm.fmuladd.f64(double %56, double %51, double %55)
store double %57, double* %54
%58 = load double, double* %35
%59 = add nsw i32 %37, 2
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %3, i64 %60
%62 = load double, double* %61
%63 = or i32 %29, 2
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %0, i64 %64
%66 = load double, double* %65
%67 = fmul double %58, %44
%68 = tail call double @llvm.fmuladd.f64(double %67, double %62, double %66)
store double %68, double* %65
%69 = add nsw i32 %2, -1
%70 = mul nsw i32 %69, %1
%71 = shl nsw i32 %70, 2
%72 = or i32 %71, 3
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %0, i64 %73
%75 = load double, double* %74
%76 = sext i32 %70 to i64
%77 = getelementptr inbounds double, double* %4, i64 %76
%78 = load double, double* %77
%79 = mul nsw i32 %70, 3
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %3, i64 %80
%82 = load double, double* %81
%83 = sext i32 %71 to i64
%84 = getelementptr inbounds double, double* %0, i64 %83
%85 = load double, double* %84
%86 = fneg double %75
%87 = fmul double %78, %86
%88 = tail call double @llvm.fmuladd.f64(double %87, double %82, double %85)
store double %88, double* %84
%89 = load double, double* %77
%90 = add nsw i32 %79, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %3, i64 %91
%93 = load double, double* %92
%94 = or i32 %71, 1
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %0, i64 %95
%97 = load double, double* %96
%98 = fmul double %89, %86
%99 = tail call double @llvm.fmuladd.f64(double %98, double %93, double %97)
store double %99, double* %96
%100 = load double, double* %77
%101 = add nsw i32 %79, 2
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %3, i64 %102
%104 = load double, double* %103
%105 = or i32 %71, 2
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %0, i64 %106
%108 = load double, double* %107
%109 = fmul double %100, %86
%110 = tail call double @llvm.fmuladd.f64(double %109, double %104, double %108)
store double %110, double* %107
%111 = mul nsw i32 %2, %1
%112 = add nsw i32 %111, -1
%113 = shl nsw i32 %112, 2
%114 = or i32 %113, 3
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %0, i64 %115
%117 = load double, double* %116
%118 = sext i32 %112 to i64
%119 = getelementptr inbounds double, double* %4, i64 %118
%120 = load double, double* %119
%121 = mul nsw i32 %112, 3
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds double, double* %3, i64 %122
%124 = load double, double* %123
%125 = sext i32 %113 to i64
%126 = getelementptr inbounds double, double* %0, i64 %125
%127 = load double, double* %126
%128 = fneg double %117
%129 = fmul double %120, %128
%130 = tail call double @llvm.fmuladd.f64(double %129, double %124, double %127)
store double %130, double* %126
%131 = load double, double* %119
%132 = add nsw i32 %121, 1
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %3, i64 %133
%135 = load double, double* %134
%136 = or i32 %113, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %0, i64 %137
%139 = load double, double* %138
%140 = fmul double %131, %128
%141 = tail call double @llvm.fmuladd.f64(double %140, double %135, double %139)
store double %141, double* %138
%142 = load double, double* %119
%143 = add nsw i32 %121, 2
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %3, i64 %144
%146 = load double, double* %145
%147 = or i32 %113, 2
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %0, i64 %148
%150 = load double, double* %149
%151 = fmul double %142, %128
%152 = tail call double @llvm.fmuladd.f64(double %151, double %146, double %150)
store double %152, double* %149
ret void
}