void f1(double **matrix) {
  int i;
  for (i = 0; i < 3; i++) {
    matrix[i][2] =
        (matrix[i + 1][1] - matrix[i][1]) / (matrix[i + 1][0] - matrix[i][0]);
  }
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1188 <f1+0x88>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
subsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x10(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <f1+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    (%rdi),%rax
mov    0x8(%rdi),%rcx
movsd  0x8(%rcx),%xmm0
subsd  0x8(%rax),%xmm0
movsd  (%rcx),%xmm1
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rax)
mov    0x10(%rdi),%rax
movsd  (%rax),%xmm0
movsd  0x8(%rax),%xmm1
subsd  0x8(%rcx),%xmm1
subsd  (%rcx),%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rcx)
mov    0x18(%rdi),%rcx
movsd  (%rcx),%xmm0
movsd  0x8(%rcx),%xmm1
subsd  0x8(%rax),%xmm1
subsd  (%rax),%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rax)
ret

LLVM IR (-O0):
define void @f1(double** %0) {
%2 = alloca double**
%3 = alloca i32
store double** %0, double*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %47, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 3
br i1 %6, label %7, label %50
7: ; preds = %4
%8 = load double**, double*** %2
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds double*, double** %8, i64 %11
%13 = load double*, double** %12
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
%16 = load double**, double*** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double*, double** %16, i64 %18
%20 = load double*, double** %19
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = fsub double %15, %22
%24 = load double**, double*** %2
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double*, double** %24, i64 %27
%29 = load double*, double** %28
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = load double**, double*** %2
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = load double*, double** %35
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = fsub double %31, %38
%40 = fdiv double %23, %39
%41 = load double**, double*** %2
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double*, double** %41, i64 %43
%45 = load double*, double** %44
%46 = getelementptr inbounds double, double* %45, i64 2
store double %40, double* %46
br label %47
47: ; preds = %7
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %4
50: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @f1(double** nocapture %0) {
%2 = getelementptr inbounds double*, double** %0, i64 1
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 1
%5 = load double, double* %4
%6 = load double*, double** %0
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = fsub double %5, %8
%10 = load double, double* %3
%11 = load double, double* %6
%12 = fsub double %10, %11
%13 = fdiv double %9, %12
%14 = getelementptr inbounds double, double* %6, i64 2
store double %13, double* %14
%15 = getelementptr inbounds double*, double** %0, i64 2
%16 = load double*, double** %15
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double, double* %4
%20 = fsub double %18, %19
%21 = load double, double* %16
%22 = load double, double* %3
%23 = fsub double %21, %22
%24 = fdiv double %20, %23
%25 = getelementptr inbounds double, double* %3, i64 2
store double %24, double* %25
%26 = getelementptr inbounds double*, double** %0, i64 3
%27 = load double*, double** %26
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = load double, double* %17
%31 = fsub double %29, %30
%32 = load double, double* %27
%33 = load double, double* %16
%34 = fsub double %32, %33
%35 = fdiv double %31, %34
%36 = getelementptr inbounds double, double* %16, i64 2
store double %35, double* %36
ret void
}