void ls_closest_approach(double p0[3], double p1[3], double a0[3], double b0[3],
                         double c0[3], double d0[3]) {
  double q1[3], q2[3], b[3], c[3], d[3], scr[3];
  double mat[9];
  double alpha, beta, d2;
  {
    char ab0, cd0;
    ab0 = (a0[0] == b0[0] && a0[1] == b0[1] && a0[2] == b0[2]);
    cd0 = (c0[0] == d0[0] && c0[1] == d0[1] && c0[2] == d0[2]);
    if (ab0) {
      cp_3d(p0, a0);
      if (cd0) {
        cp_3d(p1, c0);
        return;
      } else {
        p_ls_closest_approach(p1, c0, d0, a0);
        return;
      }
    }
    if (cd0) {
      cp_3d(p1, c0);
      p_ls_closest_approach(p0, a0, b0, c0);
    }
  }
  projmatrix(mat, b0, a0);
  diff_3d(scr, b0, a0);
  mat_vmult_3d(b, mat, scr);
  diff_3d(scr, c0, a0);
  mat_vmult_3d(c, mat, scr);
  diff_3d(scr, d0, a0);
  mat_vmult_3d(d, mat, scr);
  diff_3d(scr, d, c);
  d2 = norm2_2d(scr);
  if (d2 == 0)
    goto parallel;
  alpha = -inner_2d(scr, c) / d2;
  beta = ((1.0 - alpha) * c[2] + alpha * d[2]) / b[2];
  if (alpha >= 0 && alpha <= 1 && beta >= 0 && beta <= 1) {
    scale_3d(scr, c0, (1.0 - alpha));
    scale_3d(p1, d0, alpha);
    sum_3d(p1, p1, scr);
    scale_3d(scr, a0, (1.0 - beta));
    scale_3d(p0, b0, beta);
    sum_3d(p0, p0, scr);
    return;
  }
  {
    char found_one = 0;
    double d2, c2;
    p_ls_closest_approach(scr, a0, b0, c0);
    d2 = cart2_3d(c0, scr);
    cp_3d(p0, scr);
    cp_3d(p1, c0);
    p_ls_closest_approach(scr, a0, b0, d0);
    c2 = cart2_3d(d0, scr);
    if (c2 < d2) {
      d2 = c2;
      cp_3d(p0, scr);
      cp_3d(p1, d0);
    }
    p_ls_closest_approach(scr, c0, d0, a0);
    c2 = cart2_3d(a0, scr);
    if (c2 < d2) {
      d2 = c2;
      cp_3d(p1, scr);
      cp_3d(p0, a0);
    }
    p_ls_closest_approach(scr, c0, d0, b0);
    c2 = cart2_3d(b0, scr);
    if (c2 < d2) {
      d2 = c2;
      cp_3d(p1, scr);
      cp_3d(p0, b0);
    }
  }
  return;
parallel:
  if (c[2] < 0 && d[2] < 0) {
    cp_3d(p0, a0);
    cp_3d(p1, (c[2] >= d[2]) ? c0 : d0);
    return;
  }
  if (c[2] > b[2] && d[2] > b[2]) {
    cp_3d(p0, b0);
    cp_3d(p1, (c[2] <= d[2]) ? c0 : d0);
    return;
  }
  if (c[2] >= 0 && c[2] <= b[2]) {
    cp_3d(p1, c0);
    alpha = c[2] / b[2];
    scale_3d(scr, a0, (1.0 - alpha));
    scale_3d(p0, b0, alpha);
    sum_3d(p0, p0, scr);
    return;
  }
  if (d[2] >= 0 && d[2] <= b[2]) {
    cp_3d(p1, d0);
    alpha = d[2] / b[2];
    scale_3d(scr, a0, (1.0 - alpha));
    scale_3d(p0, b0, alpha);
    sum_3d(p0, p0, scr);
    return;
  }
  cp_3d(p0, a0);
  alpha = (0 - c[2]) / (d[2] - c[2]);
  scale_3d(scr, c0, (1.0 - alpha));
  scale_3d(p1, d0, alpha);
  sum_3d(p1, p1, scr);
  return;
}


