#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*/ vcopy(double *, double *);
void vcross(double v1i[3], double v2i[3], double vr[3]) {
  double v1[3], v2[3];
  vcopy(v1i, v1);
  vcopy(v2i, v2);
  vr[0] = v1[1] * v2[2] - v1[2] * v2[1];
  vr[1] = v1[2] * v2[0] - v1[0] * v2[2];
  vr[2] = v1[0] * v2[1] - v1[1] * v2[0];
}


x86 assembly (clang, -O0):
<vcross>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <vcopy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <vcopy@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x48(%rbp),%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)
movsd  -0x20(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x40(%rbp),%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)
movsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x50(%rbp),%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)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vcross>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0x20(%rsp),%rsi
call   1030 <vcopy@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <vcopy@plt>
movupd 0x28(%rsp),%xmm0
movupd 0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movapd %xmm0,%xmm4
shufpd $0x1,%xmm3,%xmm4
mulpd  %xmm1,%xmm4
mulsd  %xmm1,%xmm3
shufpd $0x1,%xmm2,%xmm1
mulpd  %xmm0,%xmm1
subpd  %xmm4,%xmm1
movupd %xmm1,(%r14)
mulsd  %xmm0,%xmm2
subsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

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