#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 */
int M_PI;
double M_PI_2;
scalar_t__ M_PI_4;
double __intersects_no_norm(double, double, double, double, double, double,
                            double, double, double *, double *);
double atan(int /*<<< orphan*/);
int /*<<< orphan*/ exp(double);
int fabs(double);
double fmax(double, double);
double hypot(double, double);
double log(int /*<<< orphan*/);
double ortho_distance(double, double, double, double);
int /*<<< orphan*/ tan(scalar_t__);
double distance_to_line_ratio_xing(double latitude, double longitude,
                                   double latitude_a, double longitude_a,
                                   double latitude_b, double longitude_b,
                                   double *x_latitude, double *x_longitude,
                                   double *ab_ratio) {
  double dist_a, dist_b, max_dist, ab_dist, t_dist;
  double ortho_a, ortho_b;
  double t_latitude;
  double longitude_x, latitude_x, intersect;
  double longitude_y, latitude_y;
  double xing_latitude, xing_longitude;
  ortho_a = ortho_distance(latitude, longitude, latitude_a, longitude_a);
  ortho_b = ortho_distance(latitude, longitude, latitude_b, longitude_b);
  t_latitude = (log(tan(M_PI_4 + (latitude / 2.0))));
  latitude_a = (log(tan(M_PI_4 + (latitude_a / 2.0))));
  latitude_b = (log(tan(M_PI_4 + (latitude_b / 2.0))));
  if (fabs(longitude_a - longitude_b) > M_PI) {
    if (longitude_a > longitude_b) {
      if (longitude_a > 0.0) {
        longitude_a -= M_PI * 2;
      } else {
        longitude_b += M_PI * 2;
      }
    } else {
      if (longitude_b > 0.0) {
        longitude_b -= M_PI * 2;
      } else {
        longitude_a += M_PI * 2;
      }
    }
  }
  if ((fabs(longitude - longitude_a) > M_PI) &&
      (fabs(longitude - longitude_b) > M_PI)) {
    if (longitude < longitude_a) {
      longitude += M_PI * 2;
    } else {
      longitude -= M_PI * 2;
    }
  }
  dist_a = (hypot((t_latitude - latitude_a), (longitude - longitude_a)));
  dist_b = (hypot((t_latitude - latitude_b), (longitude - longitude_b)));
  ab_dist = (hypot((latitude_a - latitude_b), (longitude_a - longitude_b)));
  max_dist = fmax(dist_a, dist_b);
  latitude_x = t_latitude + (longitude_a - longitude_b) * max_dist / ab_dist;
  longitude_x = longitude + (latitude_b - latitude_a) * max_dist / ab_dist;
  latitude_y = t_latitude + (longitude_b - longitude_a) * max_dist / ab_dist;
  longitude_y = longitude + (latitude_a - latitude_b) * max_dist / ab_dist;
  intersect = __intersects_no_norm(
      latitude_a, longitude_a, latitude_b, longitude_b, latitude_y, longitude_y,
      latitude_x, longitude_x, &xing_latitude, &xing_longitude);
  if (intersect >= 0.0 && intersect <= 1.0) {
    *x_latitude = ((2.0 * atan(exp(xing_latitude)) - M_PI_2));
    *x_longitude = xing_longitude;
    t_dist = ortho_distance(latitude, longitude, *x_latitude, *x_longitude);
    if (t_dist < ortho_a && t_dist < ortho_b) {
      *ab_ratio = intersect;
      return t_dist;
    }
  }
  if (ortho_a < ortho_b) {
    *x_latitude = ((2.0 * atan(exp(latitude_a)) - M_PI_2));
    *x_longitude = longitude_a;
    *ab_ratio = -1.0;
    return ortho_a;
  }
  *x_latitude = ((2.0 * atan(exp(latitude_b)) - M_PI_2));
  *x_longitude = longitude_b;
  *ab_ratio = -2.0;
  return ortho_b;
}


