double TkPolygonToPoint(polyPtr, numPoints, pointPtr)
double *polyPtr;
int numPoints;
double *pointPtr;
{
  double bestDist;
  int intersections;
  int count;
  register double *pPtr;
  bestDist = 1.0e40;
  intersections = 0;
  for (count = numPoints, pPtr = polyPtr; count > 1; count--, pPtr += 2) {
    double x, y, dist;
    if (pPtr[2] == pPtr[0]) {
      x = pPtr[0];
      if (pPtr[1] >= pPtr[3]) {
        y = (((pPtr[1]) < (pointPtr[1])) ? (pPtr[1]) : (pointPtr[1]));
        y = (((y) > (pPtr[3])) ? (y) : (pPtr[3]));
      } else {
        y = (((pPtr[3]) < (pointPtr[1])) ? (pPtr[3]) : (pointPtr[1]));
        y = (((y) > (pPtr[1])) ? (y) : (pPtr[1]));
      }
    } else if (pPtr[3] == pPtr[1]) {
      y = pPtr[1];
      if (pPtr[0] >= pPtr[2]) {
        x = (((pPtr[0]) < (pointPtr[0])) ? (pPtr[0]) : (pointPtr[0]));
        x = (((x) > (pPtr[2])) ? (x) : (pPtr[2]));
        if ((pointPtr[1] < y) && (pointPtr[0] < pPtr[0]) &&
            (pointPtr[0] >= pPtr[2])) {
          intersections++;
        }
      } else {
        x = (((pPtr[2]) < (pointPtr[0])) ? (pPtr[2]) : (pointPtr[0]));
        x = (((x) > (pPtr[0])) ? (x) : (pPtr[0]));
        if ((pointPtr[1] < y) && (pointPtr[0] < pPtr[2]) &&
            (pointPtr[0] >= pPtr[0])) {
          intersections++;
        }
      }
    } else {
      double m1, b1, m2, b2;
      int lower;
      m1 = (pPtr[3] - pPtr[1]) / (pPtr[2] - pPtr[0]);
      b1 = pPtr[1] - m1 * pPtr[0];
      m2 = -1.0 / m1;
      b2 = pointPtr[1] - m2 * pointPtr[0];
      x = (b2 - b1) / (m1 - m2);
      y = m1 * x + b1;
      if (pPtr[0] > pPtr[2]) {
        if (x > pPtr[0]) {
          x = pPtr[0];
          y = pPtr[1];
        } else if (x < pPtr[2]) {
          x = pPtr[2];
          y = pPtr[3];
        }
      } else {
        if (x > pPtr[2]) {
          x = pPtr[2];
          y = pPtr[3];
        } else if (x < pPtr[0]) {
          x = pPtr[0];
          y = pPtr[1];
        }
      }
      lower = (m1 * pointPtr[0] + b1) > pointPtr[1];
      if (lower &&
          (pointPtr[0] >= (((pPtr[0]) < (pPtr[2])) ? (pPtr[0]) : (pPtr[2]))) &&
          (pointPtr[0] < (((pPtr[0]) > (pPtr[2])) ? (pPtr[0]) : (pPtr[2])))) {
        intersections++;
      }
    }
    dist = hypot(pointPtr[0] - x, pointPtr[1] - y);
    if (dist < bestDist) {
      bestDist = dist;
    }
  }
  if (intersections & 0x1) {
    return 0.0;
  }
  return bestDist;
}


