void cross_prod(double v1[3], double v2[3], double cross[3]) {
  const int x = 0, y = 1, z = 2;
  cross[x] = v1[y] * v2[z] - v1[z] * v2[y];
  cross[y] = v1[z] * v2[x] - v1[x] * v2[z];
  cross[z] = v1[x] * v2[y] - v1[y] * v2[x];
}


x86 assembly (clang, -O0):
<cross_prod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x2,-0x24(%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_prod>:
movsd  0x8(%rdi),%xmm0
movsd  0x8(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
mulsd  0x10(%rsi),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx)
movsd  0x10(%rdi),%xmm0
movsd  0x10(%rsi),%xmm1
mulsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rdx)
ret

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

LLVM IR (-O2):
define void @cross_prod(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %1, i64 2
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 2
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = load double, double* %10
%12 = fneg double %9
%13 = fmul double %11, %12
%14 = tail call double @llvm.fmuladd.f64(double %5, double %7, double %13)
store double %14, double* %2
%15 = load double, double* %8
%16 = load double, double* %1
%17 = load double, double* %0
%18 = load double, double* %6
%19 = fneg double %17
%20 = fmul double %18, %19
%21 = tail call double @llvm.fmuladd.f64(double %15, double %16, double %20)
%22 = getelementptr inbounds double, double* %2, i64 1
store double %21, double* %22
%23 = load double, double* %0
%24 = load double, double* %10
%25 = load double, double* %4
%26 = load double, double* %1
%27 = fneg double %25
%28 = fmul double %26, %27
%29 = tail call double @llvm.fmuladd.f64(double %23, double %24, double %28)
%30 = getelementptr inbounds double, double* %2, i64 2
store double %29, double* %30
ret void
}