#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 ccw(double, double, double, double, double, double);
int intersect(double pix, double piy, double pjx, double pjy, double pkx,
              double pky, double plx, double ply) {
  return (
      (ccw(pix, piy, pjx, pjy, pkx, pky) * ccw(pix, piy, pjx, pjy, plx, ply) <=
       0) &&
      (ccw(pkx, pky, plx, ply, pix, piy) * ccw(pkx, pky, plx, ply, pjx, pjy) <=
       0));
}


x86 assembly (clang, -O0):
<intersect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  -0x30(%rbp),%xmm5
call   1030 <ccw@plt>
mov    %eax,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm5
call   1030 <ccw@plt>
mov    -0x48(%rbp),%ecx
imul   %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x41(%rbp)
jg     11f7 <intersect+0xe7>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movsd  -0x8(%rbp),%xmm4
movsd  -0x10(%rbp),%xmm5
call   1030 <ccw@plt>
mov    %eax,-0x4c(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm5
call   1030 <ccw@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
cmp    $0x0,%eax
setle  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intersect>:
push   %rbx
sub    $0x40,%rsp
movsd  %xmm7,0x8(%rsp)
movsd  %xmm6,(%rsp)
movsd  %xmm3,0x38(%rsp)
movsd  %xmm2,0x30(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x20(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm5,0x18(%rsp)
call   1030 <ccw@plt>
mov    %eax,%ebx
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x38(%rsp),%xmm3
movsd  (%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
call   1030 <ccw@plt>
mov    %eax,%ecx
imul   %ebx,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jg     11dc <intersect+0xcc>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x28(%rsp),%xmm5
call   1030 <ccw@plt>
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
movsd  0x30(%rsp),%xmm4
movsd  0x38(%rsp),%xmm5
call   1030 <ccw@plt>
mov    %eax,%ecx
imul   %ebx,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setle  %al
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @intersect(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%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* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
store double %7, double* %16
%17 = load double, double* %9
%18 = load double, double* %10
%19 = load double, double* %11
%20 = load double, double* %12
%21 = load double, double* %13
%22 = load double, double* %14
%23 = call i32 @ccw(double %17, double %18, double %19, double %20, double %21, double %22)
%24 = load double, double* %9
%25 = load double, double* %10
%26 = load double, double* %11
%27 = load double, double* %12
%28 = load double, double* %15
%29 = load double, double* %16
%30 = call i32 @ccw(double %24, double %25, double %26, double %27, double %28, double %29)
%31 = mul nsw i32 %23, %30
%32 = icmp sle i32 %31, 0
br i1 %32, label %33, label %50
33: ; preds = %8
%34 = load double, double* %13
%35 = load double, double* %14
%36 = load double, double* %15
%37 = load double, double* %16
%38 = load double, double* %9
%39 = load double, double* %10
%40 = call i32 @ccw(double %34, double %35, double %36, double %37, double %38, double %39)
%41 = load double, double* %13
%42 = load double, double* %14
%43 = load double, double* %15
%44 = load double, double* %16
%45 = load double, double* %11
%46 = load double, double* %12
%47 = call i32 @ccw(double %41, double %42, double %43, double %44, double %45, double %46)
%48 = mul nsw i32 %40, %47
%49 = icmp sle i32 %48, 0
br label %50
50: ; preds = %33, %8
%51 = phi i1 [ false, %8 ], [ %49, %33 ]
%52 = zext i1 %51 to i32
ret i32 %52
}

LLVM IR (-O2):
define i32 @intersect(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = tail call i32 @ccw(double %0, double %1, double %2, double %3, double %4, double %5)
%10 = tail call i32 @ccw(double %0, double %1, double %2, double %3, double %6, double %7)
%11 = mul nsw i32 %10, %9
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = tail call i32 @ccw(double %4, double %5, double %6, double %7, double %0, double %1)
%15 = tail call i32 @ccw(double %4, double %5, double %6, double %7, double %2, double %3)
%16 = mul nsw i32 %15, %14
%17 = icmp slt i32 %16, 1
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %13, %8
%20 = phi i32 [ 0, %8 ], [ %18, %13 ]
ret i32 %20
}