#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 INFINITY;
void intercept2d(double outval[], double pt1[3], double pt2[3],
                 double outliner[], double outlinez[], int ix) {
  int i;
  double delr, delz, del1, del2, denom;
  *outval = INFINITY;
  delr = pt1[0] - pt2[0];
  delz = pt1[2] - pt2[2];
  for (i = ix - 1; i--;) {
    del1 = outliner[i + 1] - outliner[i];
    del2 = outlinez[i + 1] - outlinez[i];
    denom = delr * del2 - delz * del1;
    if (denom) {
      del1 = (del2 * (pt1[0] - outliner[i]) - del1 * (pt1[2] - outlinez[i])) /
             denom;
      del2 = (delr * (pt1[2] - outlinez[i]) - delz * (pt1[0] - outliner[i])) /
             denom;
      if ((del2 > 0) & (del2 < 1) & (del1 < *outval) & (del1 > 0)) {
        *outval = del1;
      }
    }
  }
}


x86 assembly (clang, -O0):
<intercept2d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    0x2ec5(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x30(%rbp)
cmp    $0x0,%eax
je     1358 <intercept2d+0x258>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x40(%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,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1215 <intercept2d+0x115>
jp     1215 <intercept2d+0x115>
jmp    1353 <intercept2d+0x253>
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm3
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
movsd  -0x40(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xd0b(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
movsd  -0x48(%rbp),%xmm1
mov    -0x8(%rbp),%rcx
movsd  (%rcx),%xmm0
ucomisd %xmm1,%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     134e <intercept2d+0x24e>
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1353 <intercept2d+0x253>
jmp    1164 <intercept2d+0x64>
pop    %rbp
ret

x86 assembly (clang, -O2):
<intercept2d>:
mov    0x2ee1(%rip),%rax
movsd  (%rax),%xmm13
movsd  %xmm13,(%rdi)
mov    %r9d,%r10d
add    $0xffffffff,%r10d
je     1240 <intercept2d+0x140>
movsd  (%rsi),%xmm5
subsd  (%rdx),%xmm5
add    $0xfffffffe,%r9d
movsd  0x10(%rsi),%xmm2
subsd  0x10(%rdx),%xmm2
xorpd  0xec4(%rip),%xmm2
movslq %r9d,%rdx
unpcklpd %xmm5,%xmm11
pshufd $0x44,%xmm2,%xmm12
xorpd  %xmm10,%xmm10
movapd 0xea8(%rip),%xmm9
movsd  0xeaf(%rip),%xmm8
jmp    117e <intercept2d+0x7e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%r10d
add    $0xffffffffffffffff,%rdx
jae    1240 <intercept2d+0x140>
movslq %r10d,%rax
movsd  (%rcx,%rax,8),%xmm7
movsd  (%rcx,%rdx,8),%xmm3
subsd  %xmm3,%xmm7
movsd  (%r8,%rax,8),%xmm0
movsd  (%r8,%rdx,8),%xmm4
subsd  %xmm4,%xmm0
movapd %xmm7,%xmm6
mulsd  %xmm2,%xmm6
movapd %xmm5,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm6,%xmm1
ucomisd %xmm10,%xmm1
jne    11bc <intercept2d+0xbc>
jnp    1170 <intercept2d+0x70>
movsd  (%rsi),%xmm6
movhpd 0x10(%rsi),%xmm6
unpcklpd %xmm4,%xmm3
subpd  %xmm3,%xmm6
xorpd  %xmm9,%xmm7
shufpd $0x2,%xmm12,%xmm7
shufpd $0x2,%xmm11,%xmm0
mulpd  %xmm6,%xmm0
shufpd $0x1,%xmm6,%xmm6
mulpd  %xmm7,%xmm6
addpd  %xmm6,%xmm0
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
cmpltpd %xmm0,%xmm1
movmskpd %xmm1,%eax
test   $0x1,%al
je     1170 <intercept2d+0x70>
shr    %al
je     1170 <intercept2d+0x70>
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
ucomisd %xmm1,%xmm8
jbe    1170 <intercept2d+0x70>
ucomisd %xmm0,%xmm13
jbe    1170 <intercept2d+0x70>
movsd  %xmm0,(%rdi)
movapd %xmm0,%xmm13
jmp    1170 <intercept2d+0x70>
ret

LLVM IR (-O0):
@INFINITY = global double 0.000000e+00
define void @intercept2d(double* %0, double* %1, double* %2, double* %3, double* %4, i32 %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store i32 %5, i32* %12
%19 = load double, double* @INFINITY
%20 = load double*, double** %7
store double %19, double* %20
%21 = load double*, double** %8
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
%24 = load double*, double** %9
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = load double, double* %25
%27 = fsub double %23, %26
store double %27, double* %14
%28 = load double*, double** %8
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double, double* %29
%31 = load double*, double** %9
%32 = getelementptr inbounds double, double* %31, i64 2
%33 = load double, double* %32
%34 = fsub double %30, %33
store double %34, double* %15
%35 = load i32, i32* %12
%36 = sub nsw i32 %35, 1
store i32 %36, i32* %13
br label %37
37: ; preds = %148, %6
%38 = load i32, i32* %13
%39 = add nsw i32 %38, -1
store i32 %39, i32* %13
%40 = icmp ne i32 %38, 0
br i1 %40, label %41, label %149
41: ; preds = %37
%42 = load double*, double** %10
%43 = load i32, i32* %13
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %42, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %10
%49 = load i32, i32* %13
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = fsub double %47, %52
store double %53, double* %16
%54 = load double*, double** %11
%55 = load i32, i32* %13
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %54, i64 %57
%59 = load double, double* %58
%60 = load double*, double** %11
%61 = load i32, i32* %13
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
%64 = load double, double* %63
%65 = fsub double %59, %64
store double %65, double* %17
%66 = load double, double* %14
%67 = load double, double* %17
%68 = load double, double* %15
%69 = load double, double* %16
%70 = fmul double %68, %69
%71 = fneg double %70
%72 = call double @llvm.fmuladd.f64(double %66, double %67, double %71)
store double %72, double* %18
%73 = load double, double* %18
%74 = fcmp une double %73, 0.000000e+00
br i1 %74, label %75, label %148
75: ; preds = %41
%76 = load double, double* %17
%77 = load double*, double** %8
%78 = getelementptr inbounds double, double* %77, i64 0
%79 = load double, double* %78
%80 = load double*, double** %10
%81 = load i32, i32* %13
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %80, i64 %82
%84 = load double, double* %83
%85 = fsub double %79, %84
%86 = load double, double* %16
%87 = load double*, double** %8
%88 = getelementptr inbounds double, double* %87, i64 2
%89 = load double, double* %88
%90 = load double*, double** %11
%91 = load i32, i32* %13
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = fsub double %89, %94
%96 = fmul double %86, %95
%97 = fneg double %96
%98 = call double @llvm.fmuladd.f64(double %76, double %85, double %97)
%99 = load double, double* %18
%100 = fdiv double %98, %99
store double %100, double* %16
%101 = load double, double* %14
%102 = load double*, double** %8
%103 = getelementptr inbounds double, double* %102, i64 2
%104 = load double, double* %103
%105 = load double*, double** %11
%106 = load i32, i32* %13
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %105, i64 %107
%109 = load double, double* %108
%110 = fsub double %104, %109
%111 = load double, double* %15
%112 = load double*, double** %8
%113 = getelementptr inbounds double, double* %112, i64 0
%114 = load double, double* %113
%115 = load double*, double** %10
%116 = load i32, i32* %13
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
%119 = load double, double* %118
%120 = fsub double %114, %119
%121 = fmul double %111, %120
%122 = fneg double %121
%123 = call double @llvm.fmuladd.f64(double %101, double %110, double %122)
%124 = load double, double* %18
%125 = fdiv double %123, %124
store double %125, double* %17
%126 = load double, double* %17
%127 = fcmp ogt double %126, 0.000000e+00
%128 = zext i1 %127 to i32
%129 = load double, double* %17
%130 = fcmp olt double %129, 1.000000e+00
%131 = zext i1 %130 to i32
%132 = and i32 %128, %131
%133 = load double, double* %16
%134 = load double*, double** %7
%135 = load double, double* %134
%136 = fcmp olt double %133, %135
%137 = zext i1 %136 to i32
%138 = and i32 %132, %137
%139 = load double, double* %16
%140 = fcmp ogt double %139, 0.000000e+00
%141 = zext i1 %140 to i32
%142 = and i32 %138, %141
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %147
144: ; preds = %75
%145 = load double, double* %16
%146 = load double*, double** %7
store double %145, double* %146
br label %147
147: ; preds = %144, %75
br label %148
148: ; preds = %147, %41
br label %37
149: ; preds = %37
ret void
}

LLVM IR (-O2):
@INFINITY = global double 0.000000e+00
define void @intercept2d(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, i32 %5) {
%7 = load double, double* @INFINITY
store double %7, double* %0
%8 = load double, double* %1
%9 = load double, double* %2
%10 = fsub double %8, %9
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = add nsw i32 %5, -1
%13 = icmp eq i32 %12, 0
br i1 %13, label %75, label %14
14: ; preds = %6
%15 = add i32 %5, -2
%16 = load double, double* %11
%17 = getelementptr inbounds double, double* %2, i64 2
%18 = load double, double* %17
%19 = fsub double %16, %18
%20 = fneg double %19
%21 = sext i32 %15 to i64
%22 = insertelement <2 x double> poison, double %10, i64 1
%23 = insertelement <2 x double> poison, double %20, i64 1
br label %24
24: ; preds = %14, %70
%25 = phi double [ %7, %14 ], [ %71, %70 ]
%26 = phi i64 [ %21, %14 ], [ %72, %70 ]
%27 = phi i32 [ %12, %14 ], [ %74, %70 ]
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %3, i64 %28
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %3, i64 %26
%32 = load double, double* %31
%33 = fsub double %30, %32
%34 = getelementptr inbounds double, double* %4, i64 %28
%35 = load double, double* %34
%36 = getelementptr inbounds double, double* %4, i64 %26
%37 = load double, double* %36
%38 = fsub double %35, %37
%39 = fmul double %33, %20
%40 = tail call double @llvm.fmuladd.f64(double %10, double %38, double %39)
%41 = fcmp une double %40, 0.000000e+00
br i1 %41, label %42, label %70
42: ; preds = %24
%43 = load double, double* %1
%44 = load double, double* %11
%45 = insertelement <2 x double> poison, double %43, i64 0
%46 = insertelement <2 x double> %45, double %44, i64 1
%47 = insertelement <2 x double> poison, double %32, i64 0
%48 = insertelement <2 x double> %47, double %37, i64 1
%49 = fsub <2 x double> %46, %48
%50 = fneg double %33
%51 = shufflevector <2 x double> %49, <2 x double> undef, <2 x i32> <i32 1, i32 0>
%52 = insertelement <2 x double> %23, double %50, i64 0
%53 = fmul <2 x double> %51, %52
%54 = insertelement <2 x double> %22, double %38, i64 0
%55 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %54, <2 x double> %49, <2 x double> %53)
%56 = insertelement <2 x double> poison, double %40, i64 0
%57 = shufflevector <2 x double> %56, <2 x double> poison, <2 x i32> zeroinitializer
%58 = fdiv <2 x double> %55, %57
%59 = extractelement <2 x double> %58, i64 1
%60 = fcmp olt double %59, 1.000000e+00
%61 = fcmp ogt <2 x double> %58, zeroinitializer
%62 = extractelement <2 x i1> %61, i64 1
%63 = and i1 %62, %60
%64 = extractelement <2 x double> %58, i64 0
%65 = fcmp olt double %64, %25
%66 = and i1 %63, %65
%67 = extractelement <2 x i1> %61, i64 0
%68 = and i1 %67, %66
br i1 %68, label %69, label %70
69: ; preds = %42
store double %64, double* %0
br label %70
70: ; preds = %42, %69, %24
%71 = phi double [ %25, %42 ], [ %64, %69 ], [ %25, %24 ]
%72 = add nsw i64 %26, -1
%73 = icmp eq i64 %26, 0
%74 = trunc i64 %26 to i32
br i1 %73, label %75, label %24
75: ; preds = %70, %6
ret void
}