x86 assembly (clang, -O0):
<ls_closest_approach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
ucomisd (%rcx),%xmm0
mov    %al,-0x171(%rbp)
jne    122d <ls_closest_approach+0x8d>
jp     122d <ls_closest_approach+0x8d>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
ucomisd 0x8(%rcx),%xmm0
mov    %al,-0x171(%rbp)
jne    122d <ls_closest_approach+0x8d>
jp     122d <ls_closest_approach+0x8d>
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x171(%rbp)
mov    -0x171(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x159(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rcx
xor    %eax,%eax
ucomisd (%rcx),%xmm0
mov    %al,-0x172(%rbp)
jne    12a8 <ls_closest_approach+0x108>
jp     12a8 <ls_closest_approach+0x108>
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rcx
xor    %eax,%eax
ucomisd 0x8(%rcx),%xmm0
mov    %al,-0x172(%rbp)
jne    12a8 <ls_closest_approach+0x108>
jp     12a8 <ls_closest_approach+0x108>
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x30(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x172(%rbp)
mov    -0x172(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x15a(%rbp)
cmpb   $0x0,-0x159(%rbp)
je     1312 <ls_closest_approach+0x172>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
cmpb   $0x0,-0x15a(%rbp)
je     12f6 <ls_closest_approach+0x156>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1070 <p_ls_closest_approach@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
cmpb   $0x0,-0x15a(%rbp)
je     1345 <ls_closest_approach+0x1a5>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1070 <p_ls_closest_approach@plt>
lea    -0x140(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1090 <projmatrix@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   10c0 <diff_3d@plt>
lea    -0x90(%rbp),%rdi
lea    -0x140(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1060 <mat_vmult_3d@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   10c0 <diff_3d@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x140(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1060 <mat_vmult_3d@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   10c0 <diff_3d@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x140(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1060 <mat_vmult_3d@plt>
lea    -0xf0(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    $0x0,%al
call   10c0 <diff_3d@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x0,%al
call   1030 <norm2_2d@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x158(%rbp)
ff
movsd  -0x158(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1447 <ls_closest_approach+0x2a7>
jp     1447 <ls_closest_approach+0x2a7>
jmp    179a <ls_closest_approach+0x5fa>
lea    -0xf0(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    $0x0,%al
call   1080 <inner_2d@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
divsd  -0x158(%rbp),%xmm0
ff
movsd  %xmm0,-0x148(%rbp)
ff
movsd  0xb82(%rip),%xmm0
subsd  -0x148(%rbp),%xmm0
ff
movsd  -0xa0(%rbp),%xmm2
ff
movsd  -0x148(%rbp),%xmm1
ff
mulsd  -0xc0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
movsd  -0x148(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     15ac <ls_closest_approach+0x40c>
movsd  0xb30(%rip),%xmm0
ucomisd -0x148(%rbp),%xmm0
ff
jb     15ac <ls_closest_approach+0x40c>
movsd  -0x150(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     15ac <ls_closest_approach+0x40c>
movsd  0xb05(%rip),%xmm0
ucomisd -0x150(%rbp),%xmm0
ff
jb     15ac <ls_closest_approach+0x40c>
lea    -0xf0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movsd  0xae4(%rip),%xmm0
subsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1050 <sum_3d@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  0xa95(%rip),%xmm0
subsd  -0x150(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsd  -0x150(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1050 <sum_3d@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
movb   $0x0,-0x15b(%rbp)
lea    -0xf0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1070 <p_ls_closest_approach@plt>
mov    -0x28(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10b0 <cart2_3d@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
mov    -0x8(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x0,%al
call   1070 <p_ls_closest_approach@plt>
mov    -0x30(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10b0 <cart2_3d@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
movsd  -0x170(%rbp),%xmm1
ff
movsd  -0x168(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    168f <ls_closest_approach+0x4ef>
movsd  -0x170(%rbp),%xmm0
ff
movsd  %xmm0,-0x168(%rbp)
ff
mov    -0x8(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1070 <p_ls_closest_approach@plt>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10b0 <cart2_3d@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
movsd  -0x170(%rbp),%xmm1
ff
movsd  -0x168(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1712 <ls_closest_approach+0x572>
movsd  -0x170(%rbp),%xmm0
ff
movsd  %xmm0,-0x168(%rbp)
ff
mov    -0x10(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1070 <p_ls_closest_approach@plt>
mov    -0x20(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10b0 <cart2_3d@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
movsd  -0x170(%rbp),%xmm1
ff
movsd  -0x168(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1795 <ls_closest_approach+0x5f5>
movsd  -0x170(%rbp),%xmm0
ff
movsd  %xmm0,-0x168(%rbp)
ff
mov    -0x10(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
xorps  %xmm0,%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jbe    1821 <ls_closest_approach+0x681>
xorps  %xmm0,%xmm0
ucomisd -0xc0(%rbp),%xmm0
ff
jbe    1821 <ls_closest_approach+0x681>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x180(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
ucomisd -0xc0(%rbp),%xmm0
ff
jb     17fc <ls_closest_approach+0x65c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x188(%rbp)
jmp    1807 <ls_closest_approach+0x667>
mov    -0x30(%rbp),%rax
mov    %rax,-0x188(%rbp)
mov    -0x180(%rbp),%rdi
mov    -0x188(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
movsd  -0xa0(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jbe    18b0 <ls_closest_approach+0x710>
movsd  -0xc0(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jbe    18b0 <ls_closest_approach+0x710>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x190(%rbp)
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jb     188b <ls_closest_approach+0x6eb>
mov    -0x28(%rbp),%rax
mov    %rax,-0x198(%rbp)
jmp    1896 <ls_closest_approach+0x6f6>
mov    -0x30(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x190(%rbp),%rdi
mov    -0x198(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
movsd  -0xa0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1954 <ls_closest_approach+0x7b4>
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1954 <ls_closest_approach+0x7b4>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
movsd  -0xa0(%rbp),%xmm0
ff
divsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x148(%rbp)
ff
lea    -0xf0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  0x6ed(%rip),%xmm0
subsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1050 <sum_3d@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
movsd  -0xc0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     19f8 <ls_closest_approach+0x858>
movsd  -0xc0(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     19f8 <ls_closest_approach+0x858>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
movsd  -0xc0(%rbp),%xmm0
ff
divsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x148(%rbp)
ff
lea    -0xf0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  0x649(%rip),%xmm0
subsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1050 <sum_3d@plt>
jmp    1a7d <ls_closest_approach+0x8dd>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   10a0 <cp_3d@plt>
xorps  %xmm0,%xmm0
subsd  -0xa0(%rbp),%xmm0
ff
movsd  -0xc0(%rbp),%xmm1
ff
subsd  -0xa0(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x148(%rbp)
ff
lea    -0xf0(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movsd  0x5bf(%rip),%xmm0
subsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movsd  -0x148(%rbp),%xmm0
ff
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
mov    $0x0,%al
call   1050 <sum_3d@plt>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_closest_approach>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %r9,%r13
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rdi,%r15
movsd  (%rdx),%xmm0
ucomisd (%rcx),%xmm0
jne    11f0 <ls_closest_approach+0x50>
jp     11f0 <ls_closest_approach+0x50>
movsd  0x8(%r12),%xmm0
ucomisd 0x8(%rbx),%xmm0
jne    11f0 <ls_closest_approach+0x50>
jp     11f0 <ls_closest_approach+0x50>
movsd  0x10(%rbx),%xmm0
cmpeqsd 0x10(%r12),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
jmp    11f2 <ls_closest_approach+0x52>
xor    %eax,%eax
movsd  (%r8),%xmm0
ucomisd 0x0(%r13),%xmm0
jne    145c <ls_closest_approach+0x2bc>
jp     145c <ls_closest_approach+0x2bc>
movsd  0x8(%r8),%xmm0
ucomisd 0x8(%r13),%xmm0
jne    145c <ls_closest_approach+0x2bc>
jp     145c <ls_closest_approach+0x2bc>
movsd  0x10(%r13),%xmm0
mov    %r8,%r14
cmpeqsd 0x10(%r8),%xmm0
movq   %xmm0,%rbp
and    $0x1,%ebp
test   %al,%al
jne    1469 <ls_closest_approach+0x2c9>
test   %bpl,%bpl
mov    %r14,%rbp
je     126f <ls_closest_approach+0xcf>
mov    %rsi,%rdi
mov    %rsi,%r14
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1070 <p_ls_closest_approach@plt>
mov    %r14,%rsi
mov    %rsi,0x10(%rsp)
mov    %r15,0x8(%rsp)
lea    0xb0(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <projmatrix@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,0x28(%rsp)
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   10c0 <diff_3d@plt>
lea    0x90(%rsp),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <mat_vmult_3d@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   10c0 <diff_3d@plt>
mov    %r12,%rbx
lea    0x50(%rsp),%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <mat_vmult_3d@plt>
mov    %r14,%rdi
mov    %r13,0x20(%rsp)
mov    %r13,%rsi
mov    %rbx,0x18(%rsp)
mov    %rbx,%rdx
xor    %eax,%eax
call   10c0 <diff_3d@plt>
lea    0x70(%rsp),%r13
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <mat_vmult_3d@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   10c0 <diff_3d@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <norm2_2d@plt>
test   %eax,%eax
je     149c <ls_closest_approach+0x2fc>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
lea    0x30(%rsp),%rdi
lea    0x50(%rsp),%rsi
xor    %eax,%eax
call   1080 <inner_2d@plt>
neg    %eax
cvtsi2sd %eax,%xmm4
divsd  (%rsp),%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jb     1506 <ls_closest_approach+0x366>
movsd  0xc89(%rip),%xmm2
ucomisd %xmm4,%xmm2
jb     1506 <ls_closest_approach+0x366>
movapd %xmm2,%xmm0
subsd  %xmm4,%xmm0
movsd  0x80(%rsp),%xmm1
mulsd  %xmm4,%xmm1
movsd  0x60(%rsp),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
divsd  0xa0(%rsp),%xmm3
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
jb     1506 <ls_closest_approach+0x366>
ucomisd %xmm3,%xmm2
jb     1506 <ls_closest_approach+0x366>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
movsd  %xmm3,(%rsp)
movsd  %xmm4,0x88(%rsp)
call   1040 <scale_3d@plt>
mov    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    0x20(%rsp),%rsi
movsd  0x88(%rsp),%xmm0
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <sum_3d@plt>
movsd  0xbe6(%rip),%xmm0
subsd  (%rsp),%xmm0
mov    %r14,%rdi
mov    0x18(%rsp),%rsi
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    0x28(%rsp),%rsi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    %rbp,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <sum_3d@plt>
jmp    16b8 <ls_closest_approach+0x518>
mov    %r8,%r14
xor    %ebp,%ebp
test   %al,%al
je     1241 <ls_closest_approach+0xa1>
mov    %rsi,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
test   %bpl,%bpl
je     14e8 <ls_closest_approach+0x348>
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <cp_3d@plt>
movsd  0x60(%rsp),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
movsd  0x80(%rsp),%xmm0
jbe    166e <ls_closest_approach+0x4ce>
ucomisd %xmm0,%xmm2
jbe    166e <ls_closest_approach+0x4ce>
mov    0x8(%rsp),%rdi
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
movsd  0x60(%rsp),%xmm0
ucomisd 0x80(%rsp),%xmm0
jmp    16a3 <ls_closest_approach+0x503>
mov    %r13,%rdx
mov    %r12,%rcx
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <p_ls_closest_approach@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    0x18(%rsp),%rbx
mov    %rbx,%rsi
mov    0x28(%rsp),%r13
mov    %r13,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1070 <p_ls_closest_approach@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <cart2_3d@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
mov    0x8(%rsp),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
mov    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %rbp,%r15
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    0x20(%rsp),%rbp
mov    %rbp,%rcx
xor    %eax,%eax
call   1070 <p_ls_closest_approach@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <cart2_3d@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
jbe    15bf <ls_closest_approach+0x41f>
lea    0x30(%rsp),%rsi
mov    0x8(%rsp),%rdi
xor    %eax,%eax
movsd  %xmm1,(%rsp)
call   10a0 <cp_3d@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    0x18(%rsp),%rbx
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <p_ls_closest_approach@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <cart2_3d@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
jbe    161e <ls_closest_approach+0x47e>
lea    0x30(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
movsd  %xmm1,(%rsp)
call   10a0 <cp_3d@plt>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1070 <p_ls_closest_approach@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10b0 <cart2_3d@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    16b8 <ls_closest_approach+0x518>
lea    0x30(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
mov    0x8(%rsp),%rdi
mov    %r13,%rsi
jmp    16b1 <ls_closest_approach+0x511>
movsd  0xa0(%rsp),%xmm2
ucomisd %xmm2,%xmm1
jbe    16ca <ls_closest_approach+0x52a>
ucomisd %xmm2,%xmm0
jbe    16ca <ls_closest_approach+0x52a>
mov    0x8(%rsp),%rdi
mov    0x28(%rsp),%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
movsd  0x80(%rsp),%xmm0
ucomisd 0x60(%rsp),%xmm0
mov    0x20(%rsp),%rsi
cmovae %rbp,%rsi
mov    0x10(%rsp),%rdi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbp,%r12
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm1
mov    0x8(%rsp),%rbx
mov    0x10(%rsp),%rbp
mov    0x28(%rsp),%r14
mov    0x20(%rsp),%r15
jb     1706 <ls_closest_approach+0x566>
ucomisd %xmm1,%xmm2
jb     1706 <ls_closest_approach+0x566>
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
movsd  0x60(%rsp),%xmm1
jmp    1728 <ls_closest_approach+0x588>
ucomisd %xmm3,%xmm0
jb     1778 <ls_closest_approach+0x5d8>
ucomisd %xmm0,%xmm2
jb     1778 <ls_closest_approach+0x5d8>
mov    %rbp,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
movsd  0x80(%rsp),%xmm1
divsd  0xa0(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8c1(%rip),%xmm0
subsd  %xmm1,%xmm0
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
jmp    1450 <ls_closest_approach+0x2b0>
mov    %rbx,%rdi
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   10a0 <cp_3d@plt>
movsd  0x60(%rsp),%xmm0
xorpd  %xmm2,%xmm2
subsd  %xmm0,%xmm2
movsd  0x80(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0x84c(%rip),%xmm0
subsd  %xmm2,%xmm0
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <scale_3d@plt>
mov    %rbp,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
jmp    1450 <ls_closest_approach+0x2b0>

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

LLVM IR (-O2):
define void @ls_closest_approach(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = alloca [3 x double]
%10 = alloca [3 x double]
%11 = alloca [9 x double]
%12 = bitcast [3 x double]* %7 to i8*
%13 = bitcast [3 x double]* %8 to i8*
%14 = bitcast [3 x double]* %9 to i8*
%15 = bitcast [3 x double]* %10 to i8*
%16 = bitcast [9 x double]* %11 to i8*
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fcmp oeq double %17, %18
br i1 %19, label %20, label %32
20: ; preds = %6
%21 = getelementptr inbounds double, double* %2, i64 1
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %3, i64 1
%24 = load double, double* %23
%25 = fcmp oeq double %22, %24
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = getelementptr inbounds double, double* %2, i64 2
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %3, i64 2
%30 = load double, double* %29
%31 = fcmp oeq double %28, %30
br label %32
32: ; preds = %26, %20, %6
%33 = phi i1 [ false, %20 ], [ false, %6 ], [ %31, %26 ]
%34 = load double, double* %4
%35 = load double, double* %5
%36 = fcmp oeq double %34, %35
br i1 %36, label %37, label %50
37: ; preds = %32
%38 = getelementptr inbounds double, double* %4, i64 1
%39 = load double, double* %38
%40 = getelementptr inbounds double, double* %5, i64 1
%41 = load double, double* %40
%42 = fcmp oeq double %39, %41
br i1 %42, label %43, label %50
43: ; preds = %37
%44 = getelementptr inbounds double, double* %4, i64 2
%45 = load double, double* %44
%46 = getelementptr inbounds double, double* %5, i64 2
%47 = load double, double* %46
%48 = fcmp oeq double %45, %47
%49 = zext i1 %48 to i8
br label %50
50: ; preds = %43, %37, %32
%51 = phi i8 [ 0, %37 ], [ 0, %32 ], [ %49, %43 ]
br i1 %33, label %52, label %59
52: ; preds = %50
%53 = tail call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %2)
%54 = icmp eq i8 %51, 0
br i1 %54, label %57, label %55
55: ; preds = %52
%56 = tail call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %4)
br label %207
57: ; preds = %52
%58 = tail call i32 (double*, double*, double*, double*, ...) bitcast (i32 (...)* @p_ls_closest_approach to i32 (double*, double*, double*, double*, ...)*)(double* %1, double* %4, double* %5, double* %2)
br label %207
59: ; preds = %50
%60 = icmp eq i8 %51, 0
br i1 %60, label %64, label %61
61: ; preds = %59
%62 = tail call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %4)
%63 = tail call i32 (double*, double*, double*, double*, ...) bitcast (i32 (...)* @p_ls_closest_approach to i32 (double*, double*, double*, double*, ...)*)(double* %0, double* %2, double* %3, double* %4)
br label %64
64: ; preds = %61, %59
%65 = getelementptr inbounds [9 x double], [9 x double]* %11, i64 0, i64 0
%66 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @projmatrix to i32 (double*, double*, double*, ...)*)(double* %65, double* %3, double* %2)
%67 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%68 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @diff_3d to i32 (double*, double*, double*, ...)*)(double* %67, double* %3, double* %2)
%69 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%70 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @mat_vmult_3d to i32 (double*, double*, double*, ...)*)(double* %69, double* %65, double* %67)
%71 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @diff_3d to i32 (double*, double*, double*, ...)*)(double* %67, double* %4, double* %2)
%72 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%73 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @mat_vmult_3d to i32 (double*, double*, double*, ...)*)(double* %72, double* %65, double* %67)
%74 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @diff_3d to i32 (double*, double*, double*, ...)*)(double* %67, double* %5, double* %2)
%75 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%76 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @mat_vmult_3d to i32 (double*, double*, double*, ...)*)(double* %75, double* %65, double* %67)
%77 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @diff_3d to i32 (double*, double*, double*, ...)*)(double* %67, double* %75, double* %72)
%78 = call i32 (double*, ...) bitcast (i32 (...)* @norm2_2d to i32 (double*, ...)*)(double* %67)
%79 = icmp eq i32 %78, 0
br i1 %79, label %142, label %80
80: ; preds = %64
%81 = sitofp i32 %78 to double
%82 = call i32 (double*, double*, ...) bitcast (i32 (...)* @inner_2d to i32 (double*, double*, ...)*)(double* %67, double* %72)
%83 = sub nsw i32 0, %82
%84 = sitofp i32 %83 to double
%85 = fdiv double %84, %81
%86 = fsub double 1.000000e+00, %85
%87 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 2
%88 = load double, double* %87
%89 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%90 = load double, double* %89
%91 = fmul double %85, %90
%92 = call double @llvm.fmuladd.f64(double %86, double %88, double %91)
%93 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
%94 = load double, double* %93
%95 = fdiv double %92, %94
%96 = fcmp oge double %85, 0.000000e+00
%97 = fcmp ole double %85, 1.000000e+00
%98 = and i1 %96, %97
%99 = fcmp oge double %95, 0.000000e+00
%100 = select i1 %98, i1 %99, i1 false
%101 = fcmp ole double %95, 1.000000e+00
%102 = select i1 %100, i1 %101, i1 false
br i1 %102, label %103, label %111
103: ; preds = %80
%104 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %67, double* %4, double %86)
%105 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %1, double* %5, double %85)
%106 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @sum_3d to i32 (double*, double*, double*, ...)*)(double* %1, double* %1, double* %67)
%107 = fsub double 1.000000e+00, %95
%108 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %67, double* %2, double %107)
%109 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %0, double* %3, double %95)
%110 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @sum_3d to i32 (double*, double*, double*, ...)*)(double* %0, double* %0, double* %67)
br label %207
111: ; preds = %80
%112 = call i32 (double*, double*, double*, double*, ...) bitcast (i32 (...)* @p_ls_closest_approach to i32 (double*, double*, double*, double*, ...)*)(double* %67, double* %2, double* %3, double* %4)
%113 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cart2_3d to i32 (double*, double*, ...)*)(double* %4, double* %67)
%114 = sitofp i32 %113 to double
%115 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %67)
%116 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %4)
%117 = call i32 (double*, double*, double*, double*, ...) bitcast (i32 (...)* @p_ls_closest_approach to i32 (double*, double*, double*, double*, ...)*)(double* %67, double* %2, double* %3, double* %5)
%118 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cart2_3d to i32 (double*, double*, ...)*)(double* %5, double* %67)
%119 = sitofp i32 %118 to double
%120 = fcmp olt double %119, %114
br i1 %120, label %121, label %124
121: ; preds = %111
%122 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %67)
%123 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %5)
br label %124
124: ; preds = %121, %111
%125 = phi double [ %119, %121 ], [ %114, %111 ]
%126 = call i32 (double*, double*, double*, double*, ...) bitcast (i32 (...)* @p_ls_closest_approach to i32 (double*, double*, double*, double*, ...)*)(double* %67, double* %4, double* %5, double* %2)
%127 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cart2_3d to i32 (double*, double*, ...)*)(double* %2, double* %67)
%128 = sitofp i32 %127 to double
%129 = fcmp ogt double %125, %128
br i1 %129, label %130, label %133
130: ; preds = %124
%131 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %67)
%132 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %2)
br label %133
133: ; preds = %130, %124
%134 = phi double [ %128, %130 ], [ %125, %124 ]
%135 = call i32 (double*, double*, double*, double*, ...) bitcast (i32 (...)* @p_ls_closest_approach to i32 (double*, double*, double*, double*, ...)*)(double* %67, double* %4, double* %5, double* %3)
%136 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cart2_3d to i32 (double*, double*, ...)*)(double* %3, double* %67)
%137 = sitofp i32 %136 to double
%138 = fcmp ogt double %134, %137
br i1 %138, label %139, label %207
139: ; preds = %133
%140 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %67)
%141 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %3)
br label %207
142: ; preds = %64
%143 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 2
%144 = load double, double* %143
%145 = fcmp olt double %144, 0.000000e+00
%146 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%147 = load double, double* %146
%148 = fcmp olt double %147, 0.000000e+00
%149 = select i1 %145, i1 %148, i1 false
br i1 %149, label %150, label %157
150: ; preds = %142
%151 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %2)
%152 = load double, double* %143
%153 = load double, double* %146
%154 = fcmp oge double %152, %153
%155 = select i1 %154, double* %4, double* %5
%156 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %155)
br label %207
157: ; preds = %142
%158 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
%159 = load double, double* %158
%160 = fcmp ogt double %144, %159
%161 = fcmp ogt double %147, %159
%162 = select i1 %160, i1 %161, i1 false
br i1 %162, label %163, label %170
163: ; preds = %157
%164 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %3)
%165 = load double, double* %143
%166 = load double, double* %146
%167 = fcmp ole double %165, %166
%168 = select i1 %167, double* %4, double* %5
%169 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %168)
br label %207
170: ; preds = %157
%171 = fcmp ult double %144, 0.000000e+00
%172 = fcmp ugt double %144, %159
%173 = select i1 %171, i1 true, i1 %172
br i1 %173, label %183, label %174
174: ; preds = %170
%175 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %4)
%176 = load double, double* %143
%177 = load double, double* %158
%178 = fdiv double %176, %177
%179 = fsub double 1.000000e+00, %178
%180 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %67, double* %2, double %179)
%181 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %0, double* %3, double %178)
%182 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @sum_3d to i32 (double*, double*, double*, ...)*)(double* %0, double* %0, double* %67)
br label %207
183: ; preds = %170
%184 = fcmp ult double %147, 0.000000e+00
%185 = fcmp ugt double %147, %159
%186 = select i1 %184, i1 true, i1 %185
br i1 %186, label %196, label %187
187: ; preds = %183
%188 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %1, double* %5)
%189 = load double, double* %146
%190 = load double, double* %158
%191 = fdiv double %189, %190
%192 = fsub double 1.000000e+00, %191
%193 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %67, double* %2, double %192)
%194 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %0, double* %3, double %191)
%195 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @sum_3d to i32 (double*, double*, double*, ...)*)(double* %0, double* %0, double* %67)
br label %207
196: ; preds = %183
%197 = call i32 (double*, double*, ...) bitcast (i32 (...)* @cp_3d to i32 (double*, double*, ...)*)(double* %0, double* %2)
%198 = load double, double* %143
%199 = fsub double 0.000000e+00, %198
%200 = load double, double* %146
%201 = fsub double %200, %198
%202 = fdiv double %199, %201
%203 = fsub double 1.000000e+00, %202
%204 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %67, double* %4, double %203)
%205 = call i32 (double*, double*, double, ...) bitcast (i32 (...)* @scale_3d to i32 (double*, double*, double, ...)*)(double* %1, double* %5, double %202)
%206 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @sum_3d to i32 (double*, double*, double*, ...)*)(double* %1, double* %1, double* %67)
br label %207
207: ; preds = %133, %139, %55, %57, %196, %187, %174, %163, %150, %103
ret void
}