int intersect_triangle3(double orig[3], double dir[3], double vert0[3],
                        double vert1[3], double vert2[3], double *t, double *u,
                        double *v) {
  double edge1[3], edge2[3], tvec[3], pvec[3], qvec[3];
  double det, inv_det;
  edge1[0] = vert1[0] - vert0[0];
  edge1[1] = vert1[1] - vert0[1];
  edge1[2] = vert1[2] - vert0[2];
  ;
  edge2[0] = vert2[0] - vert0[0];
  edge2[1] = vert2[1] - vert0[1];
  edge2[2] = vert2[2] - vert0[2];
  ;
  pvec[0] = dir[1] * edge2[2] - dir[2] * edge2[1];
  pvec[1] = dir[2] * edge2[0] - dir[0] * edge2[2];
  pvec[2] = dir[0] * edge2[1] - dir[1] * edge2[0];
  ;
  det = (edge1[0] * pvec[0] + edge1[1] * pvec[1] + edge1[2] * pvec[2]);
  tvec[0] = orig[0] - vert0[0];
  tvec[1] = orig[1] - vert0[1];
  tvec[2] = orig[2] - vert0[2];
  ;
  inv_det = 1.0 / det;
  qvec[0] = tvec[1] * edge1[2] - tvec[2] * edge1[1];
  qvec[1] = tvec[2] * edge1[0] - tvec[0] * edge1[2];
  qvec[2] = tvec[0] * edge1[1] - tvec[1] * edge1[0];
  ;
  if (det > 0.000001) {
    *u = (tvec[0] * pvec[0] + tvec[1] * pvec[1] + tvec[2] * pvec[2]);
    if (*u < 0.0 || *u > det)
      return 0;
    *v = (dir[0] * qvec[0] + dir[1] * qvec[1] + dir[2] * qvec[2]);
    if (*v < 0.0 || *u + *v > det)
      return 0;
  } else if (det < -0.000001) {
    *u = (tvec[0] * pvec[0] + tvec[1] * pvec[1] + tvec[2] * pvec[2]);
    if (*u > 0.0 || *u < det)
      return 0;
    *v = (dir[0] * qvec[0] + dir[1] * qvec[1] + dir[2] * qvec[2]);
    if (*v > 0.0 || *u + *v < det)
      return 0;
  } else
    return 0;
  *t = (edge2[0] * qvec[0] + edge2[1] * qvec[1] + edge2[2] * qvec[2]) * inv_det;
  (*u) *= inv_det;
  (*v) *= inv_det;
  return 1;
}


