void s_cross3(double result[3], const double x[3], const double y[3]) {
  int i;
  for (i = 0; i < 3; ++i) {
    result[i] =
        x[(i + 1) % 3] * y[(i + 2) % 3] - x[(i + 2) % 3] * y[(i + 1) % 3];
  }
}


x86 assembly (clang, -O0):
<s_cross3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11e3 <s_cross3+0xe3>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0x40(%rbp),%rax
movslq %edx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0x38(%rbp),%rax
movslq %edx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
movslq %edx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
movslq %edx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <s_cross3+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_cross3>:
movsd  0x8(%rsi),%xmm0
movsd  0x8(%rdx),%xmm1
mulsd  0x10(%rsi),%xmm1
mulsd  0x10(%rdx),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rdi)
movsd  0x10(%rsi),%xmm0
movsd  0x10(%rdx),%xmm1
mulsd  (%rsi),%xmm1
mulsd  (%rdx),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  (%rsi),%xmm0
movsd  (%rdx),%xmm1
mulsd  0x8(%rsi),%xmm1
mulsd  0x8(%rdx),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rdi)
ret

LLVM IR (-O0):
define void @s_cross3(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %8
8: ; preds = %47, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %50
11: ; preds = %8
%12 = load double*, double** %5
%13 = load i32, i32* %7
%14 = add nsw i32 %13, 1
%15 = srem i32 %14, 3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %12, i64 %16
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 2
%22 = srem i32 %21, 3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %19, i64 %23
%25 = load double, double* %24
%26 = load double*, double** %5
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 2
%29 = srem i32 %28, 3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %26, i64 %30
%32 = load double, double* %31
%33 = load double*, double** %6
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
%36 = srem i32 %35, 3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %33, i64 %37
%39 = load double, double* %38
%40 = fmul double %32, %39
%41 = fneg double %40
%42 = call double @llvm.fmuladd.f64(double %18, double %25, double %41)
%43 = load double*, double** %4
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
store double %42, double* %46
br label %47
47: ; preds = %11
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %8
50: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @s_cross3(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %2, i64 2
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %2, 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* %0
%15 = load double, double* %8
%16 = load double, double* %2
%17 = load double, double* %1
%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* %0, i64 1
store double %21, double* %22
%23 = load double, double* %1
%24 = load double, double* %10
%25 = load double, double* %4
%26 = load double, double* %2
%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* %0, i64 2
store double %29, double* %30
ret void
}