#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*/ vecminus(double *, double *, double *, int);
double areaTriangle3D(double *y1, double *y2, double *yM) {
  double v[3], w[3], cprod[3];
  vecminus(v, y1, yM, 3);
  vecminus(w, y2, yM, 3);
  cprod[0] = v[1] * w[2] - v[2] * w[1];
  cprod[1] = v[0] * w[2] - v[2] * w[0];
  cprod[2] = v[0] * w[1] - v[1] * w[0];
  return cprod[0] * cprod[0] + cprod[1] * cprod[1] + cprod[2] * cprod[2];
}


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

x86 assembly (clang, -O2):
<areaTriangle3D>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0x20(%rsp),%rdi
mov    $0x3,%ecx
call   1030 <vecminus@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x3,%ecx
call   1030 <vecminus@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  (%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
movapd %xmm1,%xmm6
mulsd  %xmm2,%xmm6
mulsd  %xmm0,%xmm2
mulsd  %xmm5,%xmm0
mulsd  %xmm3,%xmm5
subsd  %xmm5,%xmm6
mulsd  %xmm4,%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm4
subsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm2
mulsd  %xmm6,%xmm6
addsd  %xmm2,%xmm6
mulsd  %xmm0,%xmm0
addsd  %xmm6,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @areaTriangle3D(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]
%9 = alloca [3 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%10 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%11 = load double*, double** %4
%12 = load double*, double** %6
%13 = call i32 @vecminus(double* %10, double* %11, double* %12, i32 3)
%14 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%15 = load double*, double** %5
%16 = load double*, double** %6
%17 = call i32 @vecminus(double* %14, double* %15, double* %16, i32 3)
%18 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
%19 = load double, double* %18
%20 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 2
%21 = load double, double* %20
%22 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
%23 = load double, double* %22
%24 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 1
%25 = load double, double* %24
%26 = fmul double %23, %25
%27 = fneg double %26
%28 = call double @llvm.fmuladd.f64(double %19, double %21, double %27)
%29 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
store double %28, double* %29
%30 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%31 = load double, double* %30
%32 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 2
%33 = load double, double* %32
%34 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
%35 = load double, double* %34
%36 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%37 = load double, double* %36
%38 = fmul double %35, %37
%39 = fneg double %38
%40 = call double @llvm.fmuladd.f64(double %31, double %33, double %39)
%41 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
store double %40, double* %41
%42 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%43 = load double, double* %42
%44 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 1
%45 = load double, double* %44
%46 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
%47 = load double, double* %46
%48 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%49 = load double, double* %48
%50 = fmul double %47, %49
%51 = fneg double %50
%52 = call double @llvm.fmuladd.f64(double %43, double %45, double %51)
%53 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
store double %52, double* %53
%54 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%55 = load double, double* %54
%56 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%57 = load double, double* %56
%58 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%59 = load double, double* %58
%60 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%61 = load double, double* %60
%62 = fmul double %59, %61
%63 = call double @llvm.fmuladd.f64(double %55, double %57, double %62)
%64 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%65 = load double, double* %64
%66 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%67 = load double, double* %66
%68 = call double @llvm.fmuladd.f64(double %65, double %67, double %63)
ret double %68
}

LLVM IR (-O2):
define double @areaTriangle3D(double* %0, double* %1, double* %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 @vecminus(double* %8, double* %0, double* %2, i32 3)
%10 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%11 = call i32 @vecminus(double* %10, double* %1, double* %2, i32 3)
%12 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%13 = load double, double* %12
%14 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%15 = load double, double* %14
%16 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%17 = load double, double* %16
%18 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%19 = load double, double* %18
%20 = fneg double %17
%21 = fmul double %19, %20
%22 = call double @llvm.fmuladd.f64(double %13, double %15, double %21)
%23 = load double, double* %8
%24 = load double, double* %10
%25 = fmul double %24, %20
%26 = call double @llvm.fmuladd.f64(double %23, double %15, double %25)
%27 = fneg double %13
%28 = fmul double %24, %27
%29 = call double @llvm.fmuladd.f64(double %23, double %19, double %28)
%30 = fmul double %26, %26
%31 = call double @llvm.fmuladd.f64(double %22, double %22, double %30)
%32 = call double @llvm.fmuladd.f64(double %29, double %29, double %31)
ret double %32
}