#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*/ cross3(double *, double *, double *);
void transcross3(const double origin[3], const double v0[3], const double v1[3],
                 double result[3]) {
  double u0[3], u1[3];
  int i;
  for (i = 0; i < 3; ++i) {
    u0[i] = v0[i] - origin[i];
    u1[i] = v1[i] - origin[i];
  }
  cross3(u0, u1, result);
}


x86 assembly (clang, -O0):
<transcross3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    118f <transcross3+0x7f>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x64(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x64(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x18(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x64(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x64(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    112f <transcross3+0x1f>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <cross3@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transcross3>:
sub    $0x38,%rsp
movupd (%rdi),%xmm0
movupd (%rsi),%xmm1
subpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movupd (%rdx),%xmm1
subpd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  0x10(%rsi),%xmm0
movsd  0x10(%rdi),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rdx),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    %rcx,%rdx
call   1030 <cross3@plt>
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
define void @transcross3(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* %3) {
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %5 to i8*
%8 = bitcast [3 x double]* %6 to i8*
%9 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%10 = bitcast double* %0 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%13 = bitcast double* %1 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = fsub <2 x double> %14, %11
%16 = bitcast [3 x double]* %5 to <2 x double>*
store <2 x double> %15, <2 x double>* %16
%17 = bitcast double* %2 to <2 x double>*
%18 = load <2 x double>, <2 x double>* %17
%19 = fsub <2 x double> %18, %11
%20 = bitcast [3 x double]* %6 to <2 x double>*
store <2 x double> %19, <2 x double>* %20
%21 = getelementptr inbounds double, double* %1, i64 2
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %0, i64 2
%24 = load double, double* %23
%25 = fsub double %22, %24
%26 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %25, double* %26
%27 = getelementptr inbounds double, double* %2, i64 2
%28 = load double, double* %27
%29 = fsub double %28, %24
%30 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %29, double* %30
%31 = call i32 @cross3(double* %9, double* %12, double* %3)
ret void
}