#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 atan(int /*<<< orphan*/);
int /*<<< orphan*/ exp(int);
int fabs(double);
double hypot(double, double);
int log(int /*<<< orphan*/);
double ortho_distance(double, double, double, double);
int /*<<< orphan*/ tan(scalar_t__);
double distance_to_line_dichotomy_xing(double latitude, double longitude,
                                       double latitude_a, double longitude_a,
                                       double latitude_b, double longitude_b,
                                       double *x_latitude,
                                       double *x_longitude) {
  double p1_latitude, p1_longitude, p2_latitude, p2_longitude;
  double ortho_p1, ortho_p2;
  double limit;
  limit = M_PI / (180 * 60 * 1852);
  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;
      }
    }
  }
  p1_latitude = latitude_a;
  p1_longitude = longitude_a;
  p2_latitude = latitude_b;
  p2_longitude = longitude_b;
  ortho_p1 = ortho_distance(latitude, longitude, p1_latitude, p1_longitude);
  ortho_p2 = ortho_distance(latitude, longitude, p2_latitude, p2_longitude);
  while ((hypot((p1_latitude - p2_latitude), (p1_longitude - p2_longitude))) >
         limit) {
    if (ortho_p1 < ortho_p2) {
      p2_longitude = (p1_longitude + p2_longitude) / 2;
      p2_latitude =
          ((2.0 * atan(exp(((log(tan(M_PI_4 + (p1_latitude / 2.0)))) +
                            (log(tan(M_PI_4 + (p2_latitude / 2.0))))) /
                           2)) -
            M_PI_2));
      ortho_p2 = ortho_distance(latitude, longitude, p2_latitude, p2_longitude);
    } else {
      p1_longitude = (p1_longitude + p2_longitude) / 2;
      p1_latitude =
          ((2.0 * atan(exp(((log(tan(M_PI_4 + (p1_latitude / 2.0)))) +
                            (log(tan(M_PI_4 + (p2_latitude / 2.0))))) /
                           2)) -
            M_PI_2));
      ortho_p1 = ortho_distance(latitude, longitude, p1_latitude, p1_longitude);
    }
  }
  if (ortho_p1 < ortho_p2) {
    *x_latitude = p1_latitude;
    *x_longitude = p1_longitude;
    return ortho_p1;
  }
  *x_latitude = p2_latitude;
  *x_longitude = p2_longitude;
  return ortho_p2;
}


