double TkLineToPoint(end1Ptr, end2Ptr, pointPtr)
double end1Ptr[2];
double end2Ptr[2];
double pointPtr[2];
{
  double x, y;
  if (end1Ptr[0] == end2Ptr[0]) {
    x = end1Ptr[0];
    if (end1Ptr[1] >= end2Ptr[1]) {
      y = (((end1Ptr[1]) < (pointPtr[1])) ? (end1Ptr[1]) : (pointPtr[1]));
      y = (((y) > (end2Ptr[1])) ? (y) : (end2Ptr[1]));
    } else {
      y = (((end2Ptr[1]) < (pointPtr[1])) ? (end2Ptr[1]) : (pointPtr[1]));
      y = (((y) > (end1Ptr[1])) ? (y) : (end1Ptr[1]));
    }
  } else if (end1Ptr[1] == end2Ptr[1]) {
    y = end1Ptr[1];
    if (end1Ptr[0] >= end2Ptr[0]) {
      x = (((end1Ptr[0]) < (pointPtr[0])) ? (end1Ptr[0]) : (pointPtr[0]));
      x = (((x) > (end2Ptr[0])) ? (x) : (end2Ptr[0]));
    } else {
      x = (((end2Ptr[0]) < (pointPtr[0])) ? (end2Ptr[0]) : (pointPtr[0]));
      x = (((x) > (end1Ptr[0])) ? (x) : (end1Ptr[0]));
    }
  } else {
    double m1, b1, m2, b2;
    m1 = (end2Ptr[1] - end1Ptr[1]) / (end2Ptr[0] - end1Ptr[0]);
    b1 = end1Ptr[1] - m1 * end1Ptr[0];
    m2 = -1.0 / m1;
    b2 = pointPtr[1] - m2 * pointPtr[0];
    x = (b2 - b1) / (m1 - m2);
    y = m1 * x + b1;
    if (end1Ptr[0] > end2Ptr[0]) {
      if (x > end1Ptr[0]) {
        x = end1Ptr[0];
        y = end1Ptr[1];
      } else if (x < end2Ptr[0]) {
        x = end2Ptr[0];
        y = end2Ptr[1];
      }
    } else {
      if (x > end2Ptr[0]) {
        x = end2Ptr[0];
        y = end2Ptr[1];
      } else if (x < end1Ptr[0]) {
        x = end1Ptr[0];
        y = end1Ptr[1];
      }
    }
  }
  return hypot(pointPtr[0] - x, pointPtr[1] - y);
}


