#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double sqrt(double);
int cylinder_intersect(double *l0, double *l1, double x, double y, double z,
                       double kx, double ky, double kz, double r, double h) {
  double A, B, C, D, k2, k;
  double dl1p = 0, dl0p = 0, dl1c = 0, dl0c = 0, y0, y1;
  int ret = 1, stat = 0, plane_stat = 0;
  enum {
    HIT_CYL = 01,
    ENTER_TOP = 02,
    ENTER_BOT = 04,
    EXIT_TOP = 010,
    EXIT_BOT = 020,
    ENTER_MASK = 06,
    EXIT_MASK = 030
  };
  k2 = (kx * kx + ky * ky + kz * kz);
  k = sqrt(k2);
  if (!k2)
    return 0;
  A = (k2 - ky * ky);
  B = 2 * (x * kx + z * kz);
  C = (x * x + z * z - r * r);
  D = B * B - 4 * A * C;
  if (D >= 0) {
    if (kx || kz) {
      stat |= HIT_CYL;
      D = sqrt(D);
      dl0c = k * (-B - D) / (2 * A);
      dl1c = k * (-B + D) / (2 * A);
      y0 = dl0c * ky / k + y;
      y1 = dl1c * ky / k + y;
      if ((y0 < -h / 2 && y1 < -h / 2) || (y0 > h / 2 && y1 > h / 2)) {
        return 0;
      }
    }
    if (ky) {
      dl0p = k * (-h / 2 - y) / ky;
      dl1p = k * (h / 2 - y) / ky;
      if (dl0p < dl1p) {
        plane_stat |= (ENTER_BOT | EXIT_TOP);
      } else {
        double tmp = dl1p;
        dl1p = dl0p;
        dl0p = tmp;
        plane_stat |= (ENTER_TOP | EXIT_BOT);
      }
    }
  }
  if (stat & HIT_CYL) {
    if (ky && dl0p > dl0c) {
      *l0 = dl0p;
      stat |= plane_stat & ENTER_MASK;
    } else
      *l0 = dl0c;
    if (ky && dl1p < dl1c) {
      *l1 = dl1p;
      stat |= plane_stat & EXIT_MASK;
    } else
      *l1 = dl1c;
  }
  return stat;
}


