void findLineParams(double x1, double y1, double x2, double y2, double *m,
                    double *b) {
  double dx = x2 - x1;
  double dy = y2 - y1;
  *m = dy / dx;
  if (dx == 0)
    *b = x1;
  else
    *b = y1 - (*m) * x1;
}


x86 assembly (clang, -O0):
<findLineParams>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117a <findLineParams+0x7a>
jp     117a <findLineParams+0x7a>
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11b3 <findLineParams+0xb3>
movsd  -0x10(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<findLineParams>:
subsd  %xmm0,%xmm2
subsd  %xmm1,%xmm3
divsd  %xmm2,%xmm3
movsd  %xmm3,(%rdi)
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm1
xorpd  %xmm3,%xmm3
cmpeqsd %xmm2,%xmm3
movapd %xmm3,%xmm2
andnpd %xmm1,%xmm2
andpd  %xmm0,%xmm3
orpd   %xmm2,%xmm3
movlpd %xmm3,(%rsi)
ret

LLVM IR (-O0):
define void @findLineParams(double %0, double %1, double %2, double %3, double* %4, double* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%15 = load double, double* %9
%16 = load double, double* %7
%17 = fsub double %15, %16
store double %17, double* %13
%18 = load double, double* %10
%19 = load double, double* %8
%20 = fsub double %18, %19
store double %20, double* %14
%21 = load double, double* %14
%22 = load double, double* %13
%23 = fdiv double %21, %22
%24 = load double*, double** %11
store double %23, double* %24
%25 = load double, double* %13
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %6
%28 = load double, double* %7
%29 = load double*, double** %12
store double %28, double* %29
br label %38
30: ; preds = %6
%31 = load double, double* %8
%32 = load double*, double** %11
%33 = load double, double* %32
%34 = load double, double* %7
%35 = fneg double %33
%36 = call double @llvm.fmuladd.f64(double %35, double %34, double %31)
%37 = load double*, double** %12
store double %36, double* %37
br label %38
38: ; preds = %30, %27
ret void
}

LLVM IR (-O2):
define void @findLineParams(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fsub double %2, %0
%8 = fsub double %3, %1
%9 = fdiv double %8, %7
store double %9, double* %4
%10 = fcmp oeq double %7, 0.000000e+00
%11 = fneg double %9
%12 = tail call double @llvm.fmuladd.f64(double %11, double %0, double %1)
%13 = select i1 %10, double %0, double %12
store double %13, double* %5
ret void
}