#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*/ crossProduct(double *, double *, double *);
int hff2(const double *p, const double *q, const double *r) {
  double ntmp[3];
  double n[3], pq[3], pr[3];
  double tmp = 0;
  for (int i = 0; i < 3; i++)
    pq[i] = q[i] - p[i];
  for (int i = 0; i < 3; i++)
    pr[i] = r[i] - p[i];
  crossProduct(pq, pr, ntmp);
  crossProduct(pq, ntmp, n);
#pragma omp simd reduction(+ : tmp)
  for (int i = 0; i < 3; i++)
    tmp = tmp + (p[i] * n[i]);
  if (tmp < 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<hff2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movl   $0x0,-0xac(%rbp)
cmpl   $0x3,-0xac(%rbp)
jge    118a <hff2+0x7a>
mov    -0x18(%rbp),%rax
movslq -0xac(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xac(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0xac(%rbp),%rax
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    113c <hff2+0x2c>
movl   $0x0,-0xb0(%rbp)
cmpl   $0x3,-0xb0(%rbp)
jge    11e5 <hff2+0xd5>
mov    -0x20(%rbp),%rax
movslq -0xb0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xb0(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0xb0(%rbp),%rax
movsd  %xmm0,-0xa0(%rbp,%rax,8)
ff ff
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    1194 <hff2+0x84>
lea    -0x80(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <crossProduct@plt>
lea    -0x80(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1030 <crossProduct@plt>
movl   $0x0,-0xb4(%rbp)
cmpl   $0x3,-0xb4(%rbp)
jge    126a <hff2+0x15a>
movsd  -0xa8(%rbp),%xmm1
ff
mov    -0x10(%rbp),%rax
movslq -0xb4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0xb4(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1214 <hff2+0x104>
xorps  %xmm0,%xmm0
ucomisd -0xa8(%rbp),%xmm0
ff
jbe    1287 <hff2+0x177>
movl   $0x1,-0x4(%rbp)
jmp    128e <hff2+0x17e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hff2>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdi,%rbx
movupd (%rsi),%xmm0
movupd (%rdi),%xmm1
subpd  %xmm1,%xmm0
movapd %xmm0,0x40(%rsp)
movsd  0x10(%rsi),%xmm0
movsd  0x10(%rdi),%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,0x50(%rsp)
movupd (%rdx),%xmm0
subpd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0x10(%rdx),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0x40(%rsp),%r14
lea    0x20(%rsp),%rsi
lea    0x60(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rdx
call   1030 <crossProduct@plt>
mov    %rsp,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <crossProduct@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
mulsd  (%rsp),%xmm0
xorpd  %xmm2,%xmm2
addsd  %xmm2,%xmm0
mulsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rbx),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
xor    %eax,%eax
ucomisd %xmm0,%xmm2
seta   %al
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @hff2(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = alloca [3 x double]
%8 = bitcast [3 x double]* %4 to i8*
%9 = bitcast [3 x double]* %5 to i8*
%10 = bitcast [3 x double]* %6 to i8*
%11 = bitcast [3 x double]* %7 to i8*
%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 = getelementptr inbounds double, double* %0, i64 1
%16 = bitcast double* %0 to <2 x double>*
%17 = load <2 x double>, <2 x double>* %16
%18 = fsub <2 x double> %14, %17
%19 = bitcast [3 x double]* %6 to <2 x double>*
store <2 x double> %18, <2 x double>* %19
%20 = getelementptr inbounds double, double* %1, i64 2
%21 = load double, double* %20
%22 = getelementptr inbounds double, double* %0, i64 2
%23 = load double, double* %22
%24 = fsub double %21, %23
%25 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %24, double* %25
%26 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%27 = bitcast double* %2 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = fsub <2 x double> %28, %17
%30 = bitcast [3 x double]* %7 to <2 x double>*
store <2 x double> %29, <2 x double>* %30
%31 = getelementptr inbounds double, double* %2, i64 2
%32 = load double, double* %31
%33 = fsub double %32, %23
%34 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
store double %33, double* %34
%35 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%36 = call i32 @crossProduct(double* %12, double* %26, double* %35)
%37 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%38 = call i32 @crossProduct(double* %12, double* %35, double* %37)
%39 = load double, double* %0
%40 = load double, double* %37
%41 = call double @llvm.fmuladd.f64(double %39, double %40, double 0.000000e+00)
%42 = load double, double* %15
%43 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%44 = load double, double* %43
%45 = call double @llvm.fmuladd.f64(double %42, double %44, double %41)
%46 = load double, double* %22
%47 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%48 = load double, double* %47
%49 = call double @llvm.fmuladd.f64(double %46, double %48, double %45)
%50 = fcmp olt double %49, 0.000000e+00
%51 = zext i1 %50 to i32
ret i32 %51
}