int intersect_triangle(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]);
  if (det > -0.000001 && det < 0.000001)
    return 0;
  inv_det = 1.0 / det;
  tvec[0] = orig[0] - vert0[0];
  tvec[1] = orig[1] - vert0[1];
  tvec[2] = orig[2] - vert0[2];
  ;
  *u = (tvec[0] * pvec[0] + tvec[1] * pvec[1] + tvec[2] * pvec[2]) * inv_det;
  if (*u < 0.0 || *u > 1.0)
    return 0;
  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];
  ;
  *v = (dir[0] * qvec[0] + dir[1] * qvec[1] + dir[2] * qvec[2]) * inv_det;
  if (*v < 0.0 || *u + *v > 1.0)
    return 0;
  *t = (edge2[0] * qvec[0] + edge2[1] * qvec[1] + edge2[2] * qvec[2]) * inv_det;
  return 1;
}


x86 assembly (clang, -O0):
<intersect_triangle>:
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
movsd  -0xd8(%rbp),%xmm0
ff
movsd  0xd3c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12f0 <intersect_triangle+0x1f0>
movsd  0xd32(%rip),%xmm0
ucomisd -0xd8(%rbp),%xmm0
ff
jbe    12f0 <intersect_triangle+0x1f0>
movl   $0x0,-0x4(%rbp)
jmp    1571 <intersect_triangle+0x471>
movsd  0xd18(%rip),%xmm0
divsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%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  -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
mulsd  -0xe0(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
ja     13c9 <intersect_triangle+0x2c9>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xc51(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13d5 <intersect_triangle+0x2d5>
movl   $0x0,-0x4(%rbp)
jmp    1571 <intersect_triangle+0x471>
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
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
mulsd  -0xe0(%rbp),%xmm0
ff
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x18(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
ja     1517 <intersect_triangle+0x417>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  0xb03(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1523 <intersect_triangle+0x423>
movl   $0x0,-0x4(%rbp)
jmp    1571 <intersect_triangle+0x471>
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)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intersect_triangle>:
movsd  (%rdx),%xmm8
movsd  0x8(%rdx),%xmm15
movsd  (%rcx),%xmm14
movsd  0x8(%rcx),%xmm13
subsd  %xmm8,%xmm14
subsd  %xmm15,%xmm13
movsd  0x10(%rcx),%xmm5
movsd  0x10(%rdx),%xmm2
subsd  %xmm2,%xmm5
movsd  (%r8),%xmm9
movsd  0x8(%r8),%xmm11
subsd  %xmm8,%xmm9
subsd  %xmm15,%xmm11
movsd  0x10(%r8),%xmm12
subsd  %xmm2,%xmm12
movsd  (%rsi),%xmm6
movsd  0x8(%rsi),%xmm1
movsd  0x10(%rsi),%xmm4
movapd %xmm11,%xmm3
mulsd  %xmm4,%xmm3
movapd %xmm9,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm12,%xmm1
subsd  %xmm3,%xmm1
movapd %xmm12,%xmm3
mulsd  %xmm6,%xmm3
mulsd  %xmm9,%xmm4
subsd  %xmm3,%xmm4
mulsd  %xmm11,%xmm6
subsd  %xmm0,%xmm6
movapd %xmm13,%xmm0
mulsd  %xmm4,%xmm0
movapd %xmm14,%xmm7
mulsd  %xmm1,%xmm7
addsd  %xmm0,%xmm7
movapd %xmm5,%xmm3
mulsd  %xmm6,%xmm3
addsd  %xmm7,%xmm3
xor    %eax,%eax
ucomisd 0xe42(%rip),%xmm3
jbe    11cf <intersect_triangle+0xcf>
movsd  0xe40(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    11cf <intersect_triangle+0xcf>
ret
mov    0x8(%rsp),%rcx
movsd  0xe34(%rip),%xmm7
divsd  %xmm3,%xmm7
movsd  (%rdi),%xmm10
movsd  0x8(%rdi),%xmm3
subsd  %xmm8,%xmm10
subsd  %xmm15,%xmm3
movsd  0x10(%rdi),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm4
mulsd  %xmm10,%xmm1
addsd  %xmm4,%xmm1
mulsd  %xmm0,%xmm6
addsd  %xmm1,%xmm6
mulsd  %xmm7,%xmm6
movsd  %xmm6,(%rcx)
xorpd  %xmm1,%xmm1
ucomisd %xmm6,%xmm1
ja     11ce <intersect_triangle+0xce>
ucomisd 0xde4(%rip),%xmm6
ja     11ce <intersect_triangle+0xce>
mov    0x10(%rsp),%rdx
movapd %xmm13,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm3,%xmm1
mulsd  %xmm5,%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm10,%xmm5
mulsd  %xmm14,%xmm0
subsd  %xmm5,%xmm0
mulsd  %xmm3,%xmm14
mulsd  %xmm13,%xmm10
subsd  %xmm14,%xmm10
movsd  0x8(%rsi),%xmm2
mulsd  %xmm0,%xmm2
movsd  (%rsi),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  0x10(%rsi),%xmm2
mulsd  %xmm10,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm7,%xmm2
movsd  %xmm2,(%rdx)
xorpd  %xmm3,%xmm3
ucomisd %xmm2,%xmm3
ja     11ce <intersect_triangle+0xce>
addsd  (%rcx),%xmm2
ucomisd 0xd66(%rip),%xmm2
ja     11ce <intersect_triangle+0xce>
mulsd  %xmm0,%xmm11
mulsd  %xmm1,%xmm9
addsd  %xmm11,%xmm9
mulsd  %xmm10,%xmm12
addsd  %xmm9,%xmm12
mulsd  %xmm12,%xmm7
movsd  %xmm7,(%r9)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @intersect_triangle(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* %23
%131 = fcmp ogt double %130, 0xBEB0C6F7A0B5ED8D
br i1 %131, label %132, label %136
132: ; preds = %8
%133 = load double, double* %23
%134 = fcmp olt double %133, 0x3EB0C6F7A0B5ED8D
br i1 %134, label %135, label %136
135: ; preds = %132
store i32 0, i32* %9
br label %277
136: ; preds = %132, %8
%137 = load double, double* %23
%138 = fdiv double 1.000000e+00, %137
store double %138, double* %24
%139 = load double*, double** %10
%140 = getelementptr inbounds double, double* %139, i64 0
%141 = load double, double* %140
%142 = load double*, double** %12
%143 = getelementptr inbounds double, double* %142, i64 0
%144 = load double, double* %143
%145 = fsub double %141, %144
%146 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 0
store double %145, double* %146
%147 = load double*, double** %10
%148 = getelementptr inbounds double, double* %147, i64 1
%149 = load double, double* %148
%150 = load double*, double** %12
%151 = getelementptr inbounds double, double* %150, i64 1
%152 = load double, double* %151
%153 = fsub double %149, %152
%154 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 1
store double %153, double* %154
%155 = load double*, double** %10
%156 = getelementptr inbounds double, double* %155, i64 2
%157 = load double, double* %156
%158 = load double*, double** %12
%159 = getelementptr inbounds double, double* %158, i64 2
%160 = load double, double* %159
%161 = fsub double %157, %160
%162 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 2
store double %161, double* %162
%163 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 0
%164 = load double, double* %163
%165 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 0
%166 = load double, double* %165
%167 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 1
%168 = load double, double* %167
%169 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 1
%170 = load double, double* %169
%171 = fmul double %168, %170
%172 = call double @llvm.fmuladd.f64(double %164, double %166, double %171)
%173 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 2
%174 = load double, double* %173
%175 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 2
%176 = load double, double* %175
%177 = call double @llvm.fmuladd.f64(double %174, double %176, double %172)
%178 = load double, double* %24
%179 = fmul double %177, %178
%180 = load double*, double** %16
store double %179, double* %180
%181 = load double*, double** %16
%182 = load double, double* %181
%183 = fcmp olt double %182, 0.000000e+00
br i1 %183, label %188, label %184
184: ; preds = %136
%185 = load double*, double** %16
%186 = load double, double* %185
%187 = fcmp ogt double %186, 1.000000e+00
br i1 %187, label %188, label %189
188: ; preds = %184, %136
store i32 0, i32* %9
br label %277
189: ; preds = %184
%190 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 1
%191 = load double, double* %190
%192 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 2
%193 = load double, double* %192
%194 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 2
%195 = load double, double* %194
%196 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 1
%197 = load double, double* %196
%198 = fmul double %195, %197
%199 = fneg double %198
%200 = call double @llvm.fmuladd.f64(double %191, double %193, double %199)
%201 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
store double %200, double* %201
%202 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 2
%203 = load double, double* %202
%204 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 0
%205 = load double, double* %204
%206 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 0
%207 = load double, double* %206
%208 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 2
%209 = load double, double* %208
%210 = fmul double %207, %209
%211 = fneg double %210
%212 = call double @llvm.fmuladd.f64(double %203, double %205, double %211)
%213 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
store double %212, double* %213
%214 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 0
%215 = load double, double* %214
%216 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 1
%217 = load double, double* %216
%218 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 1
%219 = load double, double* %218
%220 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 0
%221 = load double, double* %220
%222 = fmul double %219, %221
%223 = fneg double %222
%224 = call double @llvm.fmuladd.f64(double %215, double %217, double %223)
%225 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double %224, double* %225
%226 = load double*, double** %11
%227 = getelementptr inbounds double, double* %226, i64 0
%228 = load double, double* %227
%229 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%230 = load double, double* %229
%231 = load double*, double** %11
%232 = getelementptr inbounds double, double* %231, i64 1
%233 = load double, double* %232
%234 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%235 = load double, double* %234
%236 = fmul double %233, %235
%237 = call double @llvm.fmuladd.f64(double %228, double %230, double %236)
%238 = load double*, double** %11
%239 = getelementptr inbounds double, double* %238, i64 2
%240 = load double, double* %239
%241 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%242 = load double, double* %241
%243 = call double @llvm.fmuladd.f64(double %240, double %242, double %237)
%244 = load double, double* %24
%245 = fmul double %243, %244
%246 = load double*, double** %17
store double %245, double* %246
%247 = load double*, double** %17
%248 = load double, double* %247
%249 = fcmp olt double %248, 0.000000e+00
br i1 %249, label %257, label %250
250: ; preds = %189
%251 = load double*, double** %16
%252 = load double, double* %251
%253 = load double*, double** %17
%254 = load double, double* %253
%255 = fadd double %252, %254
%256 = fcmp ogt double %255, 1.000000e+00
br i1 %256, label %257, label %258
257: ; preds = %250, %189
store i32 0, i32* %9
br label %277
258: ; preds = %250
%259 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 0
%260 = load double, double* %259
%261 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%262 = load double, double* %261
%263 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 1
%264 = load double, double* %263
%265 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%266 = load double, double* %265
%267 = fmul double %264, %266
%268 = call double @llvm.fmuladd.f64(double %260, double %262, double %267)
%269 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 2
%270 = load double, double* %269
%271 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%272 = load double, double* %271
%273 = call double @llvm.fmuladd.f64(double %270, double %272, double %268)
%274 = load double, double* %24
%275 = fmul double %273, %274
%276 = load double*, double** %15
store double %275, double* %276
store i32 1, i32* %9
br label %277
277: ; preds = %258, %257, %188, %135
%278 = load i32, i32* %9
ret i32 %278
}

LLVM IR (-O2):
define i32 @intersect_triangle(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5, double* nocapture %6, double* nocapture writeonly %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 = fcmp ogt double %46, 0xBEB0C6F7A0B5ED8D
%48 = fcmp olt double %46, 0x3EB0C6F7A0B5ED8D
%49 = and i1 %47, %48
br i1 %49, label %94, label %50
50: ; preds = %8
%51 = fdiv double 1.000000e+00, %46
%52 = load double, double* %0
%53 = fsub double %52, %10
%54 = getelementptr inbounds double, double* %0, i64 1
%55 = load double, double* %54
%56 = fsub double %55, %15
%57 = getelementptr inbounds double, double* %0, i64 2
%58 = load double, double* %57
%59 = fsub double %58, %20
%60 = fmul double %40, %56
%61 = tail call double @llvm.fmuladd.f64(double %53, double %36, double %60)
%62 = tail call double @llvm.fmuladd.f64(double %59, double %43, double %61)
%63 = fmul double %51, %62
store double %63, double* %6
%64 = fcmp olt double %63, 0.000000e+00
%65 = fcmp ogt double %63, 1.000000e+00
%66 = or i1 %64, %65
br i1 %66, label %94, label %67
67: ; preds = %50
%68 = fneg double %59
%69 = fmul double %16, %68
%70 = tail call double @llvm.fmuladd.f64(double %56, double %21, double %69)
%71 = fneg double %53
%72 = fmul double %21, %71
%73 = tail call double @llvm.fmuladd.f64(double %59, double %11, double %72)
%74 = fneg double %56
%75 = fmul double %11, %74
%76 = tail call double @llvm.fmuladd.f64(double %53, double %16, double %75)
%77 = load double, double* %1
%78 = load double, double* %30
%79 = fmul double %73, %78
%80 = tail call double @llvm.fmuladd.f64(double %77, double %70, double %79)
%81 = load double, double* %32
%82 = tail call double @llvm.fmuladd.f64(double %81, double %76, double %80)
%83 = fmul double %51, %82
store double %83, double* %7
%84 = fcmp olt double %83, 0.000000e+00
br i1 %84, label %94, label %85
85: ; preds = %67
%86 = load double, double* %6
%87 = fadd double %83, %86
%88 = fcmp ogt double %87, 1.000000e+00
br i1 %88, label %94, label %89
89: ; preds = %85
%90 = fmul double %26, %73
%91 = tail call double @llvm.fmuladd.f64(double %23, double %70, double %90)
%92 = tail call double @llvm.fmuladd.f64(double %29, double %76, double %91)
%93 = fmul double %51, %92
store double %93, double* %5
br label %94
94: ; preds = %67, %85, %50, %8, %89
%95 = phi i32 [ 1, %89 ], [ 0, %8 ], [ 0, %50 ], [ 0, %85 ], [ 0, %67 ]
ret i32 %95
}