void apply_homography(double y[2], double h[9], double x[2]) {
  double z = h[6] * x[0] + h[7] * x[1] + h[8];
  double tmp = x[0];
  y[0] = (h[0] * x[0] + h[1] * x[1] + h[2]) / z;
  y[1] = (h[3] * tmp + h[4] * x[1] + h[5]) / z;
}


x86 assembly (clang, -O0):
<apply_homography>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x40(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x10(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x28(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x28(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<apply_homography>:
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm1
movsd  0x38(%rsi),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x30(%rsi),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
addsd  0x40(%rsi),%xmm3
mulsd  0x8(%rsi),%xmm1
movsd  (%rsi),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
addsd  0x10(%rsi),%xmm2
divsd  %xmm3,%xmm2
movsd  %xmm2,(%rdi)
movsd  0x20(%rsi),%xmm1
mulsd  0x8(%rdx),%xmm1
mulsd  0x18(%rsi),%xmm0
addsd  %xmm1,%xmm0
addsd  0x28(%rsi),%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rdi)
ret

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

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