x86 assembly (clang, -O0):
<TkLineToPoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jne    1276 <TkLineToPoint+0x166>
jp     1276 <TkLineToPoint+0x166>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jb     11ef <TkLineToPoint+0xdf>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1197 <TkLineToPoint+0x87>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11a5 <TkLineToPoint+0x95>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    11d2 <TkLineToPoint+0xc2>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    11e0 <TkLineToPoint+0xd0>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1271 <TkLineToPoint+0x161>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    121e <TkLineToPoint+0x10e>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    122c <TkLineToPoint+0x11c>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    1259 <TkLineToPoint+0x149>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1267 <TkLineToPoint+0x157>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    15ab <TkLineToPoint+0x49b>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jne    13c3 <TkLineToPoint+0x2b3>
jp     13c3 <TkLineToPoint+0x2b3>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jb     1339 <TkLineToPoint+0x229>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    12e4 <TkLineToPoint+0x1d4>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    12f1 <TkLineToPoint+0x1e1>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    131d <TkLineToPoint+0x20d>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    132a <TkLineToPoint+0x21a>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    13be <TkLineToPoint+0x2ae>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1365 <TkLineToPoint+0x255>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1372 <TkLineToPoint+0x262>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    13a1 <TkLineToPoint+0x291>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    13b1 <TkLineToPoint+0x2a1>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x20(%rbp)
jmp    15a6 <TkLineToPoint+0x496>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%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,-0x38(%rbp)
movsd  0xbd0(%rip),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%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,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1532 <TkLineToPoint+0x422>
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    14f6 <TkLineToPoint+0x3e6>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    152d <TkLineToPoint+0x41d>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1528 <TkLineToPoint+0x418>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    152d <TkLineToPoint+0x41d>
jmp    15a1 <TkLineToPoint+0x491>
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1565 <TkLineToPoint+0x455>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    159c <TkLineToPoint+0x48c>
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1597 <TkLineToPoint+0x487>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    159c <TkLineToPoint+0x48c>
jmp    15a1 <TkLineToPoint+0x491>
jmp    15a6 <TkLineToPoint+0x496>
jmp    15ab <TkLineToPoint+0x49b>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
subsd  -0x28(%rbp),%xmm1
call   1030 <hypot@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TkLineToPoint>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movsd  (%rsi),%xmm2
movsd  0x8(%rsi),%xmm3
ucomisd %xmm2,%xmm0
jne    1146 <TkLineToPoint+0x36>
jp     1146 <TkLineToPoint+0x36>
ucomisd %xmm3,%xmm1
movsd  0x8(%rdx),%xmm2
jae    1171 <TkLineToPoint+0x61>
minsd  %xmm2,%xmm3
maxsd  %xmm1,%xmm3
movapd %xmm3,%xmm5
jmp    120f <TkLineToPoint+0xff>
ucomisd %xmm3,%xmm1
jne    117e <TkLineToPoint+0x6e>
jp     117e <TkLineToPoint+0x6e>
ucomisd %xmm2,%xmm0
movsd  (%rdx),%xmm3
jae    1203 <TkLineToPoint+0xf3>
minsd  %xmm3,%xmm2
maxsd  %xmm0,%xmm2
movapd %xmm1,%xmm5
movapd %xmm2,%xmm7
jmp    1213 <TkLineToPoint+0x103>
minsd  %xmm2,%xmm1
maxsd  %xmm3,%xmm1
jmp    120b <TkLineToPoint+0xfb>
movapd %xmm3,%xmm4
subsd  %xmm1,%xmm4
movapd %xmm2,%xmm5
subsd  %xmm0,%xmm5
divsd  %xmm5,%xmm4
movapd %xmm4,%xmm5
mulsd  %xmm0,%xmm5
movapd %xmm1,%xmm8
subsd  %xmm5,%xmm8
movsd  0xe54(%rip),%xmm5
divsd  %xmm4,%xmm5
movapd %xmm4,%xmm7
subsd  %xmm5,%xmm7
mulsd  (%rdx),%xmm5
movsd  0x8(%rdx),%xmm6
subsd  %xmm5,%xmm6
subsd  %xmm8,%xmm6
divsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm4
addsd  %xmm8,%xmm4
ucomisd %xmm2,%xmm0
jbe    1229 <TkLineToPoint+0x119>
ucomisd %xmm0,%xmm6
movapd %xmm1,%xmm5
movapd %xmm0,%xmm7
ja     1213 <TkLineToPoint+0x103>
ucomisd %xmm6,%xmm2
movapd %xmm4,%xmm5
movapd %xmm6,%xmm7
jbe    1213 <TkLineToPoint+0x103>
movapd %xmm3,%xmm5
movapd %xmm2,%xmm7
jmp    1213 <TkLineToPoint+0x103>
minsd  %xmm3,%xmm0
maxsd  %xmm2,%xmm0
movapd %xmm1,%xmm5
movapd %xmm0,%xmm7
movsd  (%rdx),%xmm0
subsd  %xmm7,%xmm0
movsd  0x8(%rdx),%xmm1
subsd  %xmm5,%xmm1
jmp    1030 <hypot@plt>
ucomisd %xmm2,%xmm6
movapd %xmm3,%xmm5
movapd %xmm2,%xmm7
ja     1213 <TkLineToPoint+0x103>
ucomisd %xmm6,%xmm0
movapd %xmm4,%xmm5
movapd %xmm6,%xmm7
ja     120b <TkLineToPoint+0xfb>
jmp    1213 <TkLineToPoint+0x103>

