#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ memcpy(double *, double *, int);
void vec3_cross(double o[3], const double u[3], const double v[3]) {
  double t[3];
  t[0] = u[1] * v[2] - u[2] * v[1];
  t[1] = -u[0] * v[2] + u[2] * v[0];
  t[2] = u[0] * v[1] - u[1] * v[0];
  memcpy(o, t, sizeof(double) * 3);
}


x86 assembly (clang, -O0):
<vec3_cross>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%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
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
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
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_cross>:
sub    $0x18,%rsp
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
movapd 0xedb(%rip),%xmm2
movsd  0x10(%rsi),%xmm3
movapd %xmm3,%xmm4
xorpd  %xmm2,%xmm4
xorpd  %xmm0,%xmm2
movupd (%rdx),%xmm5
unpcklpd %xmm4,%xmm3
mulpd  %xmm5,%xmm3
unpcklpd %xmm1,%xmm2
movsd  0x10(%rdx),%xmm4
unpcklpd %xmm4,%xmm4
mulpd  %xmm2,%xmm4
addpd  %xmm3,%xmm4
shufpd $0x1,%xmm4,%xmm4
movapd %xmm4,(%rsp)
mulsd  %xmm5,%xmm1
unpckhpd %xmm5,%xmm5
mulsd  %xmm0,%xmm5
subsd  %xmm1,%xmm5
movsd  %xmm5,0x10(%rsp)
mov    %rsp,%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @vec3_cross(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [3 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%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 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
store double %22, double* %23
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = load double, double* %25
%27 = fneg double %26
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double, double* %29
%31 = load double*, double** %5
%32 = getelementptr inbounds double, double* %31, i64 2
%33 = load double, double* %32
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 0
%36 = load double, double* %35
%37 = fmul double %33, %36
%38 = call double @llvm.fmuladd.f64(double %27, double %30, double %37)
%39 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
store double %38, double* %39
%40 = load double*, double** %5
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = load double*, double** %6
%44 = getelementptr inbounds double, double* %43, i64 1
%45 = load double, double* %44
%46 = load double*, double** %5
%47 = getelementptr inbounds double, double* %46, i64 1
%48 = load double, double* %47
%49 = load double*, double** %6
%50 = getelementptr inbounds double, double* %49, i64 0
%51 = load double, double* %50
%52 = fmul double %48, %51
%53 = fneg double %52
%54 = call double @llvm.fmuladd.f64(double %42, double %45, double %53)
%55 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
store double %54, double* %55
%56 = load double*, double** %4
%57 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%58 = call i32 @memcpy(double* %56, double* %57, i32 24)
ret void
}

LLVM IR (-O2):
define void @vec3_cross(double* %0, double* nocapture %1, double* nocapture %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %2, i64 2
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 2
%11 = load double, double* %10
%12 = fneg double %11
%13 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%14 = load double, double* %1
%15 = fneg double %14
%16 = bitcast double* %2 to <2 x double>*
%17 = load <2 x double>, <2 x double>* %16
%18 = insertelement <2 x double> poison, double %11, i64 0
%19 = insertelement <2 x double> %18, double %12, i64 1
%20 = fmul <2 x double> %17, %19
%21 = insertelement <2 x double> poison, double %15, i64 0
%22 = insertelement <2 x double> %21, double %7, i64 1
%23 = insertelement <2 x double> poison, double %9, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %24, <2 x double> %20)
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%27 = bitcast [3 x double]* %4 to <2 x double>*
store <2 x double> %26, <2 x double>* %27
%28 = fneg double %7
%29 = extractelement <2 x double> %17, i64 0
%30 = fmul double %29, %28
%31 = extractelement <2 x double> %17, i64 1
%32 = tail call double @llvm.fmuladd.f64(double %14, double %31, double %30)
%33 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
store double %32, double* %33
%34 = call i32 @memcpy(double* %0, double* %13, i32 24)
ret void
}