x86 assembly (clang, -O0):
<distance_to_line_dichotomy_xing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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    0x2e40(%rip),%rax
mov    (%rax),%eax
mov    $0x1313340,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2e17(%rip),%rcx
cmp    (%rcx),%eax
jle    1296 <distance_to_line_dichotomy_xing+0x126>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    123d <distance_to_line_dichotomy_xing+0xcd>
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    121e <distance_to_line_dichotomy_xing+0xae>
mov    0x2de6(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1238 <distance_to_line_dichotomy_xing+0xc8>
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1291 <distance_to_line_dichotomy_xing+0x121>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1272 <distance_to_line_dichotomy_xing+0x102>
mov    0x2d92(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    128c <distance_to_line_dichotomy_xing+0x11c>
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1291 <distance_to_line_dichotomy_xing+0x121>
jmp    1296 <distance_to_line_dichotomy_xing+0x126>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
call   1090 <ortho_distance@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm3
call   1090 <ortho_distance@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
call   1050 <hypot@plt>
ucomisd -0x80(%rbp),%xmm0
jbe    1520 <distance_to_line_dichotomy_xing+0x3b0>
movsd  -0x70(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1429 <distance_to_line_dichotomy_xing+0x2b9>
movsd  -0x58(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  0xcbc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    0x2c8c(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xc9a(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <tan@plt>
mov    %eax,%edi
call   1080 <log@plt>
mov    %eax,-0x84(%rbp)
mov    0x2c54(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  0xc62(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <tan@plt>
mov    %eax,%edi
call   1080 <log@plt>
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
mov    0x2bfa(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm3
call   1090 <ortho_distance@plt>
movsd  %xmm0,-0x78(%rbp)
jmp    151b <distance_to_line_dichotomy_xing+0x3ab>
movsd  -0x58(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  0xbc5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    0x2b95(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xba3(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <tan@plt>
mov    %eax,%edi
call   1080 <log@plt>
mov    %eax,-0x88(%rbp)
mov    0x2b5d(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  0xb6b(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <tan@plt>
mov    %eax,%edi
call   1080 <log@plt>
mov    %eax,%ecx
mov    -0x88(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
mov    0x2b03(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
call   1090 <ortho_distance@plt>
movsd  %xmm0,-0x70(%rbp)
jmp    12fa <distance_to_line_dichotomy_xing+0x18a>
movsd  -0x70(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    155d <distance_to_line_dichotomy_xing+0x3ed>
movsd  -0x50(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1581 <distance_to_line_dichotomy_xing+0x411>
movsd  -0x60(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance_to_line_dichotomy_xing>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa0,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movapd %xmm4,0x60(%rsp)
movapd %xmm2,0x40(%rsp)
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x28(%rsp)
mov    0x2e44(%rip),%rbx
movslq (%rbx),%rax
imul   $0x1ad765e1,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x35,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x70(%rsp)
movsd  %xmm3,0x8(%rsp)
movapd %xmm3,%xmm0
movapd %xmm5,0x10(%rsp)
subsd  %xmm5,%xmm0
call   1030 <fabs@plt>
mov    (%rbx),%ecx
cmp    %ecx,%eax
jle    121e <distance_to_line_dichotomy_xing+0xae>
movapd 0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
add    %ecx,%ecx
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm3
jbe    1232 <distance_to_line_dichotomy_xing+0xc2>
ucomisd %xmm0,%xmm3
xorps  %xmm4,%xmm4
cvtsi2sd %ecx,%xmm4
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
jbe    1257 <distance_to_line_dichotomy_xing+0xe7>
subsd  %xmm4,%xmm3
jmp    1267 <distance_to_line_dichotomy_xing+0xf7>
movsd  0x8(%rsp),%xmm3
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
jmp    1267 <distance_to_line_dichotomy_xing+0xf7>
ucomisd %xmm0,%xmm2
xorps  %xmm4,%xmm4
cvtsi2sd %ecx,%xmm4
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
jbe    1263 <distance_to_line_dichotomy_xing+0xf3>
subsd  %xmm4,%xmm2
movapd %xmm2,0x10(%rsp)
jmp    1267 <distance_to_line_dichotomy_xing+0xf7>
addsd  %xmm4,%xmm2
movapd %xmm2,0x10(%rsp)
jmp    1267 <distance_to_line_dichotomy_xing+0xf7>
addsd  %xmm4,%xmm3
movaps 0x40(%rsp),%xmm2
movsd  %xmm3,0x8(%rsp)
call   1090 <ortho_distance@plt>
movaps %xmm0,0x80(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movaps 0x60(%rsp),%xmm2
movaps 0x10(%rsp),%xmm3
call   1090 <ortho_distance@plt>
movsd  %xmm0,0x58(%rsp)
movapd 0x40(%rsp),%xmm0
subsd  0x60(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  0x10(%rsp),%xmm1
call   1050 <hypot@plt>
ucomisd 0x70(%rsp),%xmm0
jbe    14b2 <distance_to_line_dichotomy_xing+0x342>
mov    0x2d10(%rip),%rbx
mov    0x2d01(%rip),%r12
movsd  0x8(%rsp),%xmm2
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm3
jmp    1379 <distance_to_line_dichotomy_xing+0x209>
xchg   %ax,%ax
movsd  %xmm6,0x38(%rsp)
movsd  %xmm0,0x78(%rsp)
cmpltsd %xmm0,%xmm5
andpd  %xmm5,%xmm1
andnpd 0x10(%rsp),%xmm5
orpd   %xmm1,%xmm5
movapd %xmm5,0x10(%rsp)
movapd %xmm3,%xmm0
subsd  %xmm4,%xmm0
movapd %xmm2,%xmm1
subsd  %xmm5,%xmm1
movsd  %xmm2,0x8(%rsp)
movapd %xmm3,0x40(%rsp)
movapd %xmm4,0x60(%rsp)
call   1050 <hypot@plt>
movapd 0x40(%rsp),%xmm3
movsd  0x8(%rsp),%xmm2
ucomisd 0x70(%rsp),%xmm0
movsd  0x78(%rsp),%xmm4
movsd  %xmm4,0x58(%rsp)
movsd  0x38(%rsp),%xmm1
movapd %xmm1,%xmm0
movapd %xmm1,0x80(%rsp)
movapd 0x10(%rsp),%xmm1
jbe    14d3 <distance_to_line_dichotomy_xing+0x363>
movapd %xmm3,0x40(%rsp)
movsd  %xmm2,0x8(%rsp)
movapd %xmm1,0x10(%rsp)
addsd  %xmm1,%xmm2
movsd  0xc69(%rip),%xmm4
mulsd  %xmm4,%xmm2
movapd %xmm2,0x90(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdq (%rbx),%xmm0
movapd %xmm3,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1070 <tan@plt>
mov    %eax,%edi
call   1080 <log@plt>
mov    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2sdq (%rbx),%xmm0
movapd 0x60(%rsp),%xmm1
mulsd  0xc1f(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1070 <tan@plt>
mov    %eax,%edi
call   1080 <log@plt>
add    %eax,%ebp
mov    %ebp,%edi
shr    $0x1f,%edi
add    %ebp,%edi
sar    %edi
call   1060 <exp@plt>
mov    %eax,%edi
call   1040 <atan@plt>
movapd %xmm0,%xmm2
addsd  %xmm0,%xmm2
subsd  (%r12),%xmm2
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  %xmm2,0x38(%rsp)
movaps 0x90(%rsp),%xmm3
call   1090 <ortho_distance@plt>
movaps %xmm0,%xmm6
movapd 0x80(%rsp),%xmm5
movsd  0x58(%rsp),%xmm0
ucomisd %xmm5,%xmm0
ja     1480 <distance_to_line_dichotomy_xing+0x310>
movsd  0x38(%rsp),%xmm3
movapd 0x90(%rsp),%xmm1
movapd %xmm1,%xmm2
movapd 0x60(%rsp),%xmm4
jbe    12f0 <distance_to_line_dichotomy_xing+0x180>
jmp    14a1 <distance_to_line_dichotomy_xing+0x331>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x38(%rsp),%xmm4
movsd  0x8(%rsp),%xmm2
movapd 0x40(%rsp),%xmm3
movapd 0x90(%rsp),%xmm1
jbe    12f0 <distance_to_line_dichotomy_xing+0x180>
movsd  %xmm5,0x38(%rsp)
movsd  %xmm6,0x78(%rsp)
jmp    12fc <distance_to_line_dichotomy_xing+0x18c>
movapd 0x80(%rsp),%xmm0
movsd  0x58(%rsp),%xmm4
movsd  0x8(%rsp),%xmm2
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm3
ucomisd %xmm0,%xmm4
movapd %xmm0,%xmm5
cmpltsd %xmm4,%xmm5
andpd  %xmm5,%xmm3
andnpd 0x60(%rsp),%xmm5
orpd   %xmm3,%xmm5
ja     14f4 <distance_to_line_dichotomy_xing+0x384>
movapd %xmm1,%xmm2
minsd  %xmm4,%xmm0
movlpd %xmm5,(%r15)
movsd  %xmm2,(%r14)
add    $0xa0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
@M_PI_4 = global i64 0
@M_PI_2 = global double 0.000000e+00
define double @distance_to_line_dichotomy_xing(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7) {
%9 = alloca double
%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
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 i32, i32* @M_PI
%26 = sdiv i32 %25, 20001600
%27 = sitofp i32 %26 to double
store double %27, double* %24
%28 = load double, double* %13
%29 = load double, double* %15
%30 = fsub double %28, %29
%31 = call i32 @fabs(double %30)
%32 = load i32, i32* @M_PI
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %71
34: ; preds = %8
%35 = load double, double* %13
%36 = load double, double* %15
%37 = fcmp ogt double %35, %36
br i1 %37, label %38, label %54
38: ; preds = %34
%39 = load double, double* %13
%40 = fcmp ogt double %39, 0.000000e+00
br i1 %40, label %41, label %47
41: ; preds = %38
%42 = load i32, i32* @M_PI
%43 = mul nsw i32 %42, 2
%44 = sitofp i32 %43 to double
%45 = load double, double* %13
%46 = fsub double %45, %44
store double %46, double* %13
br label %53
47: ; preds = %38
%48 = load i32, i32* @M_PI
%49 = mul nsw i32 %48, 2
%50 = sitofp i32 %49 to double
%51 = load double, double* %15
%52 = fadd double %51, %50
store double %52, double* %15
br label %53
53: ; preds = %47, %41
br label %70
54: ; preds = %34
%55 = load double, double* %15
%56 = fcmp ogt double %55, 0.000000e+00
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = load i32, i32* @M_PI
%59 = mul nsw i32 %58, 2
%60 = sitofp i32 %59 to double
%61 = load double, double* %15
%62 = fsub double %61, %60
store double %62, double* %15
br label %69
63: ; preds = %54
%64 = load i32, i32* @M_PI
%65 = mul nsw i32 %64, 2
%66 = sitofp i32 %65 to double
%67 = load double, double* %13
%68 = fadd double %67, %66
store double %68, double* %13
br label %69
69: ; preds = %63, %57
br label %70
70: ; preds = %69, %53
br label %71
71: ; preds = %70, %8
%72 = load double, double* %12
store double %72, double* %18
%73 = load double, double* %13
store double %73, double* %19
%74 = load double, double* %14
store double %74, double* %20
%75 = load double, double* %15
store double %75, double* %21
%76 = load double, double* %10
%77 = load double, double* %11
%78 = load double, double* %18
%79 = load double, double* %19
%80 = call double @ortho_distance(double %76, double %77, double %78, double %79)
store double %80, double* %22
%81 = load double, double* %10
%82 = load double, double* %11
%83 = load double, double* %20
%84 = load double, double* %21
%85 = call double @ortho_distance(double %81, double %82, double %83, double %84)
store double %85, double* %23
br label %86
86: ; preds = %166, %71
%87 = load double, double* %18
%88 = load double, double* %20
%89 = fsub double %87, %88
%90 = load double, double* %19
%91 = load double, double* %21
%92 = fsub double %90, %91
%93 = call double @hypot(double %89, double %92)
%94 = load double, double* %24
%95 = fcmp ogt double %93, %94
br i1 %95, label %96, label %167
96: ; preds = %86
%97 = load double, double* %22
%98 = load double, double* %23
%99 = fcmp olt double %97, %98
br i1 %99, label %100, label %133
100: ; preds = %96
%101 = load double, double* %19
%102 = load double, double* %21
%103 = fadd double %101, %102
%104 = fdiv double %103, 2.000000e+00
store double %104, double* %21
%105 = load i64, i64* @M_PI_4
%106 = sitofp i64 %105 to double
%107 = load double, double* %18
%108 = fdiv double %107, 2.000000e+00
%109 = fadd double %106, %108
%110 = fptosi double %109 to i64
%111 = call i32 @tan(i64 %110)
%112 = call i32 @log(i32 %111)
%113 = load i64, i64* @M_PI_4
%114 = sitofp i64 %113 to double
%115 = load double, double* %20
%116 = fdiv double %115, 2.000000e+00
%117 = fadd double %114, %116
%118 = fptosi double %117 to i64
%119 = call i32 @tan(i64 %118)
%120 = call i32 @log(i32 %119)
%121 = add nsw i32 %112, %120
%122 = sdiv i32 %121, 2
%123 = call i32 @exp(i32 %122)
%124 = call double @atan(i32 %123)
%125 = load double, double* @M_PI_2
%126 = fneg double %125
%127 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %124, double %126)
store double %127, double* %20
%128 = load double, double* %10
%129 = load double, double* %11
%130 = load double, double* %20
%131 = load double, double* %21
%132 = call double @ortho_distance(double %128, double %129, double %130, double %131)
store double %132, double* %23
br label %166
133: ; preds = %96
%134 = load double, double* %19
%135 = load double, double* %21
%136 = fadd double %134, %135
%137 = fdiv double %136, 2.000000e+00
store double %137, double* %19
%138 = load i64, i64* @M_PI_4
%139 = sitofp i64 %138 to double
%140 = load double, double* %18
%141 = fdiv double %140, 2.000000e+00
%142 = fadd double %139, %141
%143 = fptosi double %142 to i64
%144 = call i32 @tan(i64 %143)
%145 = call i32 @log(i32 %144)
%146 = load i64, i64* @M_PI_4
%147 = sitofp i64 %146 to double
%148 = load double, double* %20
%149 = fdiv double %148, 2.000000e+00
%150 = fadd double %147, %149
%151 = fptosi double %150 to i64
%152 = call i32 @tan(i64 %151)
%153 = call i32 @log(i32 %152)
%154 = add nsw i32 %145, %153
%155 = sdiv i32 %154, 2
%156 = call i32 @exp(i32 %155)
%157 = call double @atan(i32 %156)
%158 = load double, double* @M_PI_2
%159 = fneg double %158
%160 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %157, double %159)
store double %160, double* %18
%161 = load double, double* %10
%162 = load double, double* %11
%163 = load double, double* %18
%164 = load double, double* %19
%165 = call double @ortho_distance(double %161, double %162, double %163, double %164)
store double %165, double* %22
br label %166
166: ; preds = %133, %100
br label %86
167: ; preds = %86
%168 = load double, double* %22
%169 = load double, double* %23
%170 = fcmp olt double %168, %169
br i1 %170, label %171, label %177
171: ; preds = %167
%172 = load double, double* %18
%173 = load double*, double** %16
store double %172, double* %173
%174 = load double, double* %19
%175 = load double*, double** %17
store double %174, double* %175
%176 = load double, double* %22
store double %176, double* %9
br label %183
177: ; preds = %167
%178 = load double, double* %20
%179 = load double*, double** %16
store double %178, double* %179
%180 = load double, double* %21
%181 = load double*, double** %17
store double %180, double* %181
%182 = load double, double* %23
store double %182, double* %9
br label %183
183: ; preds = %177, %171
%184 = load double, double* %9
ret double %184
}

LLVM IR (-O2):
@M_PI = global i32 0
@M_PI_4 = global i64 0
@M_PI_2 = global double 0.000000e+00
define double @distance_to_line_dichotomy_xing(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6, double* nocapture writeonly %7) {
%9 = load i32, i32* @M_PI
%10 = sdiv i32 %9, 20001600
%11 = sitofp i32 %10 to double
%12 = fsub double %3, %5
%13 = tail call i32 @fabs(double %12)
%14 = load i32, i32* @M_PI
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %34
16: ; preds = %8
%17 = fcmp ogt double %3, %5
br i1 %17, label %18, label %26
18: ; preds = %16
%19 = fcmp ogt double %3, 0.000000e+00
%20 = shl nsw i32 %14, 1
%21 = sitofp i32 %20 to double
br i1 %19, label %22, label %24
22: ; preds = %18
%23 = fsub double %3, %21
br label %34
24: ; preds = %18
%25 = fadd double %21, %5
br label %34
26: ; preds = %16
%27 = fcmp ogt double %5, 0.000000e+00
%28 = shl nsw i32 %14, 1
%29 = sitofp i32 %28 to double
br i1 %27, label %30, label %32
30: ; preds = %26
%31 = fsub double %5, %29
br label %34
32: ; preds = %26
%33 = fadd double %29, %3
br label %34
34: ; preds = %24, %22, %32, %30, %8
%35 = phi double [ %5, %22 ], [ %25, %24 ], [ %31, %30 ], [ %5, %32 ], [ %5, %8 ]
%36 = phi double [ %23, %22 ], [ %3, %24 ], [ %3, %30 ], [ %33, %32 ], [ %3, %8 ]
%37 = tail call double @ortho_distance(double %0, double %1, double %2, double %36)
%38 = tail call double @ortho_distance(double %0, double %1, double %4, double %35)
%39 = fsub double %2, %4
%40 = fsub double %36, %35
%41 = tail call double @hypot(double %39, double %40)
%42 = fcmp ogt double %41, %11
br i1 %42, label %43, label %85
43: ; preds = %34, %43
%44 = phi double [ %80, %43 ], [ %38, %34 ]
%45 = phi double [ %79, %43 ], [ %37, %34 ]
%46 = phi double [ %78, %43 ], [ %35, %34 ]
%47 = phi double [ %77, %43 ], [ %4, %34 ]
%48 = phi double [ %76, %43 ], [ %36, %34 ]
%49 = phi double [ %75, %43 ], [ %2, %34 ]
%50 = fcmp olt double %45, %44
%51 = fadd double %48, %46
%52 = fmul double %51, 5.000000e-01
%53 = load i64, i64* @M_PI_4
%54 = sitofp i64 %53 to double
%55 = fmul double %49, 5.000000e-01
%56 = fadd double %55, %54
%57 = fptosi double %56 to i64
%58 = tail call i32 @tan(i64 %57)
%59 = tail call i32 @log(i32 %58)
%60 = load i64, i64* @M_PI_4
%61 = sitofp i64 %60 to double
%62 = fmul double %47, 5.000000e-01
%63 = fadd double %62, %61
%64 = fptosi double %63 to i64
%65 = tail call i32 @tan(i64 %64)
%66 = tail call i32 @log(i32 %65)
%67 = add nsw i32 %66, %59
%68 = sdiv i32 %67, 2
%69 = tail call i32 @exp(i32 %68)
%70 = tail call double @atan(i32 %69)
%71 = load double, double* @M_PI_2
%72 = fneg double %71
%73 = tail call double @llvm.fmuladd.f64(double %70, double 2.000000e+00, double %72)
%74 = tail call double @ortho_distance(double %0, double %1, double %73, double %52)
%75 = select i1 %50, double %49, double %73
%76 = select i1 %50, double %48, double %52
%77 = select i1 %50, double %73, double %47
%78 = select i1 %50, double %52, double %46
%79 = select i1 %50, double %45, double %74
%80 = select i1 %50, double %74, double %44
%81 = fsub double %75, %77
%82 = fsub double %76, %78
%83 = tail call double @hypot(double %81, double %82)
%84 = fcmp ogt double %83, %11
br i1 %84, label %43, label %85
85: ; preds = %43, %34
%86 = phi double [ %2, %34 ], [ %75, %43 ]
%87 = phi double [ %36, %34 ], [ %76, %43 ]
%88 = phi double [ %4, %34 ], [ %77, %43 ]
%89 = phi double [ %35, %34 ], [ %78, %43 ]
%90 = phi double [ %37, %34 ], [ %79, %43 ]
%91 = phi double [ %38, %34 ], [ %80, %43 ]
%92 = fcmp olt double %90, %91
%93 = select i1 %92, double %86, double %88
%94 = select i1 %92, double %87, double %89
%95 = select i1 %92, double %90, double %91
store double %93, double* %6
store double %94, double* %7
ret double %95
}