#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*/ _cross_prod(long double *, long double *, long double *);
int /*<<< orphan*/ _to_cart(long double *, long double *);
long double angle_betw_0pi(long double *, long double *);
double fabsl(long double);
int isbetween(long double *a, long double *b, long double *x) {
  if (fabsl(x[0] - a[0]) < 0.0000001 && fabsl(x[1] - a[1]) < 0.0000001)
    return 1;
  if (fabsl(x[0] - b[0]) < 0.0000001 && fabsl(x[1] - b[1]) < 0.0000001)
    return 1;
  long double P0[3], P1[3], P2[3];
  _to_cart(a, P0);
  _to_cart(b, P1);
  _to_cart(x, P2);
  long double S[3];
  _cross_prod(P0, P1, S);
  long double gc = S[0] * P2[0] + S[1] * P2[1] + S[2] * P2[2];
  if (fabsl(gc) > 0.0000001)
    return 0;
  long double ax = angle_betw_0pi(P0, P2);
  long double bx = angle_betw_0pi(P1, P2);
  long double ab = angle_betw_0pi(P0, P1);
  if (ax <= ab && bx <= ab)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isbetween>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
fldt   (%rax)
mov    -0x10(%rbp),%rax
fldt   (%rax)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fabsl@plt>
movaps %xmm0,%xmm1
movsd  0xe86(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bf <isbetween+0x7f>
mov    -0x20(%rbp),%rax
fldt   0x10(%rax)
mov    -0x10(%rbp),%rax
fldt   0x10(%rax)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fabsl@plt>
movaps %xmm0,%xmm1
movsd  0xe57(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bf <isbetween+0x7f>
movl   $0x1,-0x4(%rbp)
jmp    1380 <isbetween+0x240>
mov    -0x20(%rbp),%rax
fldt   (%rax)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fabsl@plt>
movaps %xmm0,%xmm1
movsd  0xe1e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1227 <isbetween+0xe7>
mov    -0x20(%rbp),%rax
fldt   0x10(%rax)
mov    -0x18(%rbp),%rax
fldt   0x10(%rax)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fabsl@plt>
movaps %xmm0,%xmm1
movsd  0xdef(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1227 <isbetween+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    1380 <isbetween+0x240>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    %rsi,-0x130(%rbp)
call   1060 <_to_cart@plt>
mov    -0x18(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    %rsi,-0x128(%rbp)
call   1060 <_to_cart@plt>
mov    -0x20(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1060 <_to_cart@plt>
mov    -0x130(%rbp),%rdi
mov    -0x128(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1050 <_cross_prod@plt>
fldt   -0xe0(%rbp)
fldt   -0xb0(%rbp)
fldt   -0xd0(%rbp)
fldt   -0xa0(%rbp)
fmulp  %st,%st(1)
fxch   %st(2)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fldt   -0xc0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0xf0(%rbp)
fldt   -0xf0(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fabsl@plt>
movsd  0xd39(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12dd <isbetween+0x19d>
movl   $0x0,-0x4(%rbp)
jmp    1380 <isbetween+0x240>
lea    -0x50(%rbp),%rdi
mov    %rdi,-0x140(%rbp)
lea    -0xb0(%rbp),%rsi
mov    %rsi,-0x148(%rbp)
call   1040 <angle_betw_0pi@plt>
mov    -0x148(%rbp),%rsi
fstpt  -0x100(%rbp)
lea    -0x80(%rbp),%rdi
mov    %rdi,-0x138(%rbp)
call   1040 <angle_betw_0pi@plt>
mov    -0x140(%rbp),%rdi
mov    -0x138(%rbp),%rsi
fstpt  -0x110(%rbp)
call   1040 <angle_betw_0pi@plt>
fstpt  -0x120(%rbp)
fldt   -0x100(%rbp)
fldt   -0x120(%rbp)
fucomip %st(1),%st
fstp   %st(0)
jb     1379 <isbetween+0x239>
jmp    1352 <isbetween+0x212>
fldt   -0x110(%rbp)
fldt   -0x120(%rbp)
fucomip %st(1),%st
fstp   %st(0)
jb     1379 <isbetween+0x239>
jmp    136d <isbetween+0x22d>
movl   $0x1,-0x4(%rbp)
jmp    1380 <isbetween+0x240>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isbetween>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
fldt   (%rdx)
fldt   (%rdi)
fsubrp %st,%st(1)
fstpt  (%rsp)
call   1030 <fabsl@plt>
movsd  0xe93(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    119b <isbetween+0x5b>
fldt   0x10(%rbx)
fldt   0x10(%r15)
fsubrp %st,%st(1)
fstpt  (%rsp)
call   1030 <fabsl@plt>
mov    $0x1,%eax
movsd  0xe6f(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     12b9 <isbetween+0x179>
fldt   (%rbx)
fldt   (%r14)
fsubrp %st,%st(1)
fstpt  (%rsp)
call   1030 <fabsl@plt>
movsd  0xe4e(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11e0 <isbetween+0xa0>
fldt   0x10(%rbx)
fldt   0x10(%r14)
fsubrp %st,%st(1)
fstpt  (%rsp)
call   1030 <fabsl@plt>
mov    $0x1,%eax
movsd  0xe2a(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     12b9 <isbetween+0x179>
lea    0xc0(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <_to_cart@plt>
lea    0x90(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <_to_cart@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <_to_cart@plt>
lea    0x60(%rsp),%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <_cross_prod@plt>
fldt   0x60(%rsp)
fldt   0x30(%rsp)
fmulp  %st,%st(1)
fldt   0x70(%rsp)
fldt   0x40(%rsp)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fldt   0x80(%rsp)
fldt   0x50(%rsp)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpt  (%rsp)
call   1030 <fabsl@plt>
xor    %eax,%eax
ucomisd 0xda6(%rip),%xmm0
ja     12b9 <isbetween+0x179>
lea    0xc0(%rsp),%r14
lea    0x30(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <angle_betw_0pi@plt>
fstpt  0x24(%rsp)
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <angle_betw_0pi@plt>
fstpt  0x18(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <angle_betw_0pi@plt>
fldt   0x24(%rsp)
fxch   %st(1)
fucomi %st(1),%st
fstp   %st(1)
setae  %al
fldt   0x18(%rsp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %cl
and    %al,%cl
movzbl %cl,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @isbetween(x86_fp80* %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca i32
%5 = alloca x86_fp80*
%6 = alloca x86_fp80*
%7 = alloca x86_fp80*
%8 = alloca [3 x x86_fp80]
%9 = alloca [3 x x86_fp80]
%10 = alloca [3 x x86_fp80]
%11 = alloca [3 x x86_fp80]
%12 = alloca x86_fp80
%13 = alloca x86_fp80
%14 = alloca x86_fp80
%15 = alloca x86_fp80
store x86_fp80* %0, x86_fp80** %5
store x86_fp80* %1, x86_fp80** %6
store x86_fp80* %2, x86_fp80** %7
%16 = load x86_fp80*, x86_fp80** %7
%17 = getelementptr inbounds x86_fp80, x86_fp80* %16, i64 0
%18 = load x86_fp80, x86_fp80* %17
%19 = load x86_fp80*, x86_fp80** %5
%20 = getelementptr inbounds x86_fp80, x86_fp80* %19, i64 0
%21 = load x86_fp80, x86_fp80* %20
%22 = fsub x86_fp80 %18, %21
%23 = call double @fabsl(x86_fp80 %22)
%24 = fcmp olt double %23, 0x3E7AD7F29ABCAF48
br i1 %24, label %25, label %36
25: ; preds = %3
%26 = load x86_fp80*, x86_fp80** %7
%27 = getelementptr inbounds x86_fp80, x86_fp80* %26, i64 1
%28 = load x86_fp80, x86_fp80* %27
%29 = load x86_fp80*, x86_fp80** %5
%30 = getelementptr inbounds x86_fp80, x86_fp80* %29, i64 1
%31 = load x86_fp80, x86_fp80* %30
%32 = fsub x86_fp80 %28, %31
%33 = call double @fabsl(x86_fp80 %32)
%34 = fcmp olt double %33, 0x3E7AD7F29ABCAF48
br i1 %34, label %35, label %36
35: ; preds = %25
store i32 1, i32* %4
br label %109
36: ; preds = %25, %3
%37 = load x86_fp80*, x86_fp80** %7
%38 = getelementptr inbounds x86_fp80, x86_fp80* %37, i64 0
%39 = load x86_fp80, x86_fp80* %38
%40 = load x86_fp80*, x86_fp80** %6
%41 = getelementptr inbounds x86_fp80, x86_fp80* %40, i64 0
%42 = load x86_fp80, x86_fp80* %41
%43 = fsub x86_fp80 %39, %42
%44 = call double @fabsl(x86_fp80 %43)
%45 = fcmp olt double %44, 0x3E7AD7F29ABCAF48
br i1 %45, label %46, label %57
46: ; preds = %36
%47 = load x86_fp80*, x86_fp80** %7
%48 = getelementptr inbounds x86_fp80, x86_fp80* %47, i64 1
%49 = load x86_fp80, x86_fp80* %48
%50 = load x86_fp80*, x86_fp80** %6
%51 = getelementptr inbounds x86_fp80, x86_fp80* %50, i64 1
%52 = load x86_fp80, x86_fp80* %51
%53 = fsub x86_fp80 %49, %52
%54 = call double @fabsl(x86_fp80 %53)
%55 = fcmp olt double %54, 0x3E7AD7F29ABCAF48
br i1 %55, label %56, label %57
56: ; preds = %46
store i32 1, i32* %4
br label %109
57: ; preds = %46, %36
%58 = load x86_fp80*, x86_fp80** %5
%59 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%60 = call i32 @_to_cart(x86_fp80* %58, x86_fp80* %59)
%61 = load x86_fp80*, x86_fp80** %6
%62 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %9, i64 0, i64 0
%63 = call i32 @_to_cart(x86_fp80* %61, x86_fp80* %62)
%64 = load x86_fp80*, x86_fp80** %7
%65 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 0
%66 = call i32 @_to_cart(x86_fp80* %64, x86_fp80* %65)
%67 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%68 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %9, i64 0, i64 0
%69 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %11, i64 0, i64 0
%70 = call i32 @_cross_prod(x86_fp80* %67, x86_fp80* %68, x86_fp80* %69)
%71 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %11, i64 0, i64 0
%72 = load x86_fp80, x86_fp80* %71
%73 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 0
%74 = load x86_fp80, x86_fp80* %73
%75 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %11, i64 0, i64 1
%76 = load x86_fp80, x86_fp80* %75
%77 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 1
%78 = load x86_fp80, x86_fp80* %77
%79 = fmul x86_fp80 %76, %78
%80 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %72, x86_fp80 %74, x86_fp80 %79)
%81 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %11, i64 0, i64 2
%82 = load x86_fp80, x86_fp80* %81
%83 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 2
%84 = load x86_fp80, x86_fp80* %83
%85 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %82, x86_fp80 %84, x86_fp80 %80)
store x86_fp80 %85, x86_fp80* %12
%86 = load x86_fp80, x86_fp80* %12
%87 = call double @fabsl(x86_fp80 %86)
%88 = fcmp ogt double %87, 0x3E7AD7F29ABCAF48
br i1 %88, label %89, label %90
89: ; preds = %57
store i32 0, i32* %4
br label %109
90: ; preds = %57
%91 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%92 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 0
%93 = call x86_fp80 @angle_betw_0pi(x86_fp80* %91, x86_fp80* %92)
store x86_fp80 %93, x86_fp80* %13
%94 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %9, i64 0, i64 0
%95 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 0
%96 = call x86_fp80 @angle_betw_0pi(x86_fp80* %94, x86_fp80* %95)
store x86_fp80 %96, x86_fp80* %14
%97 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%98 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %9, i64 0, i64 0
%99 = call x86_fp80 @angle_betw_0pi(x86_fp80* %97, x86_fp80* %98)
store x86_fp80 %99, x86_fp80* %15
%100 = load x86_fp80, x86_fp80* %13
%101 = load x86_fp80, x86_fp80* %15
%102 = fcmp ole x86_fp80 %100, %101
br i1 %102, label %103, label %108
103: ; preds = %90
%104 = load x86_fp80, x86_fp80* %14
%105 = load x86_fp80, x86_fp80* %15
%106 = fcmp ole x86_fp80 %104, %105
br i1 %106, label %107, label %108
107: ; preds = %103
store i32 1, i32* %4
br label %109
108: ; preds = %103, %90
store i32 0, i32* %4
br label %109
109: ; preds = %108, %107, %89, %56, %35
%110 = load i32, i32* %4
ret i32 %110
}

LLVM IR (-O2):
define i32 @isbetween(x86_fp80* %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca [3 x x86_fp80]
%5 = alloca [3 x x86_fp80]
%6 = alloca [3 x x86_fp80]
%7 = alloca [3 x x86_fp80]
%8 = load x86_fp80, x86_fp80* %2
%9 = load x86_fp80, x86_fp80* %0
%10 = fsub x86_fp80 %8, %9
%11 = tail call double @fabsl(x86_fp80 %10)
%12 = fcmp olt double %11, 0x3E7AD7F29ABCAF48
br i1 %12, label %13, label %21
13: ; preds = %3
%14 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 1
%15 = load x86_fp80, x86_fp80* %14
%16 = getelementptr inbounds x86_fp80, x86_fp80* %0, i64 1
%17 = load x86_fp80, x86_fp80* %16
%18 = fsub x86_fp80 %15, %17
%19 = tail call double @fabsl(x86_fp80 %18)
%20 = fcmp olt double %19, 0x3E7AD7F29ABCAF48
br i1 %20, label %73, label %21
21: ; preds = %13, %3
%22 = load x86_fp80, x86_fp80* %2
%23 = load x86_fp80, x86_fp80* %1
%24 = fsub x86_fp80 %22, %23
%25 = tail call double @fabsl(x86_fp80 %24)
%26 = fcmp olt double %25, 0x3E7AD7F29ABCAF48
br i1 %26, label %27, label %35
27: ; preds = %21
%28 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 1
%29 = load x86_fp80, x86_fp80* %28
%30 = getelementptr inbounds x86_fp80, x86_fp80* %1, i64 1
%31 = load x86_fp80, x86_fp80* %30
%32 = fsub x86_fp80 %29, %31
%33 = tail call double @fabsl(x86_fp80 %32)
%34 = fcmp olt double %33, 0x3E7AD7F29ABCAF48
br i1 %34, label %73, label %35
35: ; preds = %27, %21
%36 = bitcast [3 x x86_fp80]* %4 to i8*
%37 = bitcast [3 x x86_fp80]* %5 to i8*
%38 = bitcast [3 x x86_fp80]* %6 to i8*
%39 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %4, i64 0, i64 0
%40 = call i32 @_to_cart(x86_fp80* %0, x86_fp80* %39)
%41 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %5, i64 0, i64 0
%42 = call i32 @_to_cart(x86_fp80* %1, x86_fp80* %41)
%43 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %6, i64 0, i64 0
%44 = call i32 @_to_cart(x86_fp80* %2, x86_fp80* %43)
%45 = bitcast [3 x x86_fp80]* %7 to i8*
%46 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %7, i64 0, i64 0
%47 = call i32 @_cross_prod(x86_fp80* %39, x86_fp80* %41, x86_fp80* %46)
%48 = load x86_fp80, x86_fp80* %46
%49 = load x86_fp80, x86_fp80* %43
%50 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %7, i64 0, i64 1
%51 = load x86_fp80, x86_fp80* %50
%52 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %6, i64 0, i64 1
%53 = load x86_fp80, x86_fp80* %52
%54 = fmul x86_fp80 %51, %53
%55 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %48, x86_fp80 %49, x86_fp80 %54)
%56 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %7, i64 0, i64 2
%57 = load x86_fp80, x86_fp80* %56
%58 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %6, i64 0, i64 2
%59 = load x86_fp80, x86_fp80* %58
%60 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %57, x86_fp80 %59, x86_fp80 %55)
%61 = call double @fabsl(x86_fp80 %60)
%62 = fcmp ogt double %61, 0x3E7AD7F29ABCAF48
br i1 %62, label %71, label %63
63: ; preds = %35
%64 = call x86_fp80 @angle_betw_0pi(x86_fp80* %39, x86_fp80* %43)
%65 = call x86_fp80 @angle_betw_0pi(x86_fp80* %41, x86_fp80* %43)
%66 = call x86_fp80 @angle_betw_0pi(x86_fp80* %39, x86_fp80* %41)
%67 = fcmp ole x86_fp80 %64, %66
%68 = fcmp ole x86_fp80 %65, %66
%69 = select i1 %67, i1 %68, i1 false
%70 = zext i1 %69 to i32
br label %71
71: ; preds = %35, %63
%72 = phi i32 [ %70, %63 ], [ 0, %35 ]
br label %73
73: ; preds = %27, %13, %71
%74 = phi i32 [ %72, %71 ], [ 1, %13 ], [ 1, %27 ]
ret i32 %74
}