#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 */
double qAbs(double);
double sqrt(double);
double triarea3d(const double *P1, const double *P2, const double *P3) {
  double ax, bx, ay, by, az, bz, cx, cy, cz, area;
  ax = P1[0] - P2[0];
  bx = P3[0] - P2[0];
  ay = P1[1] - P2[1];
  by = P3[1] - P2[1];
  az = P1[2] - P2[2];
  bz = P3[2] - P2[2];
  cx = ay * bz - az * by;
  cy = az * bx - ax * bz;
  cz = ax * by - ay * bx;
  area = qAbs(0.5 * (sqrt(cx * cx + cy * cy + cz * cz)));
  return area;
}


x86 assembly (clang, -O0):
<triarea3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x28(%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,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x28(%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  -0x50(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd60(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <qAbs@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triarea3d>:
push   %rax
movsd  (%rdi),%xmm2
movsd  0x8(%rdi),%xmm1
movsd  (%rsi),%xmm3
movsd  0x8(%rsi),%xmm4
subsd  %xmm3,%xmm2
movsd  (%rdx),%xmm5
movsd  0x8(%rdx),%xmm0
subsd  %xmm3,%xmm5
subsd  %xmm4,%xmm1
subsd  %xmm4,%xmm0
movsd  0x10(%rdi),%xmm3
movsd  0x10(%rsi),%xmm4
subsd  %xmm4,%xmm3
movsd  0x10(%rdx),%xmm6
subsd  %xmm4,%xmm6
movapd %xmm0,%xmm4
mulsd  %xmm3,%xmm4
movapd %xmm1,%xmm7
mulsd  %xmm6,%xmm7
subsd  %xmm4,%xmm7
mulsd  %xmm2,%xmm6
mulsd  %xmm5,%xmm3
subsd  %xmm6,%xmm3
mulsd  %xmm5,%xmm1
mulsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm3
mulsd  %xmm7,%xmm7
addsd  %xmm3,%xmm7
mulsd  %xmm0,%xmm0
addsd  %xmm7,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11b3 <triarea3d+0x93>
sqrtsd %xmm0,%xmm0
jmp    11b8 <triarea3d+0x98>
call   1040 <sqrt@plt>
mulsd  0xe40(%rip),%xmm0
pop    %rax
jmp    1030 <qAbs@plt>

LLVM IR (-O0):
define double @triarea3d(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = fsub double %19, %22
store double %23, double* %7
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = load double, double* %25
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
%30 = fsub double %26, %29
store double %30, double* %8
%31 = load double*, double** %4
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = load double*, double** %5
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = fsub double %33, %36
store double %37, double* %9
%38 = load double*, double** %6
%39 = getelementptr inbounds double, double* %38, i64 1
%40 = load double, double* %39
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 1
%43 = load double, double* %42
%44 = fsub double %40, %43
store double %44, double* %10
%45 = load double*, double** %4
%46 = getelementptr inbounds double, double* %45, i64 2
%47 = load double, double* %46
%48 = load double*, double** %5
%49 = getelementptr inbounds double, double* %48, i64 2
%50 = load double, double* %49
%51 = fsub double %47, %50
store double %51, double* %11
%52 = load double*, double** %6
%53 = getelementptr inbounds double, double* %52, i64 2
%54 = load double, double* %53
%55 = load double*, double** %5
%56 = getelementptr inbounds double, double* %55, i64 2
%57 = load double, double* %56
%58 = fsub double %54, %57
store double %58, double* %12
%59 = load double, double* %9
%60 = load double, double* %12
%61 = load double, double* %11
%62 = load double, double* %10
%63 = fmul double %61, %62
%64 = fneg double %63
%65 = call double @llvm.fmuladd.f64(double %59, double %60, double %64)
store double %65, double* %13
%66 = load double, double* %11
%67 = load double, double* %8
%68 = load double, double* %7
%69 = load double, double* %12
%70 = fmul double %68, %69
%71 = fneg double %70
%72 = call double @llvm.fmuladd.f64(double %66, double %67, double %71)
store double %72, double* %14
%73 = load double, double* %7
%74 = load double, double* %10
%75 = load double, double* %9
%76 = load double, double* %8
%77 = fmul double %75, %76
%78 = fneg double %77
%79 = call double @llvm.fmuladd.f64(double %73, double %74, double %78)
store double %79, double* %15
%80 = load double, double* %13
%81 = load double, double* %13
%82 = load double, double* %14
%83 = load double, double* %14
%84 = fmul double %82, %83
%85 = call double @llvm.fmuladd.f64(double %80, double %81, double %84)
%86 = load double, double* %15
%87 = load double, double* %15
%88 = call double @llvm.fmuladd.f64(double %86, double %87, double %85)
%89 = call double @sqrt(double %88)
%90 = fmul double 5.000000e-01, %89
%91 = call double @qAbs(double %90)
store double %91, double* %16
%92 = load double, double* %16
ret double %92
}

LLVM IR (-O2):
define double @triarea3d(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fsub double %4, %5
%7 = load double, double* %2
%8 = fsub double %7, %5
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 1
%12 = load double, double* %11
%13 = fsub double %10, %12
%14 = getelementptr inbounds double, double* %2, i64 1
%15 = load double, double* %14
%16 = fsub double %15, %12
%17 = getelementptr inbounds double, double* %0, i64 2
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %1, i64 2
%20 = load double, double* %19
%21 = fsub double %18, %20
%22 = getelementptr inbounds double, double* %2, i64 2
%23 = load double, double* %22
%24 = fsub double %23, %20
%25 = fneg double %21
%26 = fmul double %16, %25
%27 = tail call double @llvm.fmuladd.f64(double %13, double %24, double %26)
%28 = fneg double %6
%29 = fmul double %24, %28
%30 = tail call double @llvm.fmuladd.f64(double %21, double %8, double %29)
%31 = fneg double %13
%32 = fmul double %8, %31
%33 = tail call double @llvm.fmuladd.f64(double %6, double %16, double %32)
%34 = fmul double %30, %30
%35 = tail call double @llvm.fmuladd.f64(double %27, double %27, double %34)
%36 = tail call double @llvm.fmuladd.f64(double %33, double %33, double %35)
%37 = tail call double @sqrt(double %36)
%38 = fmul double %37, 5.000000e-01
%39 = tail call double @qAbs(double %38)
ret double %39
}