void ModifySuperByColumn(double *src_nz, long cols_in_update,
                         long rows_in_update, double *dest_nz, long dest_len,
                         long *relative) {
  long i, dest, *last, *leftRow;
  double ljk, *theTmp, *rightNZ;
  for (i = 0; i < cols_in_update; i++) {
    leftRow = relative + i;
    last = relative + rows_in_update;
    dest = leftRow[0];
    rightNZ = dest_nz + dest * dest_len - dest * (dest + 1) / 2;
    theTmp = src_nz + i;
    ljk = *theTmp;
    while (leftRow != last) {
      rightNZ[*leftRow] -= ljk * (*theTmp);
      theTmp++;
      leftRow++;
    }
  }
}


x86 assembly (clang, -O0):
<ModifySuperByColumn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    124e <ModifySuperByColumn+0x14e>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
imul   -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x40(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rdx
mov    -0x70(%rbp),%rax
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
je     1238 <ModifySuperByColumn+0x138>
movsd  -0x58(%rbp),%xmm0
mov    -0x60(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x68(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    (%rcx),%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    -0x60(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x50(%rbp)
jmp    11cc <ModifySuperByColumn+0xcc>
jmp    123d <ModifySuperByColumn+0x13d>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1124 <ModifySuperByColumn+0x24>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ModifySuperByColumn>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,-0x8(%rsp)
test   %rsi,%rsi
jle    11e6 <ModifySuperByColumn+0xe6>
lea    (%r9,%rdx,8),%r8
lea    0x0(,%rdx,8),%r14
xor    %r11d,%r11d
movapd 0xed1(%rip),%xmm0
mov    %rdi,%r15
mov    %r9,%r12
jmp    1159 <ModifySuperByColumn+0x59>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r11
add    $0xfffffffffffffff8,%r14
add    $0x8,%r12
add    $0x8,%r15
cmp    %rsi,%r11
je     11e6 <ModifySuperByColumn+0xe6>
cmp    %rdx,%r11
je     1140 <ModifySuperByColumn+0x40>
lea    (%r9,%r11,8),%r13
mov    (%r9,%r11,8),%rax
mov    %rax,%rbx
imul   -0x8(%rsp),%rbx
lea    (%rcx,%rbx,8),%rbx
lea    0x1(%rax),%r10
imul   %rax,%r10
mov    %r10,%rbp
shr    $0x3f,%rbp
add    %r10,%rbp
shl    $0x2,%rbp
and    $0xfffffffffffffff8,%rbp
sub    %rbp,%rbx
movsd  (%rdi,%r11,8),%xmm1
movsd  (%rbx,%rax,8),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
subsd  %xmm3,%xmm2
movsd  %xmm2,(%rbx,%rax,8)
add    $0x8,%r13
cmp    %r8,%r13
je     1140 <ModifySuperByColumn+0x40>
xorpd  %xmm0,%xmm1
mov    $0x8,%eax
xchg   %ax,%ax
mov    (%r12,%rax,1),%rbp
movsd  (%r15,%rax,1),%xmm2
mulsd  %xmm1,%xmm2
addsd  (%rbx,%rbp,8),%xmm2
movsd  %xmm2,(%rbx,%rbp,8)
add    $0x8,%rax
cmp    %rax,%r14
jne    11c0 <ModifySuperByColumn+0xc0>
jmp    1140 <ModifySuperByColumn+0x40>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ModifySuperByColumn(double* %0, i64 %1, i64 %2, double* %3, i64 %4, i64* %5) {
%7 = alloca double*
%8 = alloca i64
%9 = alloca i64
%10 = alloca double*
%11 = alloca i64
%12 = alloca i64*
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64*
%16 = alloca i64*
%17 = alloca double
%18 = alloca double*
%19 = alloca double*
store double* %0, double** %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store double* %3, double** %10
store i64 %4, i64* %11
store i64* %5, i64** %12
store i64 0, i64* %13
br label %20
20: ; preds = %71, %6
%21 = load i64, i64* %13
%22 = load i64, i64* %8
%23 = icmp slt i64 %21, %22
br i1 %23, label %24, label %74
24: ; preds = %20
%25 = load i64*, i64** %12
%26 = load i64, i64* %13
%27 = getelementptr inbounds i64, i64* %25, i64 %26
store i64* %27, i64** %16
%28 = load i64*, i64** %12
%29 = load i64, i64* %9
%30 = getelementptr inbounds i64, i64* %28, i64 %29
store i64* %30, i64** %15
%31 = load i64*, i64** %16
%32 = getelementptr inbounds i64, i64* %31, i64 0
%33 = load i64, i64* %32
store i64 %33, i64* %14
%34 = load double*, double** %10
%35 = load i64, i64* %14
%36 = load i64, i64* %11
%37 = mul nsw i64 %35, %36
%38 = getelementptr inbounds double, double* %34, i64 %37
%39 = load i64, i64* %14
%40 = load i64, i64* %14
%41 = add nsw i64 %40, 1
%42 = mul nsw i64 %39, %41
%43 = sdiv i64 %42, 2
%44 = sub i64 0, %43
%45 = getelementptr inbounds double, double* %38, i64 %44
store double* %45, double** %19
%46 = load double*, double** %7
%47 = load i64, i64* %13
%48 = getelementptr inbounds double, double* %46, i64 %47
store double* %48, double** %18
%49 = load double*, double** %18
%50 = load double, double* %49
store double %50, double* %17
br label %51
51: ; preds = %55, %24
%52 = load i64*, i64** %16
%53 = load i64*, i64** %15
%54 = icmp ne i64* %52, %53
br i1 %54, label %55, label %70
55: ; preds = %51
%56 = load double, double* %17
%57 = load double*, double** %18
%58 = load double, double* %57
%59 = load double*, double** %19
%60 = load i64*, i64** %16
%61 = load i64, i64* %60
%62 = getelementptr inbounds double, double* %59, i64 %61
%63 = load double, double* %62
%64 = fneg double %56
%65 = call double @llvm.fmuladd.f64(double %64, double %58, double %63)
store double %65, double* %62
%66 = load double*, double** %18
%67 = getelementptr inbounds double, double* %66, i32 1
store double* %67, double** %18
%68 = load i64*, i64** %16
%69 = getelementptr inbounds i64, i64* %68, i32 1
store i64* %69, i64** %16
br label %51
70: ; preds = %51
br label %71
71: ; preds = %70
%72 = load i64, i64* %13
%73 = add nsw i64 %72, 1
store i64 %73, i64* %13
br label %20
74: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @ModifySuperByColumn(double* nocapture %0, i64 %1, i64 %2, double* nocapture %3, i64 %4, i64* %5) {
%7 = icmp sgt i64 %1, 0
br i1 %7, label %8, label %44
8: ; preds = %6
%9 = getelementptr inbounds i64, i64* %5, i64 %2
br label %10
10: ; preds = %8, %41
%11 = phi i64 [ 0, %8 ], [ %42, %41 ]
%12 = getelementptr inbounds i64, i64* %5, i64 %11
%13 = load i64, i64* %12
%14 = mul nsw i64 %13, %4
%15 = getelementptr inbounds double, double* %3, i64 %14
%16 = add nsw i64 %13, 1
%17 = mul nsw i64 %16, %13
%18 = sdiv i64 %17, -2
%19 = getelementptr inbounds double, double* %15, i64 %18
%20 = getelementptr inbounds double, double* %0, i64 %11
%21 = icmp eq i64 %11, %2
br i1 %21, label %41, label %22
22: ; preds = %10
%23 = load double, double* %20
%24 = fneg double %23
%25 = getelementptr inbounds double, double* %19, i64 %13
%26 = load double, double* %25
%27 = tail call double @llvm.fmuladd.f64(double %24, double %23, double %26)
store double %27, double* %25
%28 = getelementptr inbounds i64, i64* %12, i64 1
%29 = icmp eq i64* %28, %9
br i1 %29, label %41, label %30
30: ; preds = %22, %30
%31 = phi i64* [ %39, %30 ], [ %28, %22 ]
%32 = phi double* [ %33, %30 ], [ %20, %22 ]
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
%35 = load i64, i64* %31
%36 = getelementptr inbounds double, double* %19, i64 %35
%37 = load double, double* %36
%38 = tail call double @llvm.fmuladd.f64(double %24, double %34, double %37)
store double %38, double* %36
%39 = getelementptr inbounds i64, i64* %31, i64 1
%40 = icmp eq i64* %39, %9
br i1 %40, label %41, label %30
41: ; preds = %30, %22, %10
%42 = add nuw nsw i64 %11, 1
%43 = icmp eq i64 %42, %1
br i1 %43, label %44, label %10
44: ; preds = %41, %6
ret void
}