double __intersects_no_norm(double latitude, double longitude,
                            double new_latitude, double new_longitude,
                            double seg_a_latitude, double seg_a_longitude,
                            double seg_b_latitude, double seg_b_longitude,
                            double *inter_latitude, double *inter_longitude) {
  double x, y, x1, x2, t, t_seg, d;
  x1 = (new_longitude - longitude);
  x2 = (seg_b_longitude - seg_a_longitude);
  d = ((seg_b_latitude - seg_a_latitude) * x1 - x2 * (new_latitude - latitude));
  if (d == 0.0) {
    return -1;
  }
  x = (longitude - seg_a_longitude);
  y = (latitude - seg_a_latitude);
  t = (x2 * y - (seg_b_latitude - seg_a_latitude) * x) / d;
  if (t < 0.0 || t > 1.0) {
    return -1;
  }
  t_seg = (x1 * y - (new_latitude - latitude) * x) / d;
  if (t_seg >= 0.0 && t_seg <= 1.0) {
    *inter_longitude = longitude + t * (new_longitude - longitude);
    *inter_latitude = latitude + t * (new_latitude - latitude);
    return t;
  }
  return -1;
}


x86 assembly (clang, -O0):
<__intersects_no_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
mov    %rdi,-0x50(%rbp)
mov    %rsi,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
subsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11cc <__intersects_no_norm+0xcc>
jp     11cc <__intersects_no_norm+0xcc>
movsd  0xe46(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    133d <__intersects_no_norm+0x23d>
movsd  -0x18(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x80(%rbp),%xmm0
ja     1254 <__intersects_no_norm+0x154>
movsd  -0x80(%rbp),%xmm0
movsd  0xdb6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1266 <__intersects_no_norm+0x166>
movsd  0xdac(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    133d <__intersects_no_norm+0x23d>
movsd  -0x70(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1330 <__intersects_no_norm+0x230>
movsd  0xd35(%rip),%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jb     1330 <__intersects_no_norm+0x230>
movsd  -0x18(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    133d <__intersects_no_norm+0x23d>
movsd  0xcd0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__intersects_no_norm>:
subsd  %xmm1,%xmm3
subsd  %xmm5,%xmm7
subsd  %xmm4,%xmm6
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm8
mulsd  %xmm7,%xmm8
movapd %xmm6,%xmm9
mulsd  %xmm3,%xmm9
subsd  %xmm8,%xmm9
movsd  0xece(%rip),%xmm8
xorpd  %xmm11,%xmm11
ucomisd %xmm11,%xmm9
jne    1145 <__intersects_no_norm+0x45>
jp     1145 <__intersects_no_norm+0x45>
movaps %xmm8,%xmm0
ret
movapd %xmm1,%xmm10
subsd  %xmm5,%xmm10
movapd %xmm0,%xmm5
subsd  %xmm4,%xmm5
mulsd  %xmm10,%xmm6
mulsd  %xmm5,%xmm7
subsd  %xmm6,%xmm7
divsd  %xmm9,%xmm7
ucomisd %xmm7,%xmm11
ja     1140 <__intersects_no_norm+0x40>
ucomisd 0xe90(%rip),%xmm7
ja     1140 <__intersects_no_norm+0x40>
mulsd  %xmm2,%xmm10
mulsd  %xmm3,%xmm5
subsd  %xmm10,%xmm5
divsd  %xmm9,%xmm5
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm5
jb     1140 <__intersects_no_norm+0x40>
movsd  0xe69(%rip),%xmm4
ucomisd %xmm5,%xmm4
jb     1140 <__intersects_no_norm+0x40>
mulsd  %xmm7,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,(%rsi)
mulsd  %xmm7,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdi)
movapd %xmm7,%xmm8
movapd %xmm8,%xmm0
ret

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

LLVM IR (-O2):
define double @__intersects_no_norm(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double* nocapture writeonly %8, double* nocapture writeonly %9) {
%11 = fsub double %3, %1
%12 = fsub double %7, %5
%13 = fsub double %6, %4
%14 = fsub double %2, %0
%15 = fneg double %12
%16 = fmul double %14, %15
%17 = tail call double @llvm.fmuladd.f64(double %13, double %11, double %16)
%18 = fcmp oeq double %17, 0.000000e+00
br i1 %18, label %40, label %19
19: ; preds = %10
%20 = fsub double %1, %5
%21 = fsub double %0, %4
%22 = fneg double %13
%23 = fmul double %20, %22
%24 = tail call double @llvm.fmuladd.f64(double %12, double %21, double %23)
%25 = fdiv double %24, %17
%26 = fcmp olt double %25, 0.000000e+00
%27 = fcmp ogt double %25, 1.000000e+00
%28 = or i1 %26, %27
br i1 %28, label %40, label %29
29: ; preds = %19
%30 = fneg double %14
%31 = fmul double %20, %30
%32 = tail call double @llvm.fmuladd.f64(double %11, double %21, double %31)
%33 = fdiv double %32, %17
%34 = fcmp oge double %33, 0.000000e+00
%35 = fcmp ole double %33, 1.000000e+00
%36 = and i1 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %29
%38 = tail call double @llvm.fmuladd.f64(double %25, double %11, double %1)
store double %38, double* %9
%39 = tail call double @llvm.fmuladd.f64(double %25, double %14, double %0)
store double %39, double* %8
br label %40
40: ; preds = %29, %19, %10, %37
%41 = phi double [ %25, %37 ], [ -1.000000e+00, %10 ], [ -1.000000e+00, %19 ], [ -1.000000e+00, %29 ]
ret double %41
}