int TkLineToArea(end1Ptr, end2Ptr, rectPtr)
double end1Ptr[2];
double end2Ptr[2];
double rectPtr[4];
{
  int inside1, inside2;
  inside1 = (end1Ptr[0] >= rectPtr[0]) && (end1Ptr[0] <= rectPtr[2]) &&
            (end1Ptr[1] >= rectPtr[1]) && (end1Ptr[1] <= rectPtr[3]);
  inside2 = (end2Ptr[0] >= rectPtr[0]) && (end2Ptr[0] <= rectPtr[2]) &&
            (end2Ptr[1] >= rectPtr[1]) && (end2Ptr[1] <= rectPtr[3]);
  if (inside1 != inside2) {
    return 0;
  }
  if (inside1 & inside2) {
    return 1;
  }
  if (end1Ptr[0] == end2Ptr[0]) {
    if (((end1Ptr[1] >= rectPtr[1]) ^ (end2Ptr[1] >= rectPtr[1])) &&
        (end1Ptr[0] >= rectPtr[0]) && (end1Ptr[0] <= rectPtr[2])) {
      return 0;
    }
  } else if (end1Ptr[1] == end2Ptr[1]) {
    if (((end1Ptr[0] >= rectPtr[0]) ^ (end2Ptr[0] >= rectPtr[0])) &&
        (end1Ptr[1] >= rectPtr[1]) && (end1Ptr[1] <= rectPtr[3])) {
      return 0;
    }
  } else {
    double m, x, y, low, high;
    m = (end2Ptr[1] - end1Ptr[1]) / (end2Ptr[0] - end1Ptr[0]);
    if (end1Ptr[0] < end2Ptr[0]) {
      low = end1Ptr[0];
      high = end2Ptr[0];
    } else {
      low = end2Ptr[0];
      high = end1Ptr[0];
    }
    y = end1Ptr[1] + (rectPtr[0] - end1Ptr[0]) * m;
    if ((rectPtr[0] >= low) && (rectPtr[0] <= high) && (y >= rectPtr[1]) &&
        (y <= rectPtr[3])) {
      return 0;
    }
    y += (rectPtr[2] - rectPtr[0]) * m;
    if ((y >= rectPtr[1]) && (y <= rectPtr[3]) && (rectPtr[2] >= low) &&
        (rectPtr[2] <= high)) {
      return 0;
    }
    if (end1Ptr[1] < end2Ptr[1]) {
      low = end1Ptr[1];
      high = end2Ptr[1];
    } else {
      low = end2Ptr[1];
      high = end1Ptr[1];
    }
    x = end1Ptr[0] + (rectPtr[1] - end1Ptr[1]) / m;
    if ((x >= rectPtr[0]) && (x <= rectPtr[2]) && (rectPtr[1] >= low) &&
        (rectPtr[1] <= high)) {
      return 0;
    }
    x += (rectPtr[3] - rectPtr[1]) / m;
    if ((x >= rectPtr[0]) && (x <= rectPtr[2]) && (rectPtr[3] >= low) &&
        (rectPtr[3] <= high)) {
      return 0;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<TkLineToArea>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
ucomisd (%rcx),%xmm0
mov    %al,-0x51(%rbp)
jb     1184 <TkLineToArea+0x84>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x51(%rbp)
jb     1184 <TkLineToArea+0x84>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
ucomisd 0x8(%rcx),%xmm0
mov    %al,-0x51(%rbp)
jb     1184 <TkLineToArea+0x84>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
ucomisd (%rcx),%xmm0
mov    %al,-0x52(%rbp)
jb     1203 <TkLineToArea+0x103>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x52(%rbp)
jb     1203 <TkLineToArea+0x103>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
ucomisd 0x8(%rcx),%xmm0
mov    %al,-0x52(%rbp)
jb     1203 <TkLineToArea+0x103>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x52(%rbp)
mov    -0x52(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     1226 <TkLineToArea+0x126>
movl   $0x0,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
mov    -0x24(%rbp),%eax
and    -0x28(%rbp),%eax
cmp    $0x0,%eax
je     1241 <TkLineToArea+0x141>
movl   $0x1,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jne    12df <TkLineToArea+0x1df>
jp     12df <TkLineToArea+0x1df>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
movsd  0x8(%rcx),%xmm0
mov    -0x20(%rbp),%rcx
ucomisd 0x8(%rcx),%xmm0
setae  %cl
and    $0x1,%cl
movzbl %cl,%ecx
xor    %ecx,%eax
cmp    $0x0,%eax
je     12da <TkLineToArea+0x1da>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
jb     12da <TkLineToArea+0x1da>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     12da <TkLineToArea+0x1da>
movl   $0x0,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
jmp    1687 <TkLineToArea+0x587>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jne    137e <TkLineToArea+0x27e>
jp     137e <TkLineToArea+0x27e>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
movsd  (%rcx),%xmm0
mov    -0x20(%rbp),%rcx
ucomisd (%rcx),%xmm0
setae  %cl
and    $0x1,%cl
movzbl %cl,%ecx
xor    %ecx,%eax
cmp    $0x0,%eax
je     1379 <TkLineToArea+0x279>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jb     1379 <TkLineToArea+0x279>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1379 <TkLineToArea+0x279>
movl   $0x0,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
jmp    1682 <TkLineToArea+0x582>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    13e2 <TkLineToArea+0x2e2>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13fc <TkLineToArea+0x2fc>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     1489 <TkLineToArea+0x389>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1489 <TkLineToArea+0x389>
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jb     1489 <TkLineToArea+0x389>
movsd  -0x40(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1489 <TkLineToArea+0x389>
movl   $0x0,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jb     1515 <TkLineToArea+0x415>
movsd  -0x40(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1515 <TkLineToArea+0x415>
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     1515 <TkLineToArea+0x415>
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1515 <TkLineToArea+0x415>
movl   $0x0,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1552 <TkLineToArea+0x452>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    156e <TkLineToArea+0x46e>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
divsd  -0x30(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
jb     15f9 <TkLineToArea+0x4f9>
movsd  -0x38(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     15f9 <TkLineToArea+0x4f9>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     15f9 <TkLineToArea+0x4f9>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     15f9 <TkLineToArea+0x4f9>
movl   $0x0,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x8(%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
jb     167d <TkLineToArea+0x57d>
movsd  -0x38(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     167d <TkLineToArea+0x57d>
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     167d <TkLineToArea+0x57d>
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     167d <TkLineToArea+0x57d>
movl   $0x0,-0x4(%rbp)
jmp    168e <TkLineToArea+0x58e>
jmp    1682 <TkLineToArea+0x582>
jmp    1687 <TkLineToArea+0x587>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TkLineToArea>:
movsd  (%rdi),%xmm0
movsd  (%rdx),%xmm1
ucomisd %xmm1,%xmm0
jb     1125 <TkLineToArea+0x25>
movsd  0x10(%rdx),%xmm2
ucomisd %xmm0,%xmm2
jb     1125 <TkLineToArea+0x25>
movsd  0x8(%rdi),%xmm2
ucomisd 0x8(%rdx),%xmm2
jae    114f <TkLineToArea+0x4f>
xor    %ecx,%ecx
movsd  (%rsi),%xmm3
ucomisd %xmm1,%xmm3
jb     1148 <TkLineToArea+0x48>
movsd  0x10(%rdx),%xmm2
ucomisd %xmm3,%xmm2
jb     1148 <TkLineToArea+0x48>
movsd  0x8(%rsi),%xmm2
ucomisd 0x8(%rdx),%xmm2
jae    115d <TkLineToArea+0x5d>
xor    %eax,%eax
test   %cl,%cl
je     1183 <TkLineToArea+0x83>
ret
movsd  0x18(%rdx),%xmm3
ucomisd %xmm2,%xmm3
setae  %cl
jmp    1127 <TkLineToArea+0x27>
movsd  0x18(%rdx),%xmm4
ucomisd %xmm2,%xmm4
setae  %r8b
xor    %eax,%eax
xor    %cl,%r8b
jne    114e <TkLineToArea+0x4e>
ucomisd %xmm2,%xmm4
setae  %r8b
mov    $0x1,%eax
test   %r8b,%cl
jne    114e <TkLineToArea+0x4e>
ucomisd %xmm3,%xmm0
movsd  0x8(%rdi),%xmm4
jne    11cd <TkLineToArea+0xcd>
jp     11cd <TkLineToArea+0xcd>
movsd  0x8(%rdx),%xmm2
ucomisd %xmm2,%xmm4
setb   %al
movsd  0x8(%rsi),%xmm3
ucomisd %xmm2,%xmm3
setae  %cl
xor    %al,%cl
jne    1307 <TkLineToArea+0x207>
ucomisd %xmm1,%xmm0
jb     1307 <TkLineToArea+0x207>
movsd  0x10(%rdx),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
jb     1307 <TkLineToArea+0x207>
jmp    114e <TkLineToArea+0x4e>
movsd  0x8(%rsi),%xmm10
ucomisd %xmm10,%xmm4
jne    1213 <TkLineToArea+0x113>
jp     1213 <TkLineToArea+0x113>
ucomisd %xmm1,%xmm0
setae  %al
ucomisd %xmm1,%xmm3
setae  %cl
cmp    %cl,%al
je     1307 <TkLineToArea+0x207>
ucomisd 0x8(%rdx),%xmm4
jb     1307 <TkLineToArea+0x207>
movsd  0x18(%rdx),%xmm0
xor    %eax,%eax
ucomisd %xmm4,%xmm0
jae    114e <TkLineToArea+0x4e>
jmp    1307 <TkLineToArea+0x207>
movapd %xmm10,%xmm5
subsd  %xmm4,%xmm5
movapd %xmm3,%xmm2
subsd  %xmm0,%xmm2
divsd  %xmm2,%xmm5
movapd %xmm0,%xmm7
minsd  %xmm3,%xmm7
maxsd  %xmm0,%xmm3
movapd %xmm1,%xmm6
subsd  %xmm0,%xmm6
mulsd  %xmm5,%xmm6
addsd  %xmm4,%xmm6
ucomisd %xmm7,%xmm1
movsd  0x8(%rdx),%xmm9
jb     126e <TkLineToArea+0x16e>
ucomisd %xmm1,%xmm3
jb     126e <TkLineToArea+0x16e>
ucomisd %xmm9,%xmm6
jb     126e <TkLineToArea+0x16e>
movsd  0x18(%rdx),%xmm2
xor    %eax,%eax
ucomisd %xmm6,%xmm2
jae    114e <TkLineToArea+0x4e>
movsd  0x10(%rdx),%xmm8
movapd %xmm8,%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm5,%xmm2
addsd  %xmm6,%xmm2
ucomisd %xmm9,%xmm2
jb     12ab <TkLineToArea+0x1ab>
movsd  0x18(%rdx),%xmm6
ucomisd %xmm2,%xmm6
jb     12ab <TkLineToArea+0x1ab>
ucomisd %xmm7,%xmm8
jb     12ab <TkLineToArea+0x1ab>
xor    %eax,%eax
ucomisd %xmm8,%xmm3
jae    114e <TkLineToArea+0x4e>
movapd %xmm4,%xmm3
minsd  %xmm10,%xmm3
maxsd  %xmm4,%xmm10
movapd %xmm9,%xmm2
subsd  %xmm4,%xmm2
divsd  %xmm5,%xmm2
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     12eb <TkLineToArea+0x1eb>
ucomisd %xmm0,%xmm8
jb     12eb <TkLineToArea+0x1eb>
ucomisd %xmm3,%xmm9
jb     12eb <TkLineToArea+0x1eb>
xor    %eax,%eax
ucomisd %xmm9,%xmm10
jae    114e <TkLineToArea+0x4e>
movsd  0x18(%rdx),%xmm4
movapd %xmm4,%xmm2
subsd  %xmm9,%xmm2
divsd  %xmm5,%xmm2
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jae    130d <TkLineToArea+0x20d>
mov    $0xffffffff,%eax
ret
ucomisd %xmm0,%xmm8
jb     1307 <TkLineToArea+0x207>
ucomisd %xmm3,%xmm4
jb     1307 <TkLineToArea+0x207>
xor    %eax,%eax
ucomisd %xmm4,%xmm10
jae    114e <TkLineToArea+0x4e>
jmp    1307 <TkLineToArea+0x207>

LLVM IR (-O0):
define i32 @TkLineToArea(double* %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = load double*, double** %7
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = fcmp oge double %17, %20
br i1 %21, label %22, label %46
22: ; preds = %3
%23 = load double*, double** %5
%24 = getelementptr inbounds double, double* %23, i64 0
%25 = load double, double* %24
%26 = load double*, double** %7
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = fcmp ole double %25, %28
br i1 %29, label %30, label %46
30: ; preds = %22
%31 = load double*, double** %5
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = load double*, double** %7
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = fcmp oge double %33, %36
br i1 %37, label %38, label %46
38: ; preds = %30
%39 = load double*, double** %5
%40 = getelementptr inbounds double, double* %39, i64 1
%41 = load double, double* %40
%42 = load double*, double** %7
%43 = getelementptr inbounds double, double* %42, i64 3
%44 = load double, double* %43
%45 = fcmp ole double %41, %44
br label %46
46: ; preds = %38, %30, %22, %3
%47 = phi i1 [ false, %30 ], [ false, %22 ], [ false, %3 ], [ %45, %38 ]
%48 = zext i1 %47 to i32
store i32 %48, i32* %8
%49 = load double*, double** %6
%50 = getelementptr inbounds double, double* %49, i64 0
%51 = load double, double* %50
%52 = load double*, double** %7
%53 = getelementptr inbounds double, double* %52, i64 0
%54 = load double, double* %53
%55 = fcmp oge double %51, %54
br i1 %55, label %56, label %80
56: ; preds = %46
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 0
%59 = load double, double* %58
%60 = load double*, double** %7
%61 = getelementptr inbounds double, double* %60, i64 2
%62 = load double, double* %61
%63 = fcmp ole double %59, %62
br i1 %63, label %64, label %80
64: ; preds = %56
%65 = load double*, double** %6
%66 = getelementptr inbounds double, double* %65, i64 1
%67 = load double, double* %66
%68 = load double*, double** %7
%69 = getelementptr inbounds double, double* %68, i64 1
%70 = load double, double* %69
%71 = fcmp oge double %67, %70
br i1 %71, label %72, label %80
72: ; preds = %64
%73 = load double*, double** %6
%74 = getelementptr inbounds double, double* %73, i64 1
%75 = load double, double* %74
%76 = load double*, double** %7
%77 = getelementptr inbounds double, double* %76, i64 3
%78 = load double, double* %77
%79 = fcmp ole double %75, %78
br label %80
80: ; preds = %72, %64, %56, %46
%81 = phi i1 [ false, %64 ], [ false, %56 ], [ false, %46 ], [ %79, %72 ]
%82 = zext i1 %81 to i32
store i32 %82, i32* %9
%83 = load i32, i32* %8
%84 = load i32, i32* %9
%85 = icmp ne i32 %83, %84
br i1 %85, label %86, label %87
86: ; preds = %80
store i32 0, i32* %4
br label %391
87: ; preds = %80
%88 = load i32, i32* %8
%89 = load i32, i32* %9
%90 = and i32 %88, %89
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %93
92: ; preds = %87
store i32 1, i32* %4
br label %391
93: ; preds = %87
%94 = load double*, double** %5
%95 = getelementptr inbounds double, double* %94, i64 0
%96 = load double, double* %95
%97 = load double*, double** %6
%98 = getelementptr inbounds double, double* %97, i64 0
%99 = load double, double* %98
%100 = fcmp oeq double %96, %99
br i1 %100, label %101, label %138
101: ; preds = %93
%102 = load double*, double** %5
%103 = getelementptr inbounds double, double* %102, i64 1
%104 = load double, double* %103
%105 = load double*, double** %7
%106 = getelementptr inbounds double, double* %105, i64 1
%107 = load double, double* %106
%108 = fcmp oge double %104, %107
%109 = zext i1 %108 to i32
%110 = load double*, double** %6
%111 = getelementptr inbounds double, double* %110, i64 1
%112 = load double, double* %111
%113 = load double*, double** %7
%114 = getelementptr inbounds double, double* %113, i64 1
%115 = load double, double* %114
%116 = fcmp oge double %112, %115
%117 = zext i1 %116 to i32
%118 = xor i32 %109, %117
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %137
120: ; preds = %101
%121 = load double*, double** %5
%122 = getelementptr inbounds double, double* %121, i64 0
%123 = load double, double* %122
%124 = load double*, double** %7
%125 = getelementptr inbounds double, double* %124, i64 0
%126 = load double, double* %125
%127 = fcmp oge double %123, %126
br i1 %127, label %128, label %137
128: ; preds = %120
%129 = load double*, double** %5
%130 = getelementptr inbounds double, double* %129, i64 0
%131 = load double, double* %130
%132 = load double*, double** %7
%133 = getelementptr inbounds double, double* %132, i64 2
%134 = load double, double* %133
%135 = fcmp ole double %131, %134
br i1 %135, label %136, label %137
136: ; preds = %128
store i32 0, i32* %4
br label %391
137: ; preds = %128, %120, %101
br label %390
138: ; preds = %93
%139 = load double*, double** %5
%140 = getelementptr inbounds double, double* %139, i64 1
%141 = load double, double* %140
%142 = load double*, double** %6
%143 = getelementptr inbounds double, double* %142, i64 1
%144 = load double, double* %143
%145 = fcmp oeq double %141, %144
br i1 %145, label %146, label %183
146: ; preds = %138
%147 = load double*, double** %5
%148 = getelementptr inbounds double, double* %147, i64 0
%149 = load double, double* %148
%150 = load double*, double** %7
%151 = getelementptr inbounds double, double* %150, i64 0
%152 = load double, double* %151
%153 = fcmp oge double %149, %152
%154 = zext i1 %153 to i32
%155 = load double*, double** %6
%156 = getelementptr inbounds double, double* %155, i64 0
%157 = load double, double* %156
%158 = load double*, double** %7
%159 = getelementptr inbounds double, double* %158, i64 0
%160 = load double, double* %159
%161 = fcmp oge double %157, %160
%162 = zext i1 %161 to i32
%163 = xor i32 %154, %162
%164 = icmp ne i32 %163, 0
br i1 %164, label %165, label %182
165: ; preds = %146
%166 = load double*, double** %5
%167 = getelementptr inbounds double, double* %166, i64 1
%168 = load double, double* %167
%169 = load double*, double** %7
%170 = getelementptr inbounds double, double* %169, i64 1
%171 = load double, double* %170
%172 = fcmp oge double %168, %171
br i1 %172, label %173, label %182
173: ; preds = %165
%174 = load double*, double** %5
%175 = getelementptr inbounds double, double* %174, i64 1
%176 = load double, double* %175
%177 = load double*, double** %7
%178 = getelementptr inbounds double, double* %177, i64 3
%179 = load double, double* %178
%180 = fcmp ole double %176, %179
br i1 %180, label %181, label %182
181: ; preds = %173
store i32 0, i32* %4
br label %391
182: ; preds = %173, %165, %146
br label %389
183: ; preds = %138
%184 = load double*, double** %6
%185 = getelementptr inbounds double, double* %184, i64 1
%186 = load double, double* %185
%187 = load double*, double** %5
%188 = getelementptr inbounds double, double* %187, i64 1
%189 = load double, double* %188
%190 = fsub double %186, %189
%191 = load double*, double** %6
%192 = getelementptr inbounds double, double* %191, i64 0
%193 = load double, double* %192
%194 = load double*, double** %5
%195 = getelementptr inbounds double, double* %194, i64 0
%196 = load double, double* %195
%197 = fsub double %193, %196
%198 = fdiv double %190, %197
store double %198, double* %10
%199 = load double*, double** %5
%200 = getelementptr inbounds double, double* %199, i64 0
%201 = load double, double* %200
%202 = load double*, double** %6
%203 = getelementptr inbounds double, double* %202, i64 0
%204 = load double, double* %203
%205 = fcmp olt double %201, %204
br i1 %205, label %206, label %213
206: ; preds = %183
%207 = load double*, double** %5
%208 = getelementptr inbounds double, double* %207, i64 0
%209 = load double, double* %208
store double %209, double* %13
%210 = load double*, double** %6
%211 = getelementptr inbounds double, double* %210, i64 0
%212 = load double, double* %211
store double %212, double* %14
br label %220
213: ; preds = %183
%214 = load double*, double** %6
%215 = getelementptr inbounds double, double* %214, i64 0
%216 = load double, double* %215
store double %216, double* %13
%217 = load double*, double** %5
%218 = getelementptr inbounds double, double* %217, i64 0
%219 = load double, double* %218
store double %219, double* %14
br label %220
220: ; preds = %213, %206
%221 = load double*, double** %5
%222 = getelementptr inbounds double, double* %221, i64 1
%223 = load double, double* %222
%224 = load double*, double** %7
%225 = getelementptr inbounds double, double* %224, i64 0
%226 = load double, double* %225
%227 = load double*, double** %5
%228 = getelementptr inbounds double, double* %227, i64 0
%229 = load double, double* %228
%230 = fsub double %226, %229
%231 = load double, double* %10
%232 = call double @llvm.fmuladd.f64(double %230, double %231, double %223)
store double %232, double* %12
%233 = load double*, double** %7
%234 = getelementptr inbounds double, double* %233, i64 0
%235 = load double, double* %234
%236 = load double, double* %13
%237 = fcmp oge double %235, %236
br i1 %237, label %238, label %257
238: ; preds = %220
%239 = load double*, double** %7
%240 = getelementptr inbounds double, double* %239, i64 0
%241 = load double, double* %240
%242 = load double, double* %14
%243 = fcmp ole double %241, %242
br i1 %243, label %244, label %257
244: ; preds = %238
%245 = load double, double* %12
%246 = load double*, double** %7
%247 = getelementptr inbounds double, double* %246, i64 1
%248 = load double, double* %247
%249 = fcmp oge double %245, %248
br i1 %249, label %250, label %257
250: ; preds = %244
%251 = load double, double* %12
%252 = load double*, double** %7
%253 = getelementptr inbounds double, double* %252, i64 3
%254 = load double, double* %253
%255 = fcmp ole double %251, %254
br i1 %255, label %256, label %257
256: ; preds = %250
store i32 0, i32* %4
br label %391
257: ; preds = %250, %244, %238, %220
%258 = load double*, double** %7
%259 = getelementptr inbounds double, double* %258, i64 2
%260 = load double, double* %259
%261 = load double*, double** %7
%262 = getelementptr inbounds double, double* %261, i64 0
%263 = load double, double* %262
%264 = fsub double %260, %263
%265 = load double, double* %10
%266 = load double, double* %12
%267 = call double @llvm.fmuladd.f64(double %264, double %265, double %266)
store double %267, double* %12
%268 = load double, double* %12
%269 = load double*, double** %7
%270 = getelementptr inbounds double, double* %269, i64 1
%271 = load double, double* %270
%272 = fcmp oge double %268, %271
br i1 %272, label %273, label %292
273: ; preds = %257
%274 = load double, double* %12
%275 = load double*, double** %7
%276 = getelementptr inbounds double, double* %275, i64 3
%277 = load double, double* %276
%278 = fcmp ole double %274, %277
br i1 %278, label %279, label %292
279: ; preds = %273
%280 = load double*, double** %7
%281 = getelementptr inbounds double, double* %280, i64 2
%282 = load double, double* %281
%283 = load double, double* %13
%284 = fcmp oge double %282, %283
br i1 %284, label %285, label %292
285: ; preds = %279
%286 = load double*, double** %7
%287 = getelementptr inbounds double, double* %286, i64 2
%288 = load double, double* %287
%289 = load double, double* %14
%290 = fcmp ole double %288, %289
br i1 %290, label %291, label %292
291: ; preds = %285
store i32 0, i32* %4
br label %391
292: ; preds = %285, %279, %273, %257
%293 = load double*, double** %5
%294 = getelementptr inbounds double, double* %293, i64 1
%295 = load double, double* %294
%296 = load double*, double** %6
%297 = getelementptr inbounds double, double* %296, i64 1
%298 = load double, double* %297
%299 = fcmp olt double %295, %298
br i1 %299, label %300, label %307
300: ; preds = %292
%301 = load double*, double** %5
%302 = getelementptr inbounds double, double* %301, i64 1
%303 = load double, double* %302
store double %303, double* %13
%304 = load double*, double** %6
%305 = getelementptr inbounds double, double* %304, i64 1
%306 = load double, double* %305
store double %306, double* %14
br label %314
307: ; preds = %292
%308 = load double*, double** %6
%309 = getelementptr inbounds double, double* %308, i64 1
%310 = load double, double* %309
store double %310, double* %13
%311 = load double*, double** %5
%312 = getelementptr inbounds double, double* %311, i64 1
%313 = load double, double* %312
store double %313, double* %14
br label %314
314: ; preds = %307, %300
%315 = load double*, double** %5
%316 = getelementptr inbounds double, double* %315, i64 0
%317 = load double, double* %316
%318 = load double*, double** %7
%319 = getelementptr inbounds double, double* %318, i64 1
%320 = load double, double* %319
%321 = load double*, double** %5
%322 = getelementptr inbounds double, double* %321, i64 1
%323 = load double, double* %322
%324 = fsub double %320, %323
%325 = load double, double* %10
%326 = fdiv double %324, %325
%327 = fadd double %317, %326
store double %327, double* %11
%328 = load double, double* %11
%329 = load double*, double** %7
%330 = getelementptr inbounds double, double* %329, i64 0
%331 = load double, double* %330
%332 = fcmp oge double %328, %331
br i1 %332, label %333, label %352
333: ; preds = %314
%334 = load double, double* %11
%335 = load double*, double** %7
%336 = getelementptr inbounds double, double* %335, i64 2
%337 = load double, double* %336
%338 = fcmp ole double %334, %337
br i1 %338, label %339, label %352
339: ; preds = %333
%340 = load double*, double** %7
%341 = getelementptr inbounds double, double* %340, i64 1
%342 = load double, double* %341
%343 = load double, double* %13
%344 = fcmp oge double %342, %343
br i1 %344, label %345, label %352
345: ; preds = %339
%346 = load double*, double** %7
%347 = getelementptr inbounds double, double* %346, i64 1
%348 = load double, double* %347
%349 = load double, double* %14
%350 = fcmp ole double %348, %349
br i1 %350, label %351, label %352
351: ; preds = %345
store i32 0, i32* %4
br label %391
352: ; preds = %345, %339, %333, %314
%353 = load double*, double** %7
%354 = getelementptr inbounds double, double* %353, i64 3
%355 = load double, double* %354
%356 = load double*, double** %7
%357 = getelementptr inbounds double, double* %356, i64 1
%358 = load double, double* %357
%359 = fsub double %355, %358
%360 = load double, double* %10
%361 = fdiv double %359, %360
%362 = load double, double* %11
%363 = fadd double %362, %361
store double %363, double* %11
%364 = load double, double* %11
%365 = load double*, double** %7
%366 = getelementptr inbounds double, double* %365, i64 0
%367 = load double, double* %366
%368 = fcmp oge double %364, %367
br i1 %368, label %369, label %388
369: ; preds = %352
%370 = load double, double* %11
%371 = load double*, double** %7
%372 = getelementptr inbounds double, double* %371, i64 2
%373 = load double, double* %372
%374 = fcmp ole double %370, %373
br i1 %374, label %375, label %388
375: ; preds = %369
%376 = load double*, double** %7
%377 = getelementptr inbounds double, double* %376, i64 3
%378 = load double, double* %377
%379 = load double, double* %13
%380 = fcmp oge double %378, %379
br i1 %380, label %381, label %388
381: ; preds = %375
%382 = load double*, double** %7
%383 = getelementptr inbounds double, double* %382, i64 3
%384 = load double, double* %383
%385 = load double, double* %14
%386 = fcmp ole double %384, %385
br i1 %386, label %387, label %388
387: ; preds = %381
store i32 0, i32* %4
br label %391
388: ; preds = %381, %375, %369, %352
br label %389
389: ; preds = %388, %182
br label %390
390: ; preds = %389, %137
store i32 -1, i32* %4
br label %391
391: ; preds = %390, %387, %351, %291, %256, %181, %136, %92, %86
%392 = load i32, i32* %4
ret i32 %392
}

LLVM IR (-O2):
define i32 @TkLineToArea(double* nocapture %0, double* nocapture %1, double* %2) {
%4 = load double, double* %0
%5 = load double, double* %2
%6 = fcmp ult double %4, %5
br i1 %6, label %21, label %7
7: ; preds = %3
%8 = getelementptr inbounds double, double* %2, i64 2
%9 = load double, double* %8
%10 = fcmp ugt double %4, %9
br i1 %10, label %21, label %11
11: ; preds = %7
%12 = getelementptr inbounds double, double* %0, i64 1
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %2, i64 1
%15 = load double, double* %14
%16 = fcmp ult double %13, %15
br i1 %16, label %21, label %17
17: ; preds = %11
%18 = getelementptr inbounds double, double* %2, i64 3
%19 = load double, double* %18
%20 = fcmp ole double %13, %19
br label %21
21: ; preds = %17, %11, %7, %3
%22 = phi i1 [ false, %11 ], [ false, %7 ], [ false, %3 ], [ %20, %17 ]
%23 = load double, double* %1
%24 = fcmp ult double %23, %5
br i1 %24, label %35, label %25
25: ; preds = %21
%26 = getelementptr inbounds double, double* %2, i64 2
%27 = load double, double* %26
%28 = fcmp ugt double %23, %27
br i1 %28, label %35, label %29
29: ; preds = %25
%30 = getelementptr inbounds double, double* %1, i64 1
%31 = load double, double* %30
%32 = getelementptr inbounds double, double* %2, i64 1
%33 = load double, double* %32
%34 = fcmp ult double %31, %33
br i1 %34, label %35, label %36
35: ; preds = %21, %25, %29
br i1 %22, label %138, label %43
36: ; preds = %29
%37 = getelementptr inbounds double, double* %2, i64 3
%38 = load double, double* %37
%39 = fcmp ole double %31, %38
%40 = xor i1 %22, %39
br i1 %40, label %138, label %41
41: ; preds = %36
%42 = and i1 %22, %39
br i1 %42, label %138, label %43
43: ; preds = %35, %41
%44 = fcmp oeq double %4, %23
%45 = getelementptr inbounds double, double* %0, i64 1
%46 = load double, double* %45
br i1 %44, label %47, label %60
47: ; preds = %43
%48 = getelementptr inbounds double, double* %2, i64 1
%49 = load double, double* %48
%50 = fcmp ult double %46, %49
%51 = getelementptr inbounds double, double* %1, i64 1
%52 = load double, double* %51
%53 = fcmp oge double %52, %49
%54 = xor i1 %50, %53
%55 = select i1 %54, i1 true, i1 %6
br i1 %55, label %137, label %56
56: ; preds = %47
%57 = getelementptr inbounds double, double* %2, i64 2
%58 = load double, double* %57
%59 = fcmp ugt double %4, %58
br i1 %59, label %137, label %138
60: ; preds = %43
%61 = getelementptr inbounds double, double* %1, i64 1
%62 = load double, double* %61
%63 = fcmp oeq double %46, %62
br i1 %63, label %64, label %76
64: ; preds = %60
%65 = fcmp oge double %4, %5
%66 = fcmp oge double %23, %5
%67 = xor i1 %65, %66
br i1 %67, label %68, label %137
68: ; preds = %64
%69 = getelementptr inbounds double, double* %2, i64 1
%70 = load double, double* %69
%71 = fcmp ult double %46, %70
br i1 %71, label %137, label %72
72: ; preds = %68
%73 = getelementptr inbounds double, double* %2, i64 3
%74 = load double, double* %73
%75 = fcmp ugt double %46, %74
br i1 %75, label %137, label %138
76: ; preds = %60
%77 = fsub double %62, %46
%78 = fsub double %23, %4
%79 = fdiv double %77, %78
%80 = fcmp olt double %4, %23
%81 = select i1 %80, double %4, double %23
%82 = select i1 %80, double %23, double %4
%83 = fsub double %5, %4
%84 = tail call double @llvm.fmuladd.f64(double %83, double %79, double %46)
%85 = fcmp ult double %5, %81
%86 = fcmp ugt double %5, %82
%87 = select i1 %85, i1 true, i1 %86
%88 = getelementptr inbounds double, double* %2, i64 1
%89 = load double, double* %88
%90 = fcmp ult double %84, %89
%91 = select i1 %87, i1 true, i1 %90
br i1 %91, label %96, label %92
92: ; preds = %76
%93 = getelementptr inbounds double, double* %2, i64 3
%94 = load double, double* %93
%95 = fcmp ugt double %84, %94
br i1 %95, label %96, label %138
96: ; preds = %76, %92
%97 = getelementptr inbounds double, double* %2, i64 2
%98 = load double, double* %97
%99 = fsub double %98, %5
%100 = tail call double @llvm.fmuladd.f64(double %99, double %79, double %84)
%101 = fcmp ult double %100, %89
br i1 %101, label %110, label %102
102: ; preds = %96
%103 = getelementptr inbounds double, double* %2, i64 3
%104 = load double, double* %103
%105 = fcmp ugt double %100, %104
%106 = fcmp ult double %98, %81
%107 = select i1 %105, i1 true, i1 %106
%108 = fcmp ugt double %98, %82
%109 = select i1 %107, i1 true, i1 %108
br i1 %109, label %110, label %138
110: ; preds = %102, %96
%111 = fcmp olt double %46, %62
%112 = select i1 %111, double %46, double %62
%113 = select i1 %111, double %62, double %46
%114 = fsub double %89, %46
%115 = fdiv double %114, %79
%116 = fadd double %4, %115
%117 = fcmp ult double %116, %5
br i1 %117, label %124, label %118
118: ; preds = %110
%119 = fcmp ugt double %116, %98
%120 = fcmp ult double %89, %112
%121 = select i1 %119, i1 true, i1 %120
%122 = fcmp ugt double %89, %113
%123 = select i1 %121, i1 true, i1 %122
br i1 %123, label %124, label %138
124: ; preds = %118, %110
%125 = getelementptr inbounds double, double* %2, i64 3
%126 = load double, double* %125
%127 = fsub double %126, %89
%128 = fdiv double %127, %79
%129 = fadd double %116, %128
%130 = fcmp ult double %129, %5
br i1 %130, label %137, label %131
131: ; preds = %124
%132 = fcmp ugt double %129, %98
%133 = fcmp ult double %126, %112
%134 = select i1 %132, i1 true, i1 %133
%135 = fcmp ugt double %126, %113
%136 = select i1 %134, i1 true, i1 %135
br i1 %136, label %137, label %138
137: ; preds = %47, %131, %124, %72, %68, %64, %56
br label %138
138: ; preds = %35, %92, %102, %118, %131, %72, %56, %41, %36, %137
%139 = phi i32 [ -1, %137 ], [ 0, %36 ], [ 1, %41 ], [ 0, %56 ], [ 0, %72 ], [ 0, %131 ], [ 0, %118 ], [ 0, %102 ], [ 0, %92 ], [ 0, %35 ]
ret i32 %139
}