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


x86 assembly (clang, -O0):
<hff3>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x8c(%rbp)
cmpl   $0x3,-0x8c(%rbp)
jge    118a <hff3+0x7a>
mov    -0x18(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x8c(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    113c <hff3+0x2c>
movl   $0x0,-0x90(%rbp)
cmpl   $0x3,-0x90(%rbp)
jge    11e2 <hff3+0xd2>
mov    -0x20(%rbp),%rax
movslq -0x90(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x90(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x90(%rbp),%rax
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1194 <hff3+0x84>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <crossProduct@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x3,-0x94(%rbp)
jge    1253 <hff3+0x143>
movsd  -0x88(%rbp),%xmm1
ff
mov    -0x10(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x94(%rbp),%rax
movsd  -0x40(%rbp,%rax,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11fd <hff3+0xed>
movsd  -0x88(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1274 <hff3+0x164>
movl   $0x0,-0x4(%rbp)
jmp    127b <hff3+0x16b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hff3>:
push   %rbx
sub    $0x60,%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),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
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 %xmm2,%xmm0
setbe  %al
add    $0x60,%rsp
pop    %rbx
ret

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

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