double triangle_area(double *A, double *B, double *C) {
  double X[2] = {B[0] - A[0], B[1] - A[1]};
  double Y[2] = {C[0] - A[0], C[1] - A[1]};
  return X[0] * Y[1] - X[1] * Y[0];
}


x86 assembly (clang, -O0):
<triangle_area>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%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
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangle_area>:
movsd  (%rsi),%xmm1
movsd  0x8(%rsi),%xmm2
movsd  (%rdi),%xmm3
movsd  0x8(%rdi),%xmm4
subsd  %xmm3,%xmm1
subsd  %xmm4,%xmm2
movsd  (%rdx),%xmm5
movsd  0x8(%rdx),%xmm0
subsd  %xmm3,%xmm5
mulsd  %xmm2,%xmm5
subsd  %xmm4,%xmm0
mulsd  %xmm1,%xmm0
subsd  %xmm5,%xmm0
ret

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

LLVM IR (-O2):
define double @triangle_area(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = load double, double* %0
%6 = fsub double %4, %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = load double, double* %9
%11 = fsub double %8, %10
%12 = load double, double* %2
%13 = fsub double %12, %5
%14 = getelementptr inbounds double, double* %2, i64 1
%15 = load double, double* %14
%16 = fsub double %15, %10
%17 = fneg double %11
%18 = fmul double %13, %17
%19 = tail call double @llvm.fmuladd.f64(double %6, double %16, double %18)
ret double %19
}