#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*/ cofactor2D(double *, double *, double *, double *, double);
double dVxTriangle2D(double *y1, double *y2, double *yM, double *x1, double *x2,
                     double *xM) {
  double cofDy[4];
  cofactor2D(cofDy, y1, y2, yM, 1.0);
  return (cofDy[0] * (x1[0] - xM[0]) + cofDy[2] * (x1[1] - xM[1]) +
          cofDy[1] * (x2[0] - xM[0]) + cofDy[3] * (x2[1] - xM[1]));
}


x86 assembly (clang, -O0):
<dVxTriangle2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
movsd  0xeb8(%rip),%xmm0
call   1030 <cofactor2D@plt>
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x30(%rbp),%rax
subsd  (%rax),%xmm2
movsd  -0x40(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm3
mov    -0x30(%rbp),%rax
subsd  0x8(%rax),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x30(%rbp),%rax
subsd  (%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x30(%rbp),%rax
subsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dVxTriangle2D>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %r9,%r15
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rsp,%rdi
movsd  0xeca(%rip),%xmm0
call   1030 <cofactor2D@plt>
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm0
movsd  (%r15),%xmm2
movsd  0x8(%r15),%xmm3
subsd  %xmm2,%xmm1
subsd  %xmm3,%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  (%r14),%xmm4
movsd  0x8(%r14),%xmm0
subsd  %xmm2,%xmm4
mulsd  0x8(%rsp),%xmm4
addsd  %xmm1,%xmm4
subsd  %xmm3,%xmm0
mulsd  0x18(%rsp),%xmm0
addsd  %xmm4,%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define double @dVxTriangle2D(double* %0, double* %1, double* %2, double* nocapture %3, double* nocapture %4, double* nocapture %5) {
%7 = alloca [4 x double]
%8 = bitcast [4 x double]* %7 to i8*
%9 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%10 = call i32 @cofactor2D(double* %9, double* %0, double* %1, double* %2, double 1.000000e+00)
%11 = load double, double* %9
%12 = load double, double* %3
%13 = load double, double* %5
%14 = fsub double %12, %13
%15 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 2
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %3, i64 1
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %5, i64 1
%20 = load double, double* %19
%21 = fsub double %18, %20
%22 = fmul double %16, %21
%23 = call double @llvm.fmuladd.f64(double %11, double %14, double %22)
%24 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 1
%25 = load double, double* %24
%26 = load double, double* %4
%27 = fsub double %26, %13
%28 = call double @llvm.fmuladd.f64(double %25, double %27, double %23)
%29 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 3
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %4, i64 1
%32 = load double, double* %31
%33 = fsub double %32, %20
%34 = call double @llvm.fmuladd.f64(double %30, double %33, double %28)
ret double %34
}