x86 assembly (clang, -O0):
<cylinder_intersect>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movl   $0x1,-0xbc(%rbp)
movl   $0x0,-0xc0(%rbp)
movl   $0x0,-0xc4(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11fe <cylinder_intersect+0xee>
jp     11fe <cylinder_intersect+0xee>
movl   $0x0,-0x4(%rbp)
jmp    16ef <cylinder_intersect+0x5df>
movsd  -0x80(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdb3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  0xd46(%rip),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     15f1 <cylinder_intersect+0x4e1>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    132f <cylinder_intersect+0x21f>
jp     132f <cylinder_intersect+0x21f>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    132f <cylinder_intersect+0x21f>
jp     132f <cylinder_intersect+0x21f>
jmp    14e8 <cylinder_intersect+0x3d8>
mov    -0xc0(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc0(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
subsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc86(%rip),%xmm1
mulsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc40(%rip),%xmm1
mulsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  -0x40(%rbp),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  -0x40(%rbp),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xbbf(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1491 <cylinder_intersect+0x381>
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xb85(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
ja     14d7 <cylinder_intersect+0x3c7>
movsd  -0xb0(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
movsd  0xb62(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    14e3 <cylinder_intersect+0x3d3>
movsd  -0xb8(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
movsd  0xb3f(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    14e3 <cylinder_intersect+0x3d3>
movl   $0x0,-0x4(%rbp)
jmp    16ef <cylinder_intersect+0x5df>
jmp    14e8 <cylinder_intersect+0x3d8>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1505 <cylinder_intersect+0x3f5>
jp     1505 <cylinder_intersect+0x3f5>
jmp    15ec <cylinder_intersect+0x4dc>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xad7(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
movsd  0xaa8(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    15a8 <cylinder_intersect+0x498>
mov    -0xc4(%rbp),%eax
or     $0xc,%eax
mov    %eax,-0xc4(%rbp)
jmp    15e7 <cylinder_intersect+0x4d7>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0xc4(%rbp),%eax
or     $0x12,%eax
mov    %eax,-0xc4(%rbp)
jmp    15ec <cylinder_intersect+0x4dc>
jmp    15f1 <cylinder_intersect+0x4e1>
mov    -0xc0(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     16e6 <cylinder_intersect+0x5d6>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1620 <cylinder_intersect+0x510>
jp     1620 <cylinder_intersect+0x510>
jmp    1660 <cylinder_intersect+0x550>
movsd  -0x98(%rbp),%xmm0
ff
ucomisd -0xa8(%rbp),%xmm0
ff
jbe    1660 <cylinder_intersect+0x550>
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc4(%rbp),%eax
and    $0x6,%eax
or     -0xc0(%rbp),%eax
mov    %eax,-0xc0(%rbp)
jmp    1670 <cylinder_intersect+0x560>
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    168d <cylinder_intersect+0x57d>
jp     168d <cylinder_intersect+0x57d>
jmp    16d1 <cylinder_intersect+0x5c1>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    16d1 <cylinder_intersect+0x5c1>
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc4(%rbp),%eax
and    $0x18,%eax
or     -0xc0(%rbp),%eax
mov    %eax,-0xc0(%rbp)
jmp    16e1 <cylinder_intersect+0x5d1>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    16e6 <cylinder_intersect+0x5d6>
mov    -0xc0(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cylinder_intersect>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
movapd %xmm0,%xmm8
mov    %rsi,%r14
mov    %rdi,%r15
movapd %xmm4,%xmm10
mulsd  %xmm4,%xmm10
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm10,%xmm0
movapd %xmm5,%xmm11
mulsd  %xmm5,%xmm11
addsd  %xmm0,%xmm11
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm11
jb     1163 <cylinder_intersect+0x53>
sqrtsd %xmm11,%xmm9
jmp    11f6 <cylinder_intersect+0xe6>
movapd %xmm11,%xmm0
movapd %xmm4,0x50(%rsp)
movaps %xmm7,0x40(%rsp)
movaps %xmm1,0x30(%rsp)
movapd %xmm11,0x20(%rsp)
movsd  %xmm5,0x10(%rsp)
movsd  %xmm3,(%rsp)
movsd  %xmm6,0x78(%rsp)
movsd  %xmm8,0x70(%rsp)
movsd  %xmm2,0x68(%rsp)
movapd %xmm10,0x80(%rsp)
call   1030 <sqrt@plt>
movapd 0x80(%rsp),%xmm10
movsd  0x68(%rsp),%xmm2
movsd  0x70(%rsp),%xmm8
movsd  0x78(%rsp),%xmm6
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm5
movapd 0x20(%rsp),%xmm11
movapd 0x30(%rsp),%xmm1
movapd 0x40(%rsp),%xmm7
movapd 0x50(%rsp),%xmm4
movapd %xmm0,%xmm9
xorpd  %xmm0,%xmm0
xor    %eax,%eax
ucomisd %xmm0,%xmm11
jne    1205 <cylinder_intersect+0xf5>
jnp    149b <cylinder_intersect+0x38b>
subsd  %xmm10,%xmm11
movapd %xmm2,%xmm0
mulsd  %xmm5,%xmm0
movapd %xmm8,%xmm10
mulsd  %xmm3,%xmm10
addsd  %xmm0,%xmm10
addsd  %xmm10,%xmm10
mulsd  %xmm2,%xmm2
mulsd  %xmm8,%xmm8
addsd  %xmm2,%xmm8
mulsd  %xmm6,%xmm6
subsd  %xmm6,%xmm8
movsd  0xdbb(%rip),%xmm0
mulsd  %xmm11,%xmm0
mulsd  %xmm8,%xmm0
movapd %xmm10,%xmm6
mulsd  %xmm10,%xmm6
addsd  %xmm0,%xmm6
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm6
jb     149b <cylinder_intersect+0x38b>
ucomisd %xmm0,%xmm3
setp   %al
setne  %cl
or     %al,%cl
ucomisd %xmm0,%xmm5
setp   %al
setne  %bl
or     %al,%bl
or     %cl,%bl
xorpd  %xmm8,%xmm8
xor    %ebp,%ebp
mov    $0x0,%ecx
xorpd  %xmm0,%xmm0
cmp    $0x1,%bl
jne    13ac <cylinder_intersect+0x29c>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm6
jb     12b1 <cylinder_intersect+0x1a1>
xorps  %xmm0,%xmm0
sqrtsd %xmm6,%xmm0
jmp    130b <cylinder_intersect+0x1fb>
movapd %xmm6,%xmm0
movapd %xmm4,0x50(%rsp)
movapd %xmm7,0x40(%rsp)
movapd %xmm9,0x10(%rsp)
movapd %xmm1,0x30(%rsp)
movapd %xmm11,0x20(%rsp)
movapd %xmm10,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm10
movapd 0x20(%rsp),%xmm11
xorpd  %xmm8,%xmm8
movapd 0x30(%rsp),%xmm1
movapd 0x10(%rsp),%xmm9
movapd 0x40(%rsp),%xmm7
movapd 0x50(%rsp),%xmm4
movapd 0xd0d(%rip),%xmm3
xorpd  %xmm10,%xmm3
addsd  %xmm11,%xmm11
unpcklpd %xmm0,%xmm10
unpcklpd %xmm3,%xmm0
subpd  %xmm10,%xmm0
movapd %xmm9,%xmm3
unpcklpd %xmm9,%xmm3
mulpd  %xmm3,%xmm0
unpcklpd %xmm11,%xmm11
divpd  %xmm11,%xmm0
movapd %xmm4,%xmm2
unpcklpd %xmm4,%xmm2
mulpd  %xmm0,%xmm2
divpd  %xmm3,%xmm2
movapd %xmm1,%xmm6
unpcklpd %xmm1,%xmm6
addpd  %xmm2,%xmm6
movsd  0xca1(%rip),%xmm2
mulsd  %xmm7,%xmm2
movapd %xmm6,%xmm3
unpckhpd %xmm6,%xmm3
xor    %eax,%eax
ucomisd %xmm3,%xmm2
jbe    1385 <cylinder_intersect+0x275>
ucomisd %xmm6,%xmm2
ja     149b <cylinder_intersect+0x38b>
movsd  0xc83(%rip),%xmm2
mulsd  %xmm7,%xmm2
unpcklpd %xmm2,%xmm2
cmpltpd %xmm6,%xmm2
movmskpd %xmm2,%edx
mov    $0x1,%ecx
cmp    $0x3,%dl
je     149b <cylinder_intersect+0x38b>
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm4
jne    13b8 <cylinder_intersect+0x2a8>
jnp    1437 <cylinder_intersect+0x327>
unpcklpd %xmm7,%xmm7
mulpd  0xc6c(%rip),%xmm7
unpcklpd %xmm1,%xmm1
subpd  %xmm1,%xmm7
unpcklpd %xmm9,%xmm9
mulpd  %xmm7,%xmm9
movapd %xmm4,%xmm1
unpcklpd %xmm4,%xmm1
divpd  %xmm1,%xmm9
movapd %xmm9,%xmm1
unpckhpd %xmm9,%xmm1
xor    %eax,%eax
ucomisd %xmm9,%xmm1
seta   %al
movd   %eax,%xmm1
pshufd $0x44,%xmm1,%xmm1
psllq  $0x3f,%xmm1
psrad  $0x1f,%xmm1
pshufd $0xf5,%xmm1,%xmm8
movapd %xmm9,%xmm1
shufpd $0x1,%xmm9,%xmm1
andpd  %xmm8,%xmm9
andnpd %xmm1,%xmm8
orpd   %xmm9,%xmm8
mov    $0xc,%eax
mov    $0x12,%ebp
cmova  %eax,%ebp
test   %bl,%bl
je     1464 <cylinder_intersect+0x354>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm4
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
jne    144f <cylinder_intersect+0x33f>
jnp    1468 <cylinder_intersect+0x358>
ucomisd %xmm1,%xmm8
jbe    1468 <cylinder_intersect+0x358>
movsd  %xmm8,(%r15)
mov    %ebp,%eax
and    $0x6,%eax
or     %ecx,%eax
jmp    1472 <cylinder_intersect+0x362>
mov    %ecx,%eax
jmp    149b <cylinder_intersect+0x38b>
movsd  %xmm1,(%r15)
mov    $0x1,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm4
jne    147e <cylinder_intersect+0x36e>
jnp    1496 <cylinder_intersect+0x386>
unpckhpd %xmm8,%xmm8
ucomisd %xmm8,%xmm0
jbe    1496 <cylinder_intersect+0x386>
movsd  %xmm8,(%r14)
and    $0xfffffff8,%ebp
or     %ebp,%eax
jmp    149b <cylinder_intersect+0x38b>
movsd  %xmm0,(%r14)
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cylinder_intersect(double* %0, double* %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = alloca i32
%12 = alloca double*
%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 double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca double
store double* %0, double** %12
store double* %1, double** %13
store double %2, double* %14
store double %3, double* %15
store double %4, double* %16
store double %5, double* %17
store double %6, double* %18
store double %7, double* %19
store double %8, double* %20
store double %9, double* %21
store double 0.000000e+00, double* %28
store double 0.000000e+00, double* %29
store double 0.000000e+00, double* %30
store double 0.000000e+00, double* %31
store i32 1, i32* %34
store i32 0, i32* %35
store i32 0, i32* %36
%38 = load double, double* %17
%39 = load double, double* %17
%40 = load double, double* %18
%41 = load double, double* %18
%42 = fmul double %40, %41
%43 = call double @llvm.fmuladd.f64(double %38, double %39, double %42)
%44 = load double, double* %19
%45 = load double, double* %19
%46 = call double @llvm.fmuladd.f64(double %44, double %45, double %43)
store double %46, double* %26
%47 = load double, double* %26
%48 = call double @sqrt(double %47)
store double %48, double* %27
%49 = load double, double* %26
%50 = fcmp une double %49, 0.000000e+00
br i1 %50, label %52, label %51
51: ; preds = %10
store i32 0, i32* %11
br label %227
52: ; preds = %10
%53 = load double, double* %26
%54 = load double, double* %18
%55 = load double, double* %18
%56 = fneg double %54
%57 = call double @llvm.fmuladd.f64(double %56, double %55, double %53)
store double %57, double* %22
%58 = load double, double* %14
%59 = load double, double* %17
%60 = load double, double* %16
%61 = load double, double* %19
%62 = fmul double %60, %61
%63 = call double @llvm.fmuladd.f64(double %58, double %59, double %62)
%64 = fmul double 2.000000e+00, %63
store double %64, double* %23
%65 = load double, double* %14
%66 = load double, double* %14
%67 = load double, double* %16
%68 = load double, double* %16
%69 = fmul double %67, %68
%70 = call double @llvm.fmuladd.f64(double %65, double %66, double %69)
%71 = load double, double* %20
%72 = load double, double* %20
%73 = fneg double %71
%74 = call double @llvm.fmuladd.f64(double %73, double %72, double %70)
store double %74, double* %24
%75 = load double, double* %23
%76 = load double, double* %23
%77 = load double, double* %22
%78 = fmul double 4.000000e+00, %77
%79 = load double, double* %24
%80 = fmul double %78, %79
%81 = fneg double %80
%82 = call double @llvm.fmuladd.f64(double %75, double %76, double %81)
store double %82, double* %25
%83 = load double, double* %25
%84 = fcmp oge double %83, 0.000000e+00
br i1 %84, label %85, label %186
85: ; preds = %52
%86 = load double, double* %17
%87 = fcmp une double %86, 0.000000e+00
br i1 %87, label %91, label %88
88: ; preds = %85
%89 = load double, double* %19
%90 = fcmp une double %89, 0.000000e+00
br i1 %90, label %91, label %151
91: ; preds = %88, %85
%92 = load i32, i32* %35
%93 = or i32 %92, 1
store i32 %93, i32* %35
%94 = load double, double* %25
%95 = call double @sqrt(double %94)
store double %95, double* %25
%96 = load double, double* %27
%97 = load double, double* %23
%98 = fneg double %97
%99 = load double, double* %25
%100 = fsub double %98, %99
%101 = fmul double %96, %100
%102 = load double, double* %22
%103 = fmul double 2.000000e+00, %102
%104 = fdiv double %101, %103
store double %104, double* %31
%105 = load double, double* %27
%106 = load double, double* %23
%107 = fneg double %106
%108 = load double, double* %25
%109 = fadd double %107, %108
%110 = fmul double %105, %109
%111 = load double, double* %22
%112 = fmul double 2.000000e+00, %111
%113 = fdiv double %110, %112
store double %113, double* %30
%114 = load double, double* %31
%115 = load double, double* %18
%116 = fmul double %114, %115
%117 = load double, double* %27
%118 = fdiv double %116, %117
%119 = load double, double* %15
%120 = fadd double %118, %119
store double %120, double* %32
%121 = load double, double* %30
%122 = load double, double* %18
%123 = fmul double %121, %122
%124 = load double, double* %27
%125 = fdiv double %123, %124
%126 = load double, double* %15
%127 = fadd double %125, %126
store double %127, double* %33
%128 = load double, double* %32
%129 = load double, double* %21
%130 = fneg double %129
%131 = fdiv double %130, 2.000000e+00
%132 = fcmp olt double %128, %131
br i1 %132, label %133, label %139
133: ; preds = %91
%134 = load double, double* %33
%135 = load double, double* %21
%136 = fneg double %135
%137 = fdiv double %136, 2.000000e+00
%138 = fcmp olt double %134, %137
br i1 %138, label %149, label %139
139: ; preds = %133, %91
%140 = load double, double* %32
%141 = load double, double* %21
%142 = fdiv double %141, 2.000000e+00
%143 = fcmp ogt double %140, %142
br i1 %143, label %144, label %150
144: ; preds = %139
%145 = load double, double* %33
%146 = load double, double* %21
%147 = fdiv double %146, 2.000000e+00
%148 = fcmp ogt double %145, %147
br i1 %148, label %149, label %150
149: ; preds = %144, %133
store i32 0, i32* %11
br label %227
150: ; preds = %144, %139
br label %151
151: ; preds = %150, %88
%152 = load double, double* %18
%153 = fcmp une double %152, 0.000000e+00
br i1 %153, label %154, label %185
154: ; preds = %151
%155 = load double, double* %27
%156 = load double, double* %21
%157 = fneg double %156
%158 = fdiv double %157, 2.000000e+00
%159 = load double, double* %15
%160 = fsub double %158, %159
%161 = fmul double %155, %160
%162 = load double, double* %18
%163 = fdiv double %161, %162
store double %163, double* %29
%164 = load double, double* %27
%165 = load double, double* %21
%166 = fdiv double %165, 2.000000e+00
%167 = load double, double* %15
%168 = fsub double %166, %167
%169 = fmul double %164, %168
%170 = load double, double* %18
%171 = fdiv double %169, %170
store double %171, double* %28
%172 = load double, double* %29
%173 = load double, double* %28
%174 = fcmp olt double %172, %173
br i1 %174, label %175, label %178
175: ; preds = %154
%176 = load i32, i32* %36
%177 = or i32 %176, 12
store i32 %177, i32* %36
br label %184
178: ; preds = %154
%179 = load double, double* %28
store double %179, double* %37
%180 = load double, double* %29
store double %180, double* %28
%181 = load double, double* %37
store double %181, double* %29
%182 = load i32, i32* %36
%183 = or i32 %182, 18
store i32 %183, i32* %36
br label %184
184: ; preds = %178, %175
br label %185
185: ; preds = %184, %151
br label %186
186: ; preds = %185, %52
%187 = load i32, i32* %35
%188 = and i32 %187, 1
%189 = icmp ne i32 %188, 0
br i1 %189, label %190, label %225
190: ; preds = %186
%191 = load double, double* %18
%192 = fcmp une double %191, 0.000000e+00
br i1 %192, label %193, label %204
193: ; preds = %190
%194 = load double, double* %29
%195 = load double, double* %31
%196 = fcmp ogt double %194, %195
br i1 %196, label %197, label %204
197: ; preds = %193
%198 = load double, double* %29
%199 = load double*, double** %12
store double %198, double* %199
%200 = load i32, i32* %36
%201 = and i32 %200, 6
%202 = load i32, i32* %35
%203 = or i32 %202, %201
store i32 %203, i32* %35
br label %207
204: ; preds = %193, %190
%205 = load double, double* %31
%206 = load double*, double** %12
store double %205, double* %206
br label %207
207: ; preds = %204, %197
%208 = load double, double* %18
%209 = fcmp une double %208, 0.000000e+00
br i1 %209, label %210, label %221
210: ; preds = %207
%211 = load double, double* %28
%212 = load double, double* %30
%213 = fcmp olt double %211, %212
br i1 %213, label %214, label %221
214: ; preds = %210
%215 = load double, double* %28
%216 = load double*, double** %13
store double %215, double* %216
%217 = load i32, i32* %36
%218 = and i32 %217, 24
%219 = load i32, i32* %35
%220 = or i32 %219, %218
store i32 %220, i32* %35
br label %224
221: ; preds = %210, %207
%222 = load double, double* %30
%223 = load double*, double** %13
store double %222, double* %223
br label %224
224: ; preds = %221, %214
br label %225
225: ; preds = %224, %186
%226 = load i32, i32* %35
store i32 %226, i32* %11
br label %227
227: ; preds = %225, %149, %51
%228 = load i32, i32* %11
ret i32 %228
}

LLVM IR (-O2):
define i32 @cylinder_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) {
%11 = fmul double %6, %6
%12 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %11)
%13 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %12)
%14 = tail call double @sqrt(double %13)
%15 = fcmp une double %13, 0.000000e+00
br i1 %15, label %16, label %117
16: ; preds = %10
%17 = fneg double %6
%18 = tail call double @llvm.fmuladd.f64(double %17, double %6, double %13)
%19 = fmul double %4, %7
%20 = tail call double @llvm.fmuladd.f64(double %2, double %5, double %19)
%21 = fmul double %20, 2.000000e+00
%22 = fmul double %4, %4
%23 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %22)
%24 = fneg double %8
%25 = tail call double @llvm.fmuladd.f64(double %24, double %8, double %23)
%26 = fmul double %18, -4.000000e+00
%27 = fmul double %25, %26
%28 = tail call double @llvm.fmuladd.f64(double %21, double %21, double %27)
%29 = fcmp ult double %28, 0.000000e+00
br i1 %29, label %117, label %30
30: ; preds = %16
%31 = fcmp une double %5, 0.000000e+00
%32 = fcmp une double %7, 0.000000e+00
%33 = or i1 %31, %32
br i1 %33, label %34, label %70
34: ; preds = %30
%35 = tail call double @sqrt(double %28)
%36 = fneg double %21
%37 = fmul double %18, 2.000000e+00
%38 = insertelement <2 x double> poison, double %35, i64 0
%39 = insertelement <2 x double> %38, double %36, i64 1
%40 = insertelement <2 x double> poison, double %21, i64 0
%41 = insertelement <2 x double> %40, double %35, i64 1
%42 = fsub <2 x double> %39, %41
%43 = insertelement <2 x double> poison, double %14, i64 0
%44 = shufflevector <2 x double> %43, <2 x double> poison, <2 x i32> zeroinitializer
%45 = fmul <2 x double> %44, %42
%46 = insertelement <2 x double> poison, double %37, i64 0
%47 = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> zeroinitializer
%48 = fdiv <2 x double> %45, %47
%49 = insertelement <2 x double> poison, double %6, i64 0
%50 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> zeroinitializer
%51 = fmul <2 x double> %48, %50
%52 = fdiv <2 x double> %51, %44
%53 = insertelement <2 x double> poison, double %3, i64 0
%54 = shufflevector <2 x double> %53, <2 x double> poison, <2 x i32> zeroinitializer
%55 = fadd <2 x double> %52, %54
%56 = fmul double %9, -5.000000e-01
%57 = extractelement <2 x double> %55, i64 1
%58 = fcmp olt double %57, %56
%59 = extractelement <2 x double> %55, i64 0
%60 = fcmp olt double %59, %56
%61 = select i1 %58, i1 %60, i1 false
br i1 %61, label %117, label %62
62: ; preds = %34
%63 = fmul double %9, 5.000000e-01
%64 = insertelement <2 x double> poison, double %63, i64 0
%65 = shufflevector <2 x double> %64, <2 x double> poison, <2 x i32> zeroinitializer
%66 = fcmp ogt <2 x double> %55, %65
%67 = extractelement <2 x i1> %66, i64 0
%68 = extractelement <2 x i1> %66, i64 1
%69 = select i1 %68, i1 %67, i1 false
br i1 %69, label %117, label %70
70: ; preds = %62, %30
%71 = phi i32 [ 1, %62 ], [ 0, %30 ]
%72 = phi <2 x double> [ %48, %62 ], [ zeroinitializer, %30 ]
%73 = fcmp une double %6, 0.000000e+00
br i1 %73, label %74, label %95
74: ; preds = %70
%75 = insertelement <2 x double> poison, double %9, i64 0
%76 = shufflevector <2 x double> %75, <2 x double> poison, <2 x i32> zeroinitializer
%77 = fmul <2 x double> %76, <double -5.000000e-01, double 5.000000e-01>
%78 = insertelement <2 x double> poison, double %3, i64 0
%79 = shufflevector <2 x double> %78, <2 x double> poison, <2 x i32> zeroinitializer
%80 = fsub <2 x double> %77, %79
%81 = insertelement <2 x double> poison, double %14, i64 0
%82 = shufflevector <2 x double> %81, <2 x double> poison, <2 x i32> zeroinitializer
%83 = fmul <2 x double> %80, %82
%84 = insertelement <2 x double> poison, double %6, i64 0
%85 = shufflevector <2 x double> %84, <2 x double> poison, <2 x i32> zeroinitializer
%86 = fdiv <2 x double> %83, %85
%87 = extractelement <2 x double> %86, i64 0
%88 = extractelement <2 x double> %86, i64 1
%89 = fcmp olt double %87, %88
%90 = insertelement <2 x i1> poison, i1 %89, i64 0
%91 = shufflevector <2 x i1> %90, <2 x i1> poison, <2 x i32> zeroinitializer
%92 = shufflevector <2 x double> %86, <2 x double> undef, <2 x i32> <i32 1, i32 0>
%93 = select <2 x i1> %91, <2 x double> %86, <2 x double> %92
%94 = select i1 %89, i32 12, i32 18
br label %95
95: ; preds = %74, %70
%96 = phi i32 [ 0, %70 ], [ %94, %74 ]
%97 = phi <2 x double> [ zeroinitializer, %70 ], [ %93, %74 ]
br i1 %33, label %98, label %117
98: ; preds = %95
%99 = extractelement <2 x double> %97, i64 0
%100 = extractelement <2 x double> %72, i64 1
%101 = fcmp ogt double %99, %100
%102 = select i1 %73, i1 %101, i1 false
br i1 %102, label %103, label %106
103: ; preds = %98
store double %99, double* %0
%104 = and i32 %96, 6
%105 = or i32 %104, %71
br label %107
106: ; preds = %98
store double %100, double* %0
br label %107
107: ; preds = %106, %103
%108 = phi i32 [ %105, %103 ], [ 1, %106 ]
%109 = extractelement <2 x double> %97, i64 1
%110 = extractelement <2 x double> %72, i64 0
%111 = fcmp olt double %109, %110
%112 = select i1 %73, i1 %111, i1 false
br i1 %112, label %113, label %116
113: ; preds = %107
store double %109, double* %1
%114 = and i32 %96, 24
%115 = or i32 %108, %114
br label %117
116: ; preds = %107
store double %110, double* %1
br label %117
117: ; preds = %16, %95, %116, %113, %34, %62, %10
%118 = phi i32 [ 0, %10 ], [ 0, %62 ], [ 0, %34 ], [ %115, %113 ], [ %108, %116 ], [ %71, %95 ], [ 0, %16 ]
ret i32 %118
}