LLVM IR (-O0):
define double @TkLineToPoint(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = fcmp oeq double %15, %18
br i1 %19, label %20, label %94
20: ; preds = %3
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
store double %23, double* %7
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = fcmp oge double %26, %29
br i1 %30, label %31, label %62
31: ; preds = %20
%32 = load double*, double** %4
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
%35 = load double*, double** %6
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = load double, double* %36
%38 = fcmp olt double %34, %37
br i1 %38, label %39, label %43
39: ; preds = %31
%40 = load double*, double** %4
%41 = getelementptr inbounds double, double* %40, i64 1
%42 = load double, double* %41
br label %47
43: ; preds = %31
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 1
%46 = load double, double* %45
br label %47
47: ; preds = %43, %39
%48 = phi double [ %42, %39 ], [ %46, %43 ]
store double %48, double* %8
%49 = load double, double* %8
%50 = load double*, double** %5
%51 = getelementptr inbounds double, double* %50, i64 1
%52 = load double, double* %51
%53 = fcmp ogt double %49, %52
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = load double, double* %8
br label %60
56: ; preds = %47
%57 = load double*, double** %5
%58 = getelementptr inbounds double, double* %57, i64 1
%59 = load double, double* %58
br label %60
60: ; preds = %56, %54
%61 = phi double [ %55, %54 ], [ %59, %56 ]
store double %61, double* %8
br label %93
62: ; preds = %20
%63 = load double*, double** %5
%64 = getelementptr inbounds double, double* %63, i64 1
%65 = load double, double* %64
%66 = load double*, double** %6
%67 = getelementptr inbounds double, double* %66, i64 1
%68 = load double, double* %67
%69 = fcmp olt double %65, %68
br i1 %69, label %70, label %74
70: ; preds = %62
%71 = load double*, double** %5
%72 = getelementptr inbounds double, double* %71, i64 1
%73 = load double, double* %72
br label %78
74: ; preds = %62
%75 = load double*, double** %6
%76 = getelementptr inbounds double, double* %75, i64 1
%77 = load double, double* %76
br label %78
78: ; preds = %74, %70
%79 = phi double [ %73, %70 ], [ %77, %74 ]
store double %79, double* %8
%80 = load double, double* %8
%81 = load double*, double** %4
%82 = getelementptr inbounds double, double* %81, i64 1
%83 = load double, double* %82
%84 = fcmp ogt double %80, %83
br i1 %84, label %85, label %87
85: ; preds = %78
%86 = load double, double* %8
br label %91
87: ; preds = %78
%88 = load double*, double** %4
%89 = getelementptr inbounds double, double* %88, i64 1
%90 = load double, double* %89
br label %91
91: ; preds = %87, %85
%92 = phi double [ %86, %85 ], [ %90, %87 ]
store double %92, double* %8
br label %93
93: ; preds = %91, %60
br label %288
94: ; preds = %3
%95 = load double*, double** %4
%96 = getelementptr inbounds double, double* %95, i64 1
%97 = load double, double* %96
%98 = load double*, double** %5
%99 = getelementptr inbounds double, double* %98, i64 1
%100 = load double, double* %99
%101 = fcmp oeq double %97, %100
br i1 %101, label %102, label %176
102: ; preds = %94
%103 = load double*, double** %4
%104 = getelementptr inbounds double, double* %103, i64 1
%105 = load double, double* %104
store double %105, double* %8
%106 = load double*, double** %4
%107 = getelementptr inbounds double, double* %106, i64 0
%108 = load double, double* %107
%109 = load double*, double** %5
%110 = getelementptr inbounds double, double* %109, i64 0
%111 = load double, double* %110
%112 = fcmp oge double %108, %111
br i1 %112, label %113, label %144
113: ; preds = %102
%114 = load double*, double** %4
%115 = getelementptr inbounds double, double* %114, i64 0
%116 = load double, double* %115
%117 = load double*, double** %6
%118 = getelementptr inbounds double, double* %117, i64 0
%119 = load double, double* %118
%120 = fcmp olt double %116, %119
br i1 %120, label %121, label %125
121: ; preds = %113
%122 = load double*, double** %4
%123 = getelementptr inbounds double, double* %122, i64 0
%124 = load double, double* %123
br label %129
125: ; preds = %113
%126 = load double*, double** %6
%127 = getelementptr inbounds double, double* %126, i64 0
%128 = load double, double* %127
br label %129
129: ; preds = %125, %121
%130 = phi double [ %124, %121 ], [ %128, %125 ]
store double %130, double* %7
%131 = load double, double* %7
%132 = load double*, double** %5
%133 = getelementptr inbounds double, double* %132, i64 0
%134 = load double, double* %133
%135 = fcmp ogt double %131, %134
br i1 %135, label %136, label %138
136: ; preds = %129
%137 = load double, double* %7
br label %142
138: ; preds = %129
%139 = load double*, double** %5
%140 = getelementptr inbounds double, double* %139, i64 0
%141 = load double, double* %140
br label %142
142: ; preds = %138, %136
%143 = phi double [ %137, %136 ], [ %141, %138 ]
store double %143, double* %7
br label %175
144: ; preds = %102
%145 = load double*, double** %5
%146 = getelementptr inbounds double, double* %145, i64 0
%147 = load double, double* %146
%148 = load double*, double** %6
%149 = getelementptr inbounds double, double* %148, i64 0
%150 = load double, double* %149
%151 = fcmp olt double %147, %150
br i1 %151, label %152, label %156
152: ; preds = %144
%153 = load double*, double** %5
%154 = getelementptr inbounds double, double* %153, i64 0
%155 = load double, double* %154
br label %160
156: ; preds = %144
%157 = load double*, double** %6
%158 = getelementptr inbounds double, double* %157, i64 0
%159 = load double, double* %158
br label %160
160: ; preds = %156, %152
%161 = phi double [ %155, %152 ], [ %159, %156 ]
store double %161, double* %7
%162 = load double, double* %7
%163 = load double*, double** %4
%164 = getelementptr inbounds double, double* %163, i64 0
%165 = load double, double* %164
%166 = fcmp ogt double %162, %165
br i1 %166, label %167, label %169
167: ; preds = %160
%168 = load double, double* %7
br label %173
169: ; preds = %160
%170 = load double*, double** %4
%171 = getelementptr inbounds double, double* %170, i64 0
%172 = load double, double* %171
br label %173
173: ; preds = %169, %167
%174 = phi double [ %168, %167 ], [ %172, %169 ]
store double %174, double* %7
br label %175
175: ; preds = %173, %142
br label %287
176: ; preds = %94
%177 = load double*, double** %5
%178 = getelementptr inbounds double, double* %177, i64 1
%179 = load double, double* %178
%180 = load double*, double** %4
%181 = getelementptr inbounds double, double* %180, i64 1
%182 = load double, double* %181
%183 = fsub double %179, %182
%184 = load double*, double** %5
%185 = getelementptr inbounds double, double* %184, i64 0
%186 = load double, double* %185
%187 = load double*, double** %4
%188 = getelementptr inbounds double, double* %187, i64 0
%189 = load double, double* %188
%190 = fsub double %186, %189
%191 = fdiv double %183, %190
store double %191, double* %9
%192 = load double*, double** %4
%193 = getelementptr inbounds double, double* %192, i64 1
%194 = load double, double* %193
%195 = load double, double* %9
%196 = load double*, double** %4
%197 = getelementptr inbounds double, double* %196, i64 0
%198 = load double, double* %197
%199 = fneg double %195
%200 = call double @llvm.fmuladd.f64(double %199, double %198, double %194)
store double %200, double* %10
%201 = load double, double* %9
%202 = fdiv double -1.000000e+00, %201
store double %202, double* %11
%203 = load double*, double** %6
%204 = getelementptr inbounds double, double* %203, i64 1
%205 = load double, double* %204
%206 = load double, double* %11
%207 = load double*, double** %6
%208 = getelementptr inbounds double, double* %207, i64 0
%209 = load double, double* %208
%210 = fneg double %206
%211 = call double @llvm.fmuladd.f64(double %210, double %209, double %205)
store double %211, double* %12
%212 = load double, double* %12
%213 = load double, double* %10
%214 = fsub double %212, %213
%215 = load double, double* %9
%216 = load double, double* %11
%217 = fsub double %215, %216
%218 = fdiv double %214, %217
store double %218, double* %7
%219 = load double, double* %9
%220 = load double, double* %7
%221 = load double, double* %10
%222 = call double @llvm.fmuladd.f64(double %219, double %220, double %221)
store double %222, double* %8
%223 = load double*, double** %4
%224 = getelementptr inbounds double, double* %223, i64 0
%225 = load double, double* %224
%226 = load double*, double** %5
%227 = getelementptr inbounds double, double* %226, i64 0
%228 = load double, double* %227
%229 = fcmp ogt double %225, %228
br i1 %229, label %230, label %258
230: ; preds = %176
%231 = load double, double* %7
%232 = load double*, double** %4
%233 = getelementptr inbounds double, double* %232, i64 0
%234 = load double, double* %233
%235 = fcmp ogt double %231, %234
br i1 %235, label %236, label %243
236: ; preds = %230
%237 = load double*, double** %4
%238 = getelementptr inbounds double, double* %237, i64 0
%239 = load double, double* %238
store double %239, double* %7
%240 = load double*, double** %4
%241 = getelementptr inbounds double, double* %240, i64 1
%242 = load double, double* %241
store double %242, double* %8
br label %257
243: ; preds = %230
%244 = load double, double* %7
%245 = load double*, double** %5
%246 = getelementptr inbounds double, double* %245, i64 0
%247 = load double, double* %246
%248 = fcmp olt double %244, %247
br i1 %248, label %249, label %256
249: ; preds = %243
%250 = load double*, double** %5
%251 = getelementptr inbounds double, double* %250, i64 0
%252 = load double, double* %251
store double %252, double* %7
%253 = load double*, double** %5
%254 = getelementptr inbounds double, double* %253, i64 1
%255 = load double, double* %254
store double %255, double* %8
br label %256
256: ; preds = %249, %243
br label %257
257: ; preds = %256, %236
br label %286
258: ; preds = %176
%259 = load double, double* %7
%260 = load double*, double** %5
%261 = getelementptr inbounds double, double* %260, i64 0
%262 = load double, double* %261
%263 = fcmp ogt double %259, %262
br i1 %263, label %264, label %271
264: ; preds = %258
%265 = load double*, double** %5
%266 = getelementptr inbounds double, double* %265, i64 0
%267 = load double, double* %266
store double %267, double* %7
%268 = load double*, double** %5
%269 = getelementptr inbounds double, double* %268, i64 1
%270 = load double, double* %269
store double %270, double* %8
br label %285
271: ; preds = %258
%272 = load double, double* %7
%273 = load double*, double** %4
%274 = getelementptr inbounds double, double* %273, i64 0
%275 = load double, double* %274
%276 = fcmp olt double %272, %275
br i1 %276, label %277, label %284
277: ; preds = %271
%278 = load double*, double** %4
%279 = getelementptr inbounds double, double* %278, i64 0
%280 = load double, double* %279
store double %280, double* %7
%281 = load double*, double** %4
%282 = getelementptr inbounds double, double* %281, i64 1
%283 = load double, double* %282
store double %283, double* %8
br label %284
284: ; preds = %277, %271
br label %285
285: ; preds = %284, %264
br label %286
286: ; preds = %285, %257
br label %287
287: ; preds = %286, %175
br label %288
288: ; preds = %287, %93
%289 = load double*, double** %6
%290 = getelementptr inbounds double, double* %289, i64 0
%291 = load double, double* %290
%292 = load double, double* %7
%293 = fsub double %291, %292
%294 = load double*, double** %6
%295 = getelementptr inbounds double, double* %294, i64 1
%296 = load double, double* %295
%297 = load double, double* %8
%298 = fsub double %296, %297
%299 = call double @hypot(double %293, double %298)
ret double %299
}

