void cross_product(const double *restrict a, const double *restrict b,
                   double *restrict c) {
  c[0] = a[1] * b[2] - a[2] * b[1];
  c[1] = a[2] * b[0] - a[0] * b[2];
  c[2] = a[0] * b[1] - a[1] * b[0];
}


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

x86 assembly (clang, -O2):
<cross_product>:
movupd 0x8(%rdi),%xmm0
movupd 0x8(%rsi),%xmm1
movsd  (%rsi),%xmm2
movsd  (%rdi),%xmm3
movapd %xmm0,%xmm4
shufpd $0x1,%xmm3,%xmm4
mulpd  %xmm1,%xmm4
mulsd  %xmm1,%xmm3
shufpd $0x1,%xmm2,%xmm1
mulpd  %xmm0,%xmm1
subpd  %xmm4,%xmm1
movupd %xmm1,(%rdx)
mulsd  %xmm0,%xmm2
subsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%rdx)
ret

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

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