int box_intersect(double *dt_in, double *dt_out, double x, double y, double z,
                  double vx, double vy, double vz, double dx, double dy,
                  double dz) {
  double x_in, y_in, z_in, tt, t[6], a, b;
  int i, count, s;
  if (vx != 0) {
    tt = -(dx / 2 + x) / vx;
    y_in = y + tt * vy;
    z_in = z + tt * vz;
    if (y_in > -dy / 2 && y_in < dy / 2 && z_in > -dz / 2 && z_in < dz / 2)
      t[0] = tt;
    else
      t[0] = 0;
    tt = (dx / 2 - x) / vx;
    y_in = y + tt * vy;
    z_in = z + tt * vz;
    if (y_in > -dy / 2 && y_in < dy / 2 && z_in > -dz / 2 && z_in < dz / 2)
      t[1] = tt;
    else
      t[1] = 0;
  } else
    t[0] = t[1] = 0;
  if (vy != 0) {
    tt = -(dy / 2 + y) / vy;
    x_in = x + tt * vx;
    z_in = z + tt * vz;
    if (x_in > -dx / 2 && x_in < dx / 2 && z_in > -dz / 2 && z_in < dz / 2)
      t[2] = tt;
    else
      t[2] = 0;
    tt = (dy / 2 - y) / vy;
    x_in = x + tt * vx;
    z_in = z + tt * vz;
    if (x_in > -dx / 2 && x_in < dx / 2 && z_in > -dz / 2 && z_in < dz / 2)
      t[3] = tt;
    else
      t[3] = 0;
  } else
    t[2] = t[3] = 0;
  if (vz != 0) {
    tt = -(dz / 2 + z) / vz;
    x_in = x + tt * vx;
    y_in = y + tt * vy;
    if (x_in > -dx / 2 && x_in < dx / 2 && y_in > -dy / 2 && y_in < dy / 2)
      t[4] = tt;
    else
      t[4] = 0;
    tt = (dz / 2 - z) / vz;
    x_in = x + tt * vx;
    y_in = y + tt * vy;
    if (x_in > -dx / 2 && x_in < dx / 2 && y_in > -dy / 2 && y_in < dy / 2)
      t[5] = tt;
    else
      t[5] = 0;
  } else
    t[4] = t[5] = 0;
  a = b = s = 0;
  count = 0;
  for (i = 0; i < 6; i = i + 1)
    if (t[i] == 0)
      s = s + 1;
    else if (count == 0) {
      a = t[i];
      count = 1;
    } else {
      b = t[i];
      count = 2;
    }
  if (a == 0 && b == 0)
    return 0;
  else if (a < b) {
    *dt_in = a;
    *dt_out = b;
    return 1;
  } else {
    *dt_in = b;
    *dt_out = a;
    return 1;
  }
}