LLVM IR (-O2):
define double @TkLineToPoint(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fcmp oeq double %4, %5
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
br i1 %6, label %11, label %25
11: ; preds = %3
%12 = fcmp ult double %8, %10
%13 = getelementptr inbounds double, double* %2, i64 1
%14 = load double, double* %13
br i1 %12, label %20, label %15
15: ; preds = %11
%16 = fcmp olt double %8, %14
%17 = select i1 %16, double %8, double %14
%18 = fcmp ogt double %17, %10
%19 = select i1 %18, double %17, double %10
br label %67
20: ; preds = %11
%21 = fcmp olt double %10, %14
%22 = select i1 %21, double %10, double %14
%23 = fcmp ogt double %22, %8
%24 = select i1 %23, double %22, double %8
br label %67
25: ; preds = %3
%26 = fcmp oeq double %8, %10
br i1 %26, label %27, label %40
27: ; preds = %25
%28 = fcmp ult double %4, %5
%29 = load double, double* %2
br i1 %28, label %35, label %30
30: ; preds = %27
%31 = fcmp olt double %4, %29
%32 = select i1 %31, double %4, double %29
%33 = fcmp ogt double %32, %5
%34 = select i1 %33, double %32, double %5
br label %67
35: ; preds = %27
%36 = fcmp olt double %5, %29
%37 = select i1 %36, double %5, double %29
%38 = fcmp ogt double %37, %4
%39 = select i1 %38, double %37, double %4
br label %67
40: ; preds = %25
%41 = fsub double %10, %8
%42 = fsub double %5, %4
%43 = fdiv double %41, %42
%44 = fneg double %43
%45 = tail call double @llvm.fmuladd.f64(double %44, double %4, double %8)
%46 = fdiv double -1.000000e+00, %43
%47 = getelementptr inbounds double, double* %2, i64 1
%48 = load double, double* %47
%49 = load double, double* %2
%50 = fneg double %46
%51 = tail call double @llvm.fmuladd.f64(double %50, double %49, double %48)
%52 = fsub double %51, %45
%53 = fsub double %43, %46
%54 = fdiv double %52, %53
%55 = tail call double @llvm.fmuladd.f64(double %43, double %54, double %45)
%56 = fcmp ogt double %4, %5
br i1 %56, label %57, label %62
57: ; preds = %40
%58 = fcmp ogt double %54, %4
br i1 %58, label %67, label %59
59: ; preds = %57
%60 = fcmp olt double %54, %5
br i1 %60, label %61, label %67
61: ; preds = %59
br label %67
62: ; preds = %40
%63 = fcmp ogt double %54, %5
br i1 %63, label %67, label %64
64: ; preds = %62
%65 = fcmp olt double %54, %4
br i1 %65, label %66, label %67
66: ; preds = %64
br label %67
67: ; preds = %59, %61, %64, %66, %57, %62, %35, %30, %15, %20
%68 = phi double [ %19, %15 ], [ %24, %20 ], [ %8, %30 ], [ %8, %35 ], [ %10, %61 ], [ %55, %59 ], [ %8, %66 ], [ %55, %64 ], [ %8, %57 ], [ %10, %62 ]
%69 = phi double [ %4, %15 ], [ %4, %20 ], [ %34, %30 ], [ %39, %35 ], [ %5, %61 ], [ %54, %59 ], [ %4, %66 ], [ %54, %64 ], [ %4, %57 ], [ %5, %62 ]
%70 = load double, double* %2
%71 = fsub double %70, %69
%72 = getelementptr inbounds double, double* %2, i64 1
%73 = load double, double* %72
%74 = fsub double %73, %68
%75 = tail call double @hypot(double %71, double %74)
ret double %75
}