x86 assembly (clang, -O0):
<TkPolygonToPoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpl   $0x1,-0x30(%rbp)
jle    1836 <TkPolygonToPoint+0x726>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd (%rax),%xmm0
jne    12bd <TkPolygonToPoint+0x1ad>
jp     12bd <TkPolygonToPoint+0x1ad>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x18(%rax),%xmm0
jb     1224 <TkPolygonToPoint+0x114>
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c3 <TkPolygonToPoint+0xb3>
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    11d1 <TkPolygonToPoint+0xc1>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x18(%rax),%xmm0
jbe    1201 <TkPolygonToPoint+0xf1>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1212 <TkPolygonToPoint+0x102>
mov    -0x38(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
jmp    12b8 <TkPolygonToPoint+0x1a8>
mov    -0x38(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1256 <TkPolygonToPoint+0x146>
mov    -0x38(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1267 <TkPolygonToPoint+0x157>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    129a <TkPolygonToPoint+0x18a>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    12ab <TkPolygonToPoint+0x19b>
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
jmp    17d4 <TkPolygonToPoint+0x6c4>
mov    -0x38(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jne    14d3 <TkPolygonToPoint+0x3c3>
jp     14d3 <TkPolygonToPoint+0x3c3>
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jb     13e7 <TkPolygonToPoint+0x2d7>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    132f <TkPolygonToPoint+0x21f>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    133f <TkPolygonToPoint+0x22f>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    1372 <TkPolygonToPoint+0x262>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    1383 <TkPolygonToPoint+0x273>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13e2 <TkPolygonToPoint+0x2d2>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    13e2 <TkPolygonToPoint+0x2d2>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jb     13e2 <TkPolygonToPoint+0x2d2>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14ce <TkPolygonToPoint+0x3be>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1418 <TkPolygonToPoint+0x308>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    1428 <TkPolygonToPoint+0x318>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x38(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    145a <TkPolygonToPoint+0x34a>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    146a <TkPolygonToPoint+0x35a>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14c9 <TkPolygonToPoint+0x3b9>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    14c9 <TkPolygonToPoint+0x3b9>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd (%rax),%xmm0
jb     14c9 <TkPolygonToPoint+0x3b9>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14ce <TkPolygonToPoint+0x3be>
jmp    17cf <TkPolygonToPoint+0x6bf>
mov    -0x38(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x38(%rbp),%rax
subsd  0x8(%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x38(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x58(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xac7(%rip),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x68(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    1646 <TkPolygonToPoint+0x536>
movsd  -0x40(%rbp),%xmm0
mov    -0x38(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1608 <TkPolygonToPoint+0x4f8>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1641 <TkPolygonToPoint+0x531>
movsd  -0x40(%rbp),%xmm1
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    163c <TkPolygonToPoint+0x52c>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1641 <TkPolygonToPoint+0x531>
jmp    16b7 <TkPolygonToPoint+0x5a7>
movsd  -0x40(%rbp),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    167b <TkPolygonToPoint+0x56b>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    16b2 <TkPolygonToPoint+0x5a2>
movsd  -0x40(%rbp),%xmm1
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    16ad <TkPolygonToPoint+0x59d>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    16b2 <TkPolygonToPoint+0x5a2>
jmp    16b7 <TkPolygonToPoint+0x5a7>
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x74(%rbp)
cmpl   $0x0,-0x74(%rbp)
je     17ca <TkPolygonToPoint+0x6ba>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    172f <TkPolygonToPoint+0x61f>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    1740 <TkPolygonToPoint+0x630>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0xc8(%rbp),%xmm1
ff
ucomisd %xmm1,%xmm0
jb     17ca <TkPolygonToPoint+0x6ba>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    1796 <TkPolygonToPoint+0x686>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
jmp    17a7 <TkPolygonToPoint+0x697>
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm1
ff
movsd  -0xd8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    17ca <TkPolygonToPoint+0x6ba>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    17cf <TkPolygonToPoint+0x6bf>
jmp    17d4 <TkPolygonToPoint+0x6c4>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
subsd  -0x48(%rbp),%xmm1
call   1030 <hypot@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1817 <TkPolygonToPoint+0x707>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    181c <TkPolygonToPoint+0x70c>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x38(%rbp)
jmp    1148 <TkPolygonToPoint+0x38>
mov    -0x2c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1852 <TkPolygonToPoint+0x742>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    185c <TkPolygonToPoint+0x74c>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TkPolygonToPoint>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%esi
jl     1346 <TkPolygonToPoint+0x236>
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
add    $0x18,%rbx
xor    %r15d,%r15d
movsd  0xec6(%rip),%xmm1
jmp    1173 <TkPolygonToPoint+0x63>
nopl   0x0(%rax)
minsd  %xmm1,%xmm0
maxsd  %xmm3,%xmm0
subsd  %xmm0,%xmm1
movsd  (%r14),%xmm0
subsd  %xmm2,%xmm0
call   1030 <hypot@plt>
minsd  (%rsp),%xmm0
add    $0xffffffff,%ebp
add    $0x10,%rbx
movapd %xmm0,%xmm1
cmp    $0x2,%ebp
jle    1351 <TkPolygonToPoint+0x241>
movsd  -0x18(%rbx),%xmm2
movsd  -0x8(%rbx),%xmm3
ucomisd %xmm2,%xmm3
movsd  %xmm1,(%rsp)
jne    11b0 <TkPolygonToPoint+0xa0>
jp     11b0 <TkPolygonToPoint+0xa0>
movsd  -0x10(%rbx),%xmm0
movsd  (%rbx),%xmm3
ucomisd %xmm3,%xmm0
movsd  0x8(%r14),%xmm1
jae    1140 <TkPolygonToPoint+0x30>
minsd  %xmm1,%xmm3
maxsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
jmp    1148 <TkPolygonToPoint+0x38>
nopl   (%rax)
movsd  -0x10(%rbx),%xmm0
movsd  (%rbx),%xmm12
ucomisd %xmm0,%xmm12
jne    120c <TkPolygonToPoint+0xfc>
jp     120c <TkPolygonToPoint+0xfc>
ucomisd %xmm3,%xmm2
movsd  (%r14),%xmm4
jae    12a7 <TkPolygonToPoint+0x197>
movapd %xmm3,%xmm5
minsd  %xmm4,%xmm5
movsd  0x8(%r14),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
ucomisd %xmm4,%xmm3
seta   %cl
maxsd  %xmm2,%xmm5
and    %al,%cl
ucomisd %xmm2,%xmm4
setae  %al
and    %cl,%al
movzbl %al,%eax
add    %eax,%r15d
movapd %xmm5,%xmm2
jmp    1148 <TkPolygonToPoint+0x38>
movapd %xmm12,%xmm4
subsd  %xmm0,%xmm4
movapd %xmm3,%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm0,%xmm11
subsd  %xmm1,%xmm11
movsd  0xdcd(%rip),%xmm6
divsd  %xmm4,%xmm6
movsd  (%r14),%xmm10
movsd  0x8(%r14),%xmm1
movapd %xmm4,%xmm7
subsd  %xmm6,%xmm7
mulsd  %xmm10,%xmm6
movapd %xmm1,%xmm5
subsd  %xmm6,%xmm5
subsd  %xmm11,%xmm5
divsd  %xmm7,%xmm5
movapd %xmm4,%xmm6
mulsd  %xmm5,%xmm6
addsd  %xmm11,%xmm6
ucomisd %xmm3,%xmm2
jbe    12d9 <TkPolygonToPoint+0x1c9>
ucomisd %xmm2,%xmm5
movapd %xmm0,%xmm8
movapd %xmm2,%xmm9
ja     1303 <TkPolygonToPoint+0x1f3>
ucomisd %xmm5,%xmm3
movapd %xmm6,%xmm8
movapd %xmm5,%xmm9
jbe    1303 <TkPolygonToPoint+0x1f3>
movapd %xmm12,%xmm8
movapd %xmm3,%xmm9
jmp    1303 <TkPolygonToPoint+0x1f3>
movsd  0x8(%r14),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
ucomisd %xmm4,%xmm2
minsd  %xmm4,%xmm2
seta   %cl
maxsd  %xmm3,%xmm2
and    %al,%cl
ucomisd %xmm3,%xmm4
setae  %al
and    %cl,%al
movzbl %al,%eax
add    %eax,%r15d
jmp    1148 <TkPolygonToPoint+0x38>
ucomisd %xmm3,%xmm5
movapd %xmm12,%xmm8
movapd %xmm3,%xmm9
ja     1303 <TkPolygonToPoint+0x1f3>
ucomisd %xmm5,%xmm2
movapd %xmm6,%xmm8
movapd %xmm5,%xmm9
jbe    1303 <TkPolygonToPoint+0x1f3>
movapd %xmm0,%xmm8
movapd %xmm2,%xmm9
mulsd  %xmm10,%xmm4
addsd  %xmm11,%xmm4
ucomisd %xmm1,%xmm4
jbe    1337 <TkPolygonToPoint+0x227>
movapd %xmm2,%xmm0
minsd  %xmm3,%xmm0
ucomisd %xmm0,%xmm10
setae  %al
maxsd  %xmm3,%xmm2
ucomisd %xmm10,%xmm2
seta   %cl
and    %al,%cl
movzbl %cl,%eax
add    %eax,%r15d
movapd %xmm8,%xmm0
movapd %xmm9,%xmm2
jmp    1148 <TkPolygonToPoint+0x38>
movsd  0xcb2(%rip),%xmm0
xor    %r15d,%r15d
test   $0x1,%r15b
je     135b <TkPolygonToPoint+0x24b>
xorpd  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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