int cross_product_3d(a1, a2, a3, b1, b2, b3, p1, p2, p3)
double a1, a2, a3, b1, b2, b3;
double *p1, *p2, *p3;
{
  *p1 = a2 * b3 - a3 * b2;
  *p2 = a3 * b1 - a1 * b3;
  *p3 = a1 * b2 - a2 * b1;
  return (0);
}


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

x86 assembly (clang, -O2):
<cross_product_3d>:
movapd %xmm2,%xmm6
mulsd  %xmm4,%xmm6
movapd %xmm1,%xmm7
mulsd  %xmm5,%xmm7
subsd  %xmm6,%xmm7
movsd  %xmm7,(%rdi)
mulsd  %xmm0,%xmm5
mulsd  %xmm3,%xmm2
subsd  %xmm5,%xmm2
movsd  %xmm2,(%rsi)
mulsd  %xmm3,%xmm1
mulsd  %xmm4,%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @cross_product_3d(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7, double* %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
%19 = load double, double* %11
%20 = load double, double* %15
%21 = load double, double* %12
%22 = load double, double* %14
%23 = fmul double %21, %22
%24 = fneg double %23
%25 = call double @llvm.fmuladd.f64(double %19, double %20, double %24)
%26 = load double*, double** %16
store double %25, double* %26
%27 = load double, double* %12
%28 = load double, double* %13
%29 = load double, double* %10
%30 = load double, double* %15
%31 = fmul double %29, %30
%32 = fneg double %31
%33 = call double @llvm.fmuladd.f64(double %27, double %28, double %32)
%34 = load double*, double** %17
store double %33, double* %34
%35 = load double, double* %10
%36 = load double, double* %14
%37 = load double, double* %11
%38 = load double, double* %13
%39 = fmul double %37, %38
%40 = fneg double %39
%41 = call double @llvm.fmuladd.f64(double %35, double %36, double %40)
%42 = load double*, double** %18
store double %41, double* %42
ret i32 0
}

LLVM IR (-O2):
define i32 @cross_product_3d(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6, double* nocapture writeonly %7, double* nocapture writeonly %8) {
%10 = fneg double %2
%11 = fmul double %10, %4
%12 = tail call double @llvm.fmuladd.f64(double %1, double %5, double %11)
store double %12, double* %6
%13 = fneg double %0
%14 = fmul double %13, %5
%15 = tail call double @llvm.fmuladd.f64(double %2, double %3, double %14)
store double %15, double* %7
%16 = fneg double %1
%17 = fmul double %16, %3
%18 = tail call double @llvm.fmuladd.f64(double %0, double %4, double %17)
store double %18, double* %8
ret i32 0
}