int CrossProduct(double *u, double *v, double *res) {
  res[0] = u[1] * v[2] - u[2] * v[1];
  res[1] = u[2] * v[0] - u[0] * v[2];
  res[2] = u[0] * v[1] - u[1] * v[0];
}


x86 assembly (clang, -O0):
<CrossProduct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%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    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%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    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @CrossProduct(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 i32 undef
}