x86 assembly (clang, -O0):
<intersect_triangle3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x60(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mulsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x70(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x68(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%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,-0xa0(%rbp)
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0x48(%rbp),%xmm0
mulsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0xa0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd03(%rip),%xmm0
divsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x40(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x48(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  0xc1e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    14ee <intersect_triangle3+0x3ee>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
movsd  -0xa0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
ja     1458 <intersect_triangle3+0x358>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd -0xd8(%rbp),%xmm0
ff
jbe    1464 <intersect_triangle3+0x364>
movl   $0x0,-0x4(%rbp)
jmp    169d <intersect_triangle3+0x59d>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0xd0(%rbp),%xmm2
ff
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0xc0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x18(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
ja     14dd <intersect_triangle3+0x3dd>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x18(%rbp),%rax
addsd  (%rax),%xmm0
ucomisd -0xd8(%rbp),%xmm0
ff
jbe    14e9 <intersect_triangle3+0x3e9>
movl   $0x0,-0x4(%rbp)
jmp    169d <intersect_triangle3+0x59d>
jmp    1627 <intersect_triangle3+0x527>
movsd  0xb1a(%rip),%xmm0
ucomisd -0xd8(%rbp),%xmm0
ff
jbe    1616 <intersect_triangle3+0x516>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
movsd  -0xa0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1578 <intersect_triangle3+0x478>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1584 <intersect_triangle3+0x484>
movl   $0x0,-0x4(%rbp)
jmp    169d <intersect_triangle3+0x59d>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0xd0(%rbp),%xmm2
ff
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0xc0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1605 <intersect_triangle3+0x505>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    0x18(%rbp),%rax
addsd  (%rax),%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1611 <intersect_triangle3+0x511>
movl   $0x0,-0x4(%rbp)
jmp    169d <intersect_triangle3+0x59d>
jmp    1622 <intersect_triangle3+0x522>
movl   $0x0,-0x4(%rbp)
jmp    169d <intersect_triangle3+0x59d>
jmp    1627 <intersect_triangle3+0x527>
movsd  -0x70(%rbp),%xmm1
movsd  -0xd0(%rbp),%xmm2
ff
movsd  -0x68(%rbp),%xmm0
mulsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0xc0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0xe0(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xe0(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0xe0(%rbp),%xmm0
ff
mov    0x18(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intersect_triangle3>:
mov    0x10(%rsp),%r10
mov    0x8(%rsp),%r11
movsd  (%rcx),%xmm2
movsd  0x8(%rcx),%xmm5
movsd  (%rdx),%xmm6
movsd  0x8(%rdx),%xmm11
subsd  %xmm6,%xmm2
subsd  %xmm11,%xmm5
movsd  0x10(%rcx),%xmm3
movsd  0x10(%rdx),%xmm12
subsd  %xmm12,%xmm3
movsd  (%r8),%xmm9
movsd  0x8(%r8),%xmm8
subsd  %xmm6,%xmm9
subsd  %xmm11,%xmm8
movsd  0x10(%r8),%xmm10
subsd  %xmm12,%xmm10
movsd  (%rsi),%xmm14
movsd  0x8(%rsi),%xmm1
movsd  0x10(%rsi),%xmm0
movapd %xmm8,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm9,%xmm7
mulsd  %xmm1,%xmm7
mulsd  %xmm10,%xmm1
subsd  %xmm4,%xmm1
movapd %xmm10,%xmm4
mulsd  %xmm14,%xmm4
mulsd  %xmm9,%xmm0
subsd  %xmm4,%xmm0
mulsd  %xmm8,%xmm14
subsd  %xmm7,%xmm14
movapd %xmm5,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm2,%xmm7
mulsd  %xmm1,%xmm7
addsd  %xmm4,%xmm7
movapd %xmm3,%xmm13
mulsd  %xmm14,%xmm13
addsd  %xmm7,%xmm13
movsd  (%rdi),%xmm4
movsd  0x8(%rdi),%xmm7
subsd  %xmm6,%xmm4
subsd  %xmm11,%xmm7
movsd  0x10(%rdi),%xmm6
subsd  %xmm12,%xmm6
movapd %xmm4,%xmm11
mulsd  %xmm5,%xmm11
mulsd  %xmm6,%xmm5
movapd %xmm7,%xmm12
mulsd  %xmm3,%xmm12
subsd  %xmm5,%xmm12
mulsd  %xmm4,%xmm3
movapd %xmm6,%xmm5
mulsd  %xmm2,%xmm5
subsd  %xmm3,%xmm5
mulsd  %xmm7,%xmm2
subsd  %xmm2,%xmm11
ucomisd 0xded(%rip),%xmm13
jbe    128a <intersect_triangle3+0x18a>
mulsd  %xmm7,%xmm0
mulsd  %xmm1,%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm14,%xmm6
addsd  %xmm4,%xmm6
movsd  %xmm6,(%r11)
xor    %eax,%eax
xorpd  %xmm0,%xmm0
ucomisd %xmm6,%xmm0
ja     1289 <intersect_triangle3+0x189>
ucomisd %xmm13,%xmm6
ja     1289 <intersect_triangle3+0x189>
movsd  0x8(%rsi),%xmm0
mulsd  %xmm5,%xmm0
movsd  (%rsi),%xmm1
mulsd  %xmm12,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsi),%xmm0
mulsd  %xmm11,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r10)
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1289 <intersect_triangle3+0x189>
addsd  (%r11),%xmm0
ucomisd %xmm13,%xmm0
jbe    1305 <intersect_triangle3+0x205>
ret
xor    %eax,%eax
movsd  0xd7c(%rip),%xmm2
ucomisd %xmm13,%xmm2
jbe    1289 <intersect_triangle3+0x189>
mulsd  %xmm7,%xmm0
mulsd  %xmm1,%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm14,%xmm6
addsd  %xmm4,%xmm6
movsd  %xmm6,(%r11)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm6
ja     1289 <intersect_triangle3+0x189>
ucomisd %xmm6,%xmm13
ja     1289 <intersect_triangle3+0x189>
movsd  0x8(%rsi),%xmm0
mulsd  %xmm5,%xmm0
movsd  (%rsi),%xmm1
mulsd  %xmm12,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsi),%xmm0
mulsd  %xmm11,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r10)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1289 <intersect_triangle3+0x189>
addsd  (%r11),%xmm0
ucomisd %xmm0,%xmm13
ja     1289 <intersect_triangle3+0x189>
movsd  0xcf3(%rip),%xmm0
divsd  %xmm13,%xmm0
mulsd  %xmm5,%xmm8
mulsd  %xmm12,%xmm9
addsd  %xmm8,%xmm9
mulsd  %xmm11,%xmm10
addsd  %xmm9,%xmm10
mulsd  %xmm0,%xmm10
movsd  %xmm10,(%r9)
movsd  (%r11),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%r11)
mulsd  (%r10),%xmm0
movsd  %xmm0,(%r10)
mov    $0x1,%eax
ret

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

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