x86 assembly (clang, -O0):
<box_intersect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  0x10(%rbp),%xmm8
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  %xmm4,-0x40(%rbp)
movsd  %xmm5,-0x48(%rbp)
movsd  %xmm6,-0x50(%rbp)
movsd  %xmm7,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115b <box_intersect+0x5b>
jp     115b <box_intersect+0x5b>
jmp    13bd <box_intersect+0x2bd>
movsd  -0x50(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe0d(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    128a <box_intersect+0x18a>
movsd  -0x68(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  0xded(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <box_intersect+0x18a>
movsd  -0x70(%rbp),%xmm0
movsd  0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xdb6(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    128a <box_intersect+0x18a>
movsd  -0x70(%rbp),%xmm1
movsd  0x10(%rbp),%xmm0
movsd  0xd96(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <box_intersect+0x18a>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    1295 <box_intersect+0x195>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  0xd5e(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x20(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xcea(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    13ad <box_intersect+0x2ad>
movsd  -0x68(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  0xcca(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    13ad <box_intersect+0x2ad>
movsd  -0x70(%rbp),%xmm0
movsd  0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xc93(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    13ad <box_intersect+0x2ad>
movsd  -0x70(%rbp),%xmm1
movsd  0x10(%rbp),%xmm0
movsd  0xc73(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    13ad <box_intersect+0x2ad>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    13b8 <box_intersect+0x2b8>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    13d3 <box_intersect+0x2d3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    13f0 <box_intersect+0x2f0>
jp     13f0 <box_intersect+0x2f0>
jmp    1652 <box_intersect+0x552>
movsd  -0x58(%rbp),%xmm0
movsd  0xc03(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xb78(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    151f <box_intersect+0x41f>
movsd  -0x60(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0xb58(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    151f <box_intersect+0x41f>
movsd  -0x70(%rbp),%xmm0
movsd  0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xb21(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    151f <box_intersect+0x41f>
movsd  -0x70(%rbp),%xmm1
movsd  0x10(%rbp),%xmm0
movsd  0xb01(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    151f <box_intersect+0x41f>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    152a <box_intersect+0x42a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  0xac9(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x28(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xa55(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1642 <box_intersect+0x542>
movsd  -0x60(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0xa35(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1642 <box_intersect+0x542>
movsd  -0x70(%rbp),%xmm0
movsd  0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0x9fe(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1642 <box_intersect+0x542>
movsd  -0x70(%rbp),%xmm1
movsd  0x10(%rbp),%xmm0
movsd  0x9de(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1642 <box_intersect+0x542>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    164d <box_intersect+0x54d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1668 <box_intersect+0x568>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1685 <box_intersect+0x585>
jp     1685 <box_intersect+0x585>
jmp    18e7 <box_intersect+0x7e7>
movsd  0x10(%rbp),%xmm0
movsd  0x96e(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0x8e3(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    17b4 <box_intersect+0x6b4>
movsd  -0x60(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0x8c3(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    17b4 <box_intersect+0x6b4>
movsd  -0x68(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0x88c(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    17b4 <box_intersect+0x6b4>
movsd  -0x68(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  0x86c(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    17b4 <box_intersect+0x6b4>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    17bf <box_intersect+0x6bf>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0x10(%rbp),%xmm0
movsd  0x834(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x30(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0x7c0(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    18d7 <box_intersect+0x7d7>
movsd  -0x60(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0x7a0(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    18d7 <box_intersect+0x7d7>
movsd  -0x68(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0x769(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    18d7 <box_intersect+0x7d7>
movsd  -0x68(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  0x749(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    18d7 <box_intersect+0x7d7>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    18e2 <box_intersect+0x7e2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    18fd <box_intersect+0x7fd>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0xcc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movl   $0x0,-0xc8(%rbp)
movl   $0x0,-0xc4(%rbp)
cmpl   $0x6,-0xc4(%rbp)
jge    19e9 <box_intersect+0x8e9>
movslq -0xc4(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1975 <box_intersect+0x875>
jp     1975 <box_intersect+0x875>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    19d0 <box_intersect+0x8d0>
cmpl   $0x0,-0xc8(%rbp)
jne    19a9 <box_intersect+0x8a9>
movslq -0xc4(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0xb8(%rbp)
ff
movl   $0x1,-0xc8(%rbp)
jmp    19cb <box_intersect+0x8cb>
movslq -0xc4(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0xc0(%rbp)
ff
movl   $0x2,-0xc8(%rbp)
jmp    19d0 <box_intersect+0x8d0>
jmp    19d5 <box_intersect+0x8d5>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1931 <box_intersect+0x831>
movsd  -0xb8(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1a2b <box_intersect+0x92b>
jp     1a2b <box_intersect+0x92b>
movsd  -0xc0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1a2b <box_intersect+0x92b>
jp     1a2b <box_intersect+0x92b>
movl   $0x0,-0x4(%rbp)
jmp    1a98 <box_intersect+0x998>
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1a71 <box_intersect+0x971>
movsd  -0xb8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xc0(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1a98 <box_intersect+0x998>
movsd  -0xc0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xb8(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<box_intersect>:
movapd %xmm7,-0x38(%rsp)
movapd %xmm5,-0x18(%rsp)
movaps %xmm1,-0x28(%rsp)
movapd %xmm0,%xmm1
movapd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm11
xorpd  %xmm7,%xmm7
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm3
xorpd  %xmm10,%xmm10
jne    1139 <box_intersect+0x39>
jnp    1229 <box_intersect+0x129>
movsd  0xebe(%rip),%xmm13
movapd %xmm6,%xmm12
mulsd  %xmm13,%xmm12
movapd %xmm12,%xmm5
addsd  %xmm1,%xmm5
xorpd  0xeb3(%rip),%xmm5
movsd  0xea2(%rip),%xmm14
movapd -0x38(%rsp),%xmm2
movapd %xmm4,%xmm9
movapd %xmm2,%xmm15
mulsd  %xmm14,%xmm15
subsd  %xmm1,%xmm12
unpcklpd %xmm5,%xmm12
movapd %xmm3,%xmm4
unpcklpd %xmm3,%xmm4
divpd  %xmm4,%xmm12
movapd %xmm9,%xmm8
unpcklpd %xmm9,%xmm8
movapd -0x28(%rsp),%xmm5
unpcklpd %xmm5,%xmm5
mulpd  %xmm12,%xmm8
addpd  %xmm5,%xmm8
movapd -0x18(%rsp),%xmm10
unpcklpd %xmm10,%xmm10
movapd %xmm0,%xmm5
unpcklpd %xmm0,%xmm5
mulpd  %xmm12,%xmm10
addpd  %xmm5,%xmm10
movapd %xmm2,%xmm5
xorpd  %xmm2,%xmm2
mulsd  %xmm13,%xmm5
unpcklpd %xmm15,%xmm15
cmpltpd %xmm8,%xmm15
unpcklpd %xmm5,%xmm5
cmpltpd %xmm5,%xmm8
andpd  %xmm15,%xmm8
movapd %xmm9,%xmm4
mulsd  %xmm11,%xmm14
mulsd  %xmm11,%xmm13
unpcklpd %xmm14,%xmm14
cmpltpd %xmm10,%xmm14
unpcklpd %xmm13,%xmm13
cmpltpd %xmm13,%xmm10
andpd  %xmm14,%xmm10
andpd  %xmm8,%xmm10
andpd  %xmm12,%xmm10
ucomisd %xmm2,%xmm4
jne    1235 <box_intersect+0x135>
jnp    1318 <box_intersect+0x218>
movsd  0xdc2(%rip),%xmm12
movapd -0x38(%rsp),%xmm9
mulsd  %xmm12,%xmm9
movapd %xmm9,%xmm5
movapd -0x28(%rsp),%xmm2
addsd  %xmm2,%xmm5
xorpd  0xdaf(%rip),%xmm5
movsd  0xd9e(%rip),%xmm13
movapd %xmm6,%xmm14
mulsd  %xmm13,%xmm14
subsd  %xmm2,%xmm9
unpcklpd %xmm5,%xmm9
movapd %xmm4,%xmm2
unpcklpd %xmm4,%xmm2
divpd  %xmm2,%xmm9
movapd %xmm3,%xmm5
unpcklpd %xmm3,%xmm5
movapd %xmm1,%xmm8
unpcklpd %xmm1,%xmm8
mulpd  %xmm9,%xmm5
addpd  %xmm8,%xmm5
movapd -0x18(%rsp),%xmm7
unpcklpd %xmm7,%xmm7
movapd %xmm0,%xmm15
unpcklpd %xmm0,%xmm15
mulpd  %xmm9,%xmm7
addpd  %xmm15,%xmm7
movapd %xmm6,%xmm8
mulsd  %xmm12,%xmm8
unpcklpd %xmm14,%xmm14
cmpltpd %xmm5,%xmm14
unpcklpd %xmm8,%xmm8
cmpltpd %xmm8,%xmm5
andpd  %xmm14,%xmm5
mulsd  %xmm11,%xmm13
mulsd  %xmm11,%xmm12
unpcklpd %xmm13,%xmm13
cmpltpd %xmm7,%xmm13
unpcklpd %xmm12,%xmm12
cmpltpd %xmm12,%xmm7
andpd  %xmm13,%xmm7
andpd  %xmm5,%xmm7
andpd  %xmm9,%xmm7
movapd -0x28(%rsp),%xmm15
xorpd  %xmm9,%xmm9
movapd -0x18(%rsp),%xmm2
ucomisd %xmm9,%xmm2
jne    1337 <box_intersect+0x237>
jnp    1401 <box_intersect+0x301>
movapd %xmm1,%xmm14
movapd %xmm0,%xmm1
movsd  0xcb7(%rip),%xmm8
mulsd  %xmm8,%xmm11
movapd %xmm11,%xmm5
addsd  %xmm0,%xmm5
xorpd  0xcb1(%rip),%xmm5
movsd  0xca0(%rip),%xmm12
movapd %xmm6,%xmm13
mulsd  %xmm12,%xmm13
mulsd  %xmm8,%xmm6
movapd -0x38(%rsp),%xmm0
mulsd  %xmm0,%xmm12
mulsd  %xmm8,%xmm0
subsd  %xmm1,%xmm11
unpcklpd %xmm5,%xmm11
unpcklpd %xmm2,%xmm2
divpd  %xmm2,%xmm11
unpcklpd %xmm3,%xmm3
unpcklpd %xmm14,%xmm14
mulpd  %xmm11,%xmm3
addpd  %xmm14,%xmm3
unpcklpd %xmm4,%xmm4
movapd %xmm15,%xmm1
unpcklpd %xmm15,%xmm1
mulpd  %xmm11,%xmm4
addpd  %xmm1,%xmm4
unpcklpd %xmm13,%xmm13
cmpltpd %xmm3,%xmm13
unpcklpd %xmm6,%xmm6
cmpltpd %xmm6,%xmm3
andpd  %xmm13,%xmm3
unpcklpd %xmm12,%xmm12
cmpltpd %xmm4,%xmm12
unpcklpd %xmm0,%xmm0
cmpltpd %xmm0,%xmm4
andpd  %xmm12,%xmm4
andpd  %xmm3,%xmm4
andpd  %xmm11,%xmm4
jmp    1405 <box_intersect+0x305>
xorpd  %xmm4,%xmm4
movapd %xmm10,%xmm2
unpckhpd %xmm10,%xmm2
ucomisd %xmm9,%xmm2
movapd %xmm2,%xmm1
cmpneqsd %xmm9,%xmm1
setnp  %cl
sete   %r9b
movapd %xmm2,%xmm6
jne    1436 <box_intersect+0x336>
movapd %xmm2,%xmm6
jp     1436 <box_intersect+0x336>
movapd %xmm10,%xmm6
movq   %xmm1,%rax
jne    1443 <box_intersect+0x343>
jp     1443 <box_intersect+0x343>
xorpd  %xmm2,%xmm2
movapd %xmm10,%xmm1
jne    1450 <box_intersect+0x350>
jp     1450 <box_intersect+0x350>
xorpd  %xmm1,%xmm1
and    %cl,%r9b
movzbl %r9b,%ecx
and    $0x1,%eax
mov    $0x2,%r8d
mov    $0x2,%edx
sub    %ecx,%edx
ucomisd %xmm9,%xmm10
setnp  %r10b
sete   %cl
jne    147b <box_intersect+0x37b>
jp     147b <box_intersect+0x37b>
movapd %xmm2,%xmm6
jne    1483 <box_intersect+0x383>
jp     1483 <box_intersect+0x383>
xorpd  %xmm1,%xmm1
cmovne %edx,%eax
cmovp  %edx,%eax
and    %r10b,%cl
movapd %xmm7,%xmm5
unpckhpd %xmm7,%xmm5
and    %r9b,%cl
movzbl %cl,%edx
test   %dl,%dl
jne    14a8 <box_intersect+0x3a8>
movapd %xmm6,%xmm3
movapd %xmm5,%xmm2
jmp    14b0 <box_intersect+0x3b0>
movapd %xmm5,%xmm3
movapd %xmm1,%xmm2
mov    $0x2,%ecx
sub    %edx,%ecx
ucomisd %xmm9,%xmm5
jne    14c4 <box_intersect+0x3c4>
jp     14c4 <box_intersect+0x3c4>
movapd %xmm6,%xmm3
jne    14cc <box_intersect+0x3cc>
jp     14cc <box_intersect+0x3cc>
movapd %xmm1,%xmm2
cmovne %ecx,%eax
cmovp  %ecx,%eax
xor    %ecx,%ecx
movapd %xmm7,%xmm1
test   %eax,%eax
sete   %dl
je     14e3 <box_intersect+0x3e3>
movapd %xmm3,%xmm1
mov    %dl,%cl
movapd %xmm2,%xmm5
je     14ef <box_intersect+0x3ef>
movapd %xmm7,%xmm5
sub    %ecx,%r8d
ucomisd %xmm9,%xmm7
jne    14ff <box_intersect+0x3ff>
jp     14ff <box_intersect+0x3ff>
movapd %xmm3,%xmm1
jne    1507 <box_intersect+0x407>
jp     1507 <box_intersect+0x407>
movapd %xmm2,%xmm5
cmovne %r8d,%eax
cmovp  %r8d,%eax
movapd %xmm4,%xmm0
unpckhpd %xmm4,%xmm0
test   %eax,%eax
sete   %al
je     1528 <box_intersect+0x428>
movapd %xmm1,%xmm3
movapd %xmm0,%xmm2
jmp    1530 <box_intersect+0x430>
movapd %xmm0,%xmm3
movapd %xmm5,%xmm2
ucomisd %xmm9,%xmm0
setnp  %dl
sete   %cl
jne    1543 <box_intersect+0x443>
jp     1543 <box_intersect+0x443>
movapd %xmm1,%xmm3
jne    154b <box_intersect+0x44b>
jp     154b <box_intersect+0x44b>
movapd %xmm5,%xmm2
and    %dl,%cl
test   %al,%cl
jne    1562 <box_intersect+0x462>
movapd %xmm3,%xmm0
movapd %xmm4,%xmm1
ucomisd %xmm9,%xmm4
je     1571 <box_intersect+0x471>
jmp    1577 <box_intersect+0x477>
movapd %xmm4,%xmm0
movapd %xmm2,%xmm1
ucomisd %xmm9,%xmm4
jne    1577 <box_intersect+0x477>
jp     1577 <box_intersect+0x477>
movapd %xmm3,%xmm0
jne    157f <box_intersect+0x47f>
jp     157f <box_intersect+0x47f>
movapd %xmm2,%xmm1
ucomisd %xmm9,%xmm0
jne    1597 <box_intersect+0x497>
jp     1597 <box_intersect+0x497>
xor    %eax,%eax
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    1597 <box_intersect+0x497>
jp     1597 <box_intersect+0x497>
ret
movapd %xmm0,%xmm2
minsd  %xmm1,%xmm2
maxsd  %xmm0,%xmm1
movsd  %xmm2,(%rdi)
movsd  %xmm1,(%rsi)
mov    $0x1,%eax
ret

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

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