x86 assembly (clang, -O0):
<distance_to_line_ratio_xing>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%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)
mov    %rdi,-0x40(%rbp)
mov    %rsi,-0x48(%rbp)
mov    %rdx,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
call   10a0 <ortho_distance@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
call   10a0 <ortho_distance@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x2de5(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xdf3(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <tan@plt>
mov    %eax,%edi
call   1090 <log@plt>
movsd  %xmm0,-0x90(%rbp)
ff
mov    0x2dab(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xdb9(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <tan@plt>
mov    %eax,%edi
call   1090 <log@plt>
movsd  %xmm0,-0x20(%rbp)
mov    0x2d74(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xd82(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <tan@plt>
mov    %eax,%edi
call   1090 <log@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2d36(%rip),%rcx
cmp    (%rcx),%eax
jle    1377 <distance_to_line_ratio_xing+0x1f7>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    131e <distance_to_line_ratio_xing+0x19e>
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12ff <distance_to_line_ratio_xing+0x17f>
mov    0x2d05(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1319 <distance_to_line_ratio_xing+0x199>
mov    0x2ce2(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1372 <distance_to_line_ratio_xing+0x1f2>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1353 <distance_to_line_ratio_xing+0x1d3>
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    136d <distance_to_line_ratio_xing+0x1ed>
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1372 <distance_to_line_ratio_xing+0x1f2>
jmp    1377 <distance_to_line_ratio_xing+0x1f7>
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2c5b(%rip),%rcx
cmp    (%rcx),%eax
jle    1409 <distance_to_line_ratio_xing+0x289>
movsd  -0x18(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2c3d(%rip),%rcx
cmp    (%rcx),%eax
jle    1409 <distance_to_line_ratio_xing+0x289>
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13e6 <distance_to_line_ratio_xing+0x266>
mov    0x2c1a(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1404 <distance_to_line_ratio_xing+0x284>
mov    0x2bfb(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1409 <distance_to_line_ratio_xing+0x289>
movsd  -0x90(%rbp),%xmm0
ff
subsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
call   1060 <hypot@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
subsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
call   1060 <hypot@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
call   1060 <hypot@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x28(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x38(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
movsd  -0xb8(%rbp),%xmm4
ff
movsd  -0xb0(%rbp),%xmm5
ff
movsd  -0xa0(%rbp),%xmm6
ff
movsd  -0x98(%rbp),%xmm7
ff
lea    -0xc0(%rbp),%rdi
lea    -0xc8(%rbp),%rsi
call   1050 <__intersects_no_norm@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1673 <distance_to_line_ratio_xing+0x4f3>
movsd  0xa6c(%rip),%xmm0
ucomisd -0xa8(%rbp),%xmm0
ff
jb     1673 <distance_to_line_ratio_xing+0x4f3>
movsd  -0xc0(%rbp),%xmm0
ff
call   1070 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
mov    0x2a13(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm3
call   10a0 <ortho_distance@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    166e <distance_to_line_ratio_xing+0x4ee>
movsd  -0x78(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    166e <distance_to_line_ratio_xing+0x4ee>
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1766 <distance_to_line_ratio_xing+0x5e6>
jmp    1673 <distance_to_line_ratio_xing+0x4f3>
movsd  -0x80(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    16f9 <distance_to_line_ratio_xing+0x579>
movsd  -0x20(%rbp),%xmm0
call   1070 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
mov    0x2936(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x50(%rbp),%rax
movsd  0x932(%rip),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1766 <distance_to_line_ratio_xing+0x5e6>
movsd  -0x30(%rbp),%xmm0
call   1070 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
mov    0x28c7(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x50(%rbp),%rax
movsd  0x8bb(%rip),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance_to_line_ratio_xing>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
movsd  %xmm5,0x8(%rsp)
movsd  %xmm4,0x20(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x38(%rsp)
call   10a0 <ortho_distance@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x38(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
call   10a0 <ortho_distance@plt>
movsd  %xmm0,0x40(%rsp)
mov    0x2df2(%rip),%rbx
xorps  %xmm0,%xmm0
cvtsi2sdq (%rbx),%xmm0
movsd  0x38(%rsp),%xmm1
mulsd  0xdfc(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1080 <tan@plt>
mov    %eax,%edi
call   1090 <log@plt>
movsd  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdq (%rbx),%xmm0
movsd  0x28(%rsp),%xmm1
mulsd  0xdcb(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1080 <tan@plt>
mov    %eax,%edi
call   1090 <log@plt>
movsd  %xmm0,0x28(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdq (%rbx),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0xd9a(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1080 <tan@plt>
mov    %eax,%edi
call   1090 <log@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
mov    0x2d4f(%rip),%rbx
mov    (%rbx),%ecx
cmp    %ecx,%eax
jle    12cf <distance_to_line_ratio_xing+0x14f>
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
add    %ecx,%ecx
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm1
jbe    12dc <distance_to_line_ratio_xing+0x15c>
ucomisd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  (%rsp),%xmm3
jbe    12fa <distance_to_line_ratio_xing+0x17a>
subsd  %xmm0,%xmm1
jmp    130a <distance_to_line_ratio_xing+0x18a>
movsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm3
jmp    130a <distance_to_line_ratio_xing+0x18a>
ucomisd %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  (%rsp),%xmm3
jbe    1306 <distance_to_line_ratio_xing+0x186>
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
jmp    130a <distance_to_line_ratio_xing+0x18a>
addsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
jmp    130a <distance_to_line_ratio_xing+0x18a>
addsd  %xmm0,%xmm1
movapd %xmm3,%xmm0
movsd  %xmm1,0x10(%rsp)
subsd  %xmm1,%xmm0
call   1030 <fabs@plt>
cmp    (%rbx),%eax
jle    135b <distance_to_line_ratio_xing+0x1db>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
mov    (%rbx),%ecx
cmp    %ecx,%eax
jle    135b <distance_to_line_ratio_xing+0x1db>
add    %ecx,%ecx
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm2
ucomisd %xmm2,%xmm0
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
jbe    15ac <distance_to_line_ratio_xing+0x42c>
addsd  %xmm0,%xmm2
jmp    1360 <distance_to_line_ratio_xing+0x1e0>
movsd  (%rsp),%xmm2
movsd  %xmm2,(%rsp)
movsd  0x18(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
movapd %xmm2,%xmm1
subsd  0x10(%rsp),%xmm1
call   1060 <hypot@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x18(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
movsd  (%rsp),%xmm1
subsd  0x8(%rsp),%xmm1
call   1060 <hypot@plt>
movapd %xmm0,0x70(%rsp)
movsd  0x28(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp)
movsd  0x10(%rsp),%xmm1
subsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x48(%rsp)
call   1060 <hypot@plt>
movsd  0x50(%rsp),%xmm2
movapd %xmm2,%xmm5
cmpunordsd %xmm2,%xmm5
movapd %xmm5,%xmm1
movapd 0x70(%rsp),%xmm3
andpd  %xmm3,%xmm1
maxsd  %xmm2,%xmm3
andnpd %xmm3,%xmm5
orpd   %xmm1,%xmm5
movsd  0x48(%rsp),%xmm6
mulsd  %xmm5,%xmm6
divsd  %xmm0,%xmm6
movsd  0x18(%rsp),%xmm9
addsd  %xmm9,%xmm6
movsd  0x20(%rsp),%xmm2
movapd %xmm2,%xmm7
movsd  0x28(%rsp),%xmm8
subsd  %xmm8,%xmm7
mulsd  %xmm5,%xmm7
divsd  %xmm0,%xmm7
movsd  (%rsp),%xmm10
addsd  %xmm10,%xmm7
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm4
movsd  0x10(%rsp),%xmm1
subsd  %xmm1,%xmm4
mulsd  %xmm5,%xmm4
divsd  %xmm0,%xmm4
addsd  %xmm9,%xmm4
mulsd  0x58(%rsp),%xmm5
divsd  %xmm0,%xmm5
addsd  %xmm10,%xmm5
lea    0x68(%rsp),%rdi
lea    0x60(%rsp),%rsi
movapd %xmm8,%xmm0
call   1050 <__intersects_no_norm@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     150d <distance_to_line_ratio_xing+0x38d>
movsd  0xb71(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     150d <distance_to_line_ratio_xing+0x38d>
movsd  0x68(%rsp),%xmm0
movsd  %xmm1,0x18(%rsp)
call   1070 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
mov    0x2b1c(%rip),%rax
addsd  %xmm0,%xmm0
subsd  (%rax),%xmm0
movsd  %xmm0,(%r12)
movsd  0x60(%rsp),%xmm3
movsd  %xmm3,(%r15)
movsd  (%r12),%xmm2
movsd  0x38(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   10a0 <ortho_distance@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x30(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    150d <distance_to_line_ratio_xing+0x38d>
movsd  0x40(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     1598 <distance_to_line_ratio_xing+0x418>
xor    %eax,%eax
movsd  0x30(%rsp),%xmm0
movsd  0x40(%rsp),%xmm2
ucomisd %xmm0,%xmm2
seta   %cl
ja     153c <distance_to_line_ratio_xing+0x3bc>
movsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %cl,%al
lea    0xacb(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
movsd  %xmm1,0x18(%rsp)
minsd  %xmm2,%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm0
call   1070 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
movsd  0x18(%rsp),%xmm2
mov    0x2a5f(%rip),%rax
addsd  %xmm0,%xmm0
subsd  (%rax),%xmm0
movsd  %xmm0,(%r12)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x30(%rsp),%xmm0
movsd  %xmm2,(%r14)
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
subsd  %xmm0,%xmm2
jmp    1360 <distance_to_line_ratio_xing+0x1e0>

LLVM IR (-O0):
@M_PI_4 = global i64 0
@M_PI = global i32 0
@M_PI_2 = global double 0.000000e+00
define double @distance_to_line_ratio_xing(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7, double* %8) {
%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 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 double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
%35 = load double, double* %11
%36 = load double, double* %12
%37 = load double, double* %13
%38 = load double, double* %14
%39 = call double @ortho_distance(double %35, double %36, double %37, double %38)
store double %39, double* %25
%40 = load double, double* %11
%41 = load double, double* %12
%42 = load double, double* %15
%43 = load double, double* %16
%44 = call double @ortho_distance(double %40, double %41, double %42, double %43)
store double %44, double* %26
%45 = load i64, i64* @M_PI_4
%46 = sitofp i64 %45 to double
%47 = load double, double* %11
%48 = fdiv double %47, 2.000000e+00
%49 = fadd double %46, %48
%50 = fptosi double %49 to i64
%51 = call i32 @tan(i64 %50)
%52 = call double @log(i32 %51)
store double %52, double* %27
%53 = load i64, i64* @M_PI_4
%54 = sitofp i64 %53 to double
%55 = load double, double* %13
%56 = fdiv double %55, 2.000000e+00
%57 = fadd double %54, %56
%58 = fptosi double %57 to i64
%59 = call i32 @tan(i64 %58)
%60 = call double @log(i32 %59)
store double %60, double* %13
%61 = load i64, i64* @M_PI_4
%62 = sitofp i64 %61 to double
%63 = load double, double* %15
%64 = fdiv double %63, 2.000000e+00
%65 = fadd double %62, %64
%66 = fptosi double %65 to i64
%67 = call i32 @tan(i64 %66)
%68 = call double @log(i32 %67)
store double %68, double* %15
%69 = load double, double* %14
%70 = load double, double* %16
%71 = fsub double %69, %70
%72 = call i32 @fabs(double %71)
%73 = load i32, i32* @M_PI
%74 = icmp sgt i32 %72, %73
br i1 %74, label %75, label %112
75: ; preds = %9
%76 = load double, double* %14
%77 = load double, double* %16
%78 = fcmp ogt double %76, %77
br i1 %78, label %79, label %95
79: ; preds = %75
%80 = load double, double* %14
%81 = fcmp ogt double %80, 0.000000e+00
br i1 %81, label %82, label %88
82: ; preds = %79
%83 = load i32, i32* @M_PI
%84 = mul nsw i32 %83, 2
%85 = sitofp i32 %84 to double
%86 = load double, double* %14
%87 = fsub double %86, %85
store double %87, double* %14
br label %94
88: ; preds = %79
%89 = load i32, i32* @M_PI
%90 = mul nsw i32 %89, 2
%91 = sitofp i32 %90 to double
%92 = load double, double* %16
%93 = fadd double %92, %91
store double %93, double* %16
br label %94
94: ; preds = %88, %82
br label %111
95: ; preds = %75
%96 = load double, double* %16
%97 = fcmp ogt double %96, 0.000000e+00
br i1 %97, label %98, label %104
98: ; preds = %95
%99 = load i32, i32* @M_PI
%100 = mul nsw i32 %99, 2
%101 = sitofp i32 %100 to double
%102 = load double, double* %16
%103 = fsub double %102, %101
store double %103, double* %16
br label %110
104: ; preds = %95
%105 = load i32, i32* @M_PI
%106 = mul nsw i32 %105, 2
%107 = sitofp i32 %106 to double
%108 = load double, double* %14
%109 = fadd double %108, %107
store double %109, double* %14
br label %110
110: ; preds = %104, %98
br label %111
111: ; preds = %110, %94
br label %112
112: ; preds = %111, %9
%113 = load double, double* %12
%114 = load double, double* %14
%115 = fsub double %113, %114
%116 = call i32 @fabs(double %115)
%117 = load i32, i32* @M_PI
%118 = icmp sgt i32 %116, %117
br i1 %118, label %119, label %143
119: ; preds = %112
%120 = load double, double* %12
%121 = load double, double* %16
%122 = fsub double %120, %121
%123 = call i32 @fabs(double %122)
%124 = load i32, i32* @M_PI
%125 = icmp sgt i32 %123, %124
br i1 %125, label %126, label %143
126: ; preds = %119
%127 = load double, double* %12
%128 = load double, double* %14
%129 = fcmp olt double %127, %128
br i1 %129, label %130, label %136
130: ; preds = %126
%131 = load i32, i32* @M_PI
%132 = mul nsw i32 %131, 2
%133 = sitofp i32 %132 to double
%134 = load double, double* %12
%135 = fadd double %134, %133
store double %135, double* %12
br label %142
136: ; preds = %126
%137 = load i32, i32* @M_PI
%138 = mul nsw i32 %137, 2
%139 = sitofp i32 %138 to double
%140 = load double, double* %12
%141 = fsub double %140, %139
store double %141, double* %12
br label %142
142: ; preds = %136, %130
br label %143
143: ; preds = %142, %119, %112
%144 = load double, double* %27
%145 = load double, double* %13
%146 = fsub double %144, %145
%147 = load double, double* %12
%148 = load double, double* %14
%149 = fsub double %147, %148
%150 = call double @hypot(double %146, double %149)
store double %150, double* %20
%151 = load double, double* %27
%152 = load double, double* %15
%153 = fsub double %151, %152
%154 = load double, double* %12
%155 = load double, double* %16
%156 = fsub double %154, %155
%157 = call double @hypot(double %153, double %156)
store double %157, double* %21
%158 = load double, double* %13
%159 = load double, double* %15
%160 = fsub double %158, %159
%161 = load double, double* %14
%162 = load double, double* %16
%163 = fsub double %161, %162
%164 = call double @hypot(double %160, double %163)
store double %164, double* %23
%165 = load double, double* %20
%166 = load double, double* %21
%167 = call double @llvm.maxnum.f64(double %165, double %166)
store double %167, double* %22
%168 = load double, double* %27
%169 = load double, double* %14
%170 = load double, double* %16
%171 = fsub double %169, %170
%172 = load double, double* %22
%173 = fmul double %171, %172
%174 = load double, double* %23
%175 = fdiv double %173, %174
%176 = fadd double %168, %175
store double %176, double* %29
%177 = load double, double* %12
%178 = load double, double* %15
%179 = load double, double* %13
%180 = fsub double %178, %179
%181 = load double, double* %22
%182 = fmul double %180, %181
%183 = load double, double* %23
%184 = fdiv double %182, %183
%185 = fadd double %177, %184
store double %185, double* %28
%186 = load double, double* %27
%187 = load double, double* %16
%188 = load double, double* %14
%189 = fsub double %187, %188
%190 = load double, double* %22
%191 = fmul double %189, %190
%192 = load double, double* %23
%193 = fdiv double %191, %192
%194 = fadd double %186, %193
store double %194, double* %32
%195 = load double, double* %12
%196 = load double, double* %13
%197 = load double, double* %15
%198 = fsub double %196, %197
%199 = load double, double* %22
%200 = fmul double %198, %199
%201 = load double, double* %23
%202 = fdiv double %200, %201
%203 = fadd double %195, %202
store double %203, double* %31
%204 = load double, double* %13
%205 = load double, double* %14
%206 = load double, double* %15
%207 = load double, double* %16
%208 = load double, double* %32
%209 = load double, double* %31
%210 = load double, double* %29
%211 = load double, double* %28
%212 = call double @__intersects_no_norm(double %204, double %205, double %206, double %207, double %208, double %209, double %210, double %211, double* %33, double* %34)
store double %212, double* %30
%213 = load double, double* %30
%214 = fcmp oge double %213, 0.000000e+00
br i1 %214, label %215, label %247
215: ; preds = %143
%216 = load double, double* %30
%217 = fcmp ole double %216, 1.000000e+00
br i1 %217, label %218, label %247
218: ; preds = %215
%219 = load double, double* %33
%220 = call i32 @exp(double %219)
%221 = call double @atan(i32 %220)
%222 = load double, double* @M_PI_2
%223 = fneg double %222
%224 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %221, double %223)
%225 = load double*, double** %17
store double %224, double* %225
%226 = load double, double* %34
%227 = load double*, double** %18
store double %226, double* %227
%228 = load double, double* %11
%229 = load double, double* %12
%230 = load double*, double** %17
%231 = load double, double* %230
%232 = load double*, double** %18
%233 = load double, double* %232
%234 = call double @ortho_distance(double %228, double %229, double %231, double %233)
store double %234, double* %24
%235 = load double, double* %24
%236 = load double, double* %25
%237 = fcmp olt double %235, %236
br i1 %237, label %238, label %246
238: ; preds = %218
%239 = load double, double* %24
%240 = load double, double* %26
%241 = fcmp olt double %239, %240
br i1 %241, label %242, label %246
242: ; preds = %238
%243 = load double, double* %30
%244 = load double*, double** %19
store double %243, double* %244
%245 = load double, double* %24
store double %245, double* %10
br label %275
246: ; preds = %238, %218
br label %247
247: ; preds = %246, %215, %143
%248 = load double, double* %25
%249 = load double, double* %26
%250 = fcmp olt double %248, %249
br i1 %250, label %251, label %263
251: ; preds = %247
%252 = load double, double* %13
%253 = call i32 @exp(double %252)
%254 = call double @atan(i32 %253)
%255 = load double, double* @M_PI_2
%256 = fneg double %255
%257 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %254, double %256)
%258 = load double*, double** %17
store double %257, double* %258
%259 = load double, double* %14
%260 = load double*, double** %18
store double %259, double* %260
%261 = load double*, double** %19
store double -1.000000e+00, double* %261
%262 = load double, double* %25
store double %262, double* %10
br label %275
263: ; preds = %247
%264 = load double, double* %15
%265 = call i32 @exp(double %264)
%266 = call double @atan(i32 %265)
%267 = load double, double* @M_PI_2
%268 = fneg double %267
%269 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %266, double %268)
%270 = load double*, double** %17
store double %269, double* %270
%271 = load double, double* %16
%272 = load double*, double** %18
store double %271, double* %272
%273 = load double*, double** %19
store double -2.000000e+00, double* %273
%274 = load double, double* %26
store double %274, double* %10
br label %275
275: ; preds = %263, %251, %242
%276 = load double, double* %10
ret double %276
}

LLVM IR (-O2):
@M_PI_4 = global i64 0
@M_PI = global i32 0
@M_PI_2 = global double 0.000000e+00
define double @distance_to_line_ratio_xing(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture %6, double* nocapture writeonly %7, double* nocapture writeonly %8) {
%10 = alloca double
%11 = alloca double
%12 = bitcast double* %10 to i8*
%13 = bitcast double* %11 to i8*
%14 = tail call double @ortho_distance(double %0, double %1, double %2, double %3)
%15 = tail call double @ortho_distance(double %0, double %1, double %4, double %5)
%16 = load i64, i64* @M_PI_4
%17 = sitofp i64 %16 to double
%18 = fmul double %0, 5.000000e-01
%19 = fadd double %18, %17
%20 = fptosi double %19 to i64
%21 = tail call i32 @tan(i64 %20)
%22 = tail call double @log(i32 %21)
%23 = load i64, i64* @M_PI_4
%24 = sitofp i64 %23 to double
%25 = fmul double %2, 5.000000e-01
%26 = fadd double %25, %24
%27 = fptosi double %26 to i64
%28 = tail call i32 @tan(i64 %27)
%29 = tail call double @log(i32 %28)
%30 = load i64, i64* @M_PI_4
%31 = sitofp i64 %30 to double
%32 = fmul double %4, 5.000000e-01
%33 = fadd double %32, %31
%34 = fptosi double %33 to i64
%35 = tail call i32 @tan(i64 %34)
%36 = tail call double @log(i32 %35)
%37 = fsub double %3, %5
%38 = tail call i32 @fabs(double %37)
%39 = load i32, i32* @M_PI
%40 = icmp sgt i32 %38, %39
br i1 %40, label %41, label %59
41: ; preds = %9
%42 = fcmp ogt double %3, %5
br i1 %42, label %43, label %51
43: ; preds = %41
%44 = fcmp ogt double %3, 0.000000e+00
%45 = shl nsw i32 %39, 1
%46 = sitofp i32 %45 to double
br i1 %44, label %47, label %49
47: ; preds = %43
%48 = fsub double %3, %46
br label %59
49: ; preds = %43
%50 = fadd double %46, %5
br label %59
51: ; preds = %41
%52 = fcmp ogt double %5, 0.000000e+00
%53 = shl nsw i32 %39, 1
%54 = sitofp i32 %53 to double
br i1 %52, label %55, label %57
55: ; preds = %51
%56 = fsub double %5, %54
br label %59
57: ; preds = %51
%58 = fadd double %54, %3
br label %59
59: ; preds = %49, %47, %57, %55, %9
%60 = phi double [ %5, %47 ], [ %50, %49 ], [ %56, %55 ], [ %5, %57 ], [ %5, %9 ]
%61 = phi double [ %48, %47 ], [ %3, %49 ], [ %3, %55 ], [ %58, %57 ], [ %3, %9 ]
%62 = fsub double %1, %61
%63 = tail call i32 @fabs(double %62)
%64 = load i32, i32* @M_PI
%65 = icmp sgt i32 %63, %64
br i1 %65, label %66, label %79
66: ; preds = %59
%67 = fsub double %1, %60
%68 = tail call i32 @fabs(double %67)
%69 = load i32, i32* @M_PI
%70 = icmp sgt i32 %68, %69
br i1 %70, label %71, label %79
71: ; preds = %66
%72 = fcmp ogt double %61, %1
%73 = shl nsw i32 %69, 1
%74 = sitofp i32 %73 to double
br i1 %72, label %75, label %77
75: ; preds = %71
%76 = fadd double %74, %1
br label %79
77: ; preds = %71
%78 = fsub double %1, %74
br label %79
79: ; preds = %75, %77, %66, %59
%80 = phi double [ %76, %75 ], [ %78, %77 ], [ %1, %66 ], [ %1, %59 ]
%81 = fsub double %22, %29
%82 = fsub double %80, %61
%83 = tail call double @hypot(double %81, double %82)
%84 = fsub double %22, %36
%85 = fsub double %80, %60
%86 = tail call double @hypot(double %84, double %85)
%87 = fsub double %29, %36
%88 = fsub double %61, %60
%89 = tail call double @hypot(double %87, double %88)
%90 = tail call double @llvm.maxnum.f64(double %83, double %86)
%91 = fmul double %88, %90
%92 = fdiv double %91, %89
%93 = fadd double %22, %92
%94 = fsub double %36, %29
%95 = fmul double %94, %90
%96 = fdiv double %95, %89
%97 = fadd double %80, %96
%98 = fsub double %60, %61
%99 = fmul double %98, %90
%100 = fdiv double %99, %89
%101 = fadd double %22, %100
%102 = fmul double %87, %90
%103 = fdiv double %102, %89
%104 = fadd double %80, %103
%105 = call double @__intersects_no_norm(double %29, double %61, double %36, double %60, double %101, double %104, double %93, double %97, double* %10, double* %11)
%106 = fcmp oge double %105, 0.000000e+00
%107 = fcmp ole double %105, 1.000000e+00
%108 = and i1 %106, %107
br i1 %108, label %109, label %122
109: ; preds = %79
%110 = load double, double* %10
%111 = call i32 @exp(double %110)
%112 = call double @atan(i32 %111)
%113 = load double, double* @M_PI_2
%114 = fneg double %113
%115 = call double @llvm.fmuladd.f64(double %112, double 2.000000e+00, double %114)
store double %115, double* %6
%116 = load double, double* %11
store double %116, double* %7
%117 = load double, double* %6
%118 = call double @ortho_distance(double %0, double %80, double %117, double %116)
%119 = fcmp olt double %118, %14
%120 = fcmp olt double %118, %15
%121 = select i1 %119, i1 %120, i1 false
br i1 %121, label %133, label %122
122: ; preds = %109, %79
%123 = fcmp olt double %14, %15
%124 = select i1 %123, double %29, double %36
%125 = select i1 %123, double %61, double %60
%126 = select i1 %123, double -1.000000e+00, double -2.000000e+00
%127 = select i1 %123, double %14, double %15
%128 = call i32 @exp(double %124)
%129 = call double @atan(i32 %128)
%130 = load double, double* @M_PI_2
%131 = fneg double %130
%132 = call double @llvm.fmuladd.f64(double %129, double 2.000000e+00, double %131)
store double %132, double* %6
store double %125, double* %7
br label %133
133: ; preds = %122, %109
%134 = phi double [ %105, %109 ], [ %126, %122 ]
%135 = phi double [ %118, %109 ], [ %127, %122 ]
store double %134, double* %8
ret double %135
}