void project_point_to_line(double px[2], double L[3], double x[2]) {
  double a = L[0];
  double b = L[1];
  double c = L[2];
  double d = a * a + b * b;
  double e = a * x[1] - b * x[0];
  px[0] = (-a * c - b * e) / d;
  px[1] = (-b * c + a * e) / d;
}


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

x86 assembly (clang, -O2):
<project_point_to_line>:
movdqu (%rsi),%xmm1
movdqa %xmm1,%xmm0
movdqa 0xef0(%rip),%xmm2
pxor   %xmm1,%xmm2
pshufd $0xee,%xmm2,%xmm3
movsd  0x8(%rdx),%xmm4
mulsd  %xmm1,%xmm4
shufpd $0x1,%xmm1,%xmm2
movsd  0x10(%rsi),%xmm5
unpcklpd %xmm5,%xmm5
mulpd  %xmm1,%xmm5
mulpd  %xmm1,%xmm1
unpckhpd %xmm1,%xmm1
mulsd  %xmm0,%xmm0
mulsd  (%rdx),%xmm3
addsd  %xmm1,%xmm0
addsd  %xmm3,%xmm4
unpcklpd %xmm4,%xmm4
mulpd  %xmm4,%xmm2
subpd  %xmm5,%xmm2
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm2
movupd %xmm2,(%rdi)
ret

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

LLVM IR (-O2):
define void @project_point_to_line(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = bitcast double* %1 to <2 x double>*
%5 = load <2 x double>, <2 x double>* %4
%6 = getelementptr inbounds double, double* %1, i64 2
%7 = load double, double* %6
%8 = fmul <2 x double> %5, %5
%9 = extractelement <2 x double> %8, i64 1
%10 = extractelement <2 x double> %5, i64 0
%11 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %9)
%12 = getelementptr inbounds double, double* %2, i64 1
%13 = load double, double* %12
%14 = load double, double* %2
%15 = fneg <2 x double> %5
%16 = extractelement <2 x double> %15, i64 1
%17 = fmul double %14, %16
%18 = tail call double @llvm.fmuladd.f64(double %10, double %13, double %17)
%19 = insertelement <2 x double> poison, double %18, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = shufflevector <2 x double> %5, <2 x double> %15, <2 x i32> <i32 0, i32 3>
%22 = fmul <2 x double> %20, %21
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%24 = insertelement <2 x double> poison, double %7, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
%26 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %25, <2 x double> %23)
%27 = insertelement <2 x double> poison, double %11, i64 0
%28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
%29 = fdiv <2 x double> %26, %28
%30 = bitcast double* %0 to <2 x double>*
store <2 x double> %29, <2 x double>* %30
ret void
}