// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: calc_lla_span(int)
double calc_lla_span(int force_show)
{
double lat_dist, lon_dist;
double max_dist;
static int last_sec = (-99);

   // return the maximum span distance of lat or lon in meters or feet

if(0) {
   if(lat == 0.0) return LLA_SPAN;
   if(lon == 0.0) return LLA_SPAN;
   if(min_q_lat == 0.0) return LLA_SPAN;
   if(min_q_lon == 0.0) return LLA_SPAN;
   if(max_q_lat == 0.0) return LLA_SPAN;
   if(max_q_lon == 0.0) return LLA_SPAN;
}

   lat_dist = greatcircle(min_q_lat,lon, max_q_lat,lon) * DEG_TO_RAD * 1000.0;  // lat span in meters
   lon_dist = greatcircle(lat,min_q_lon, lat,max_q_lon) * DEG_TO_RAD * 1000.0;  // lon span in meters
   lat_dist = fabs(lat_dist);
   lon_dist = fabs(lon_dist);

   max_dist = lat_dist;
   if(lon_dist > max_dist) max_dist = lon_dist;  // max span dist of lat/lon
   if(angle_units) {
      if(angle_units[0] == 'f') max_dist *= FEET_PER_METER;
      else if(angle_units[0] == 'l') max_dist *= LG_PER_METER;  // linguini per meter
   }
   max_dist /= ((double) LLA_DIVISIONS / 2.0);  // scale to LLA plot size
   max_dist = (double) (int) (max_dist+1.0);    // round up to next integer

   if(force_show || (last_sec != pri_seconds)) {  // rate limit the screen updates
      last_sec = pri_seconds;
if(autoscale_lla && show_debug_info) {
   sprintf(debug_text, "lat_d: %.9f  lon_d:%.9f  span:%.9f  %s/div", lat_dist,lon_dist,max_dist, alt_scale); //llascale
   sprintf(debug_text2, "lat:%.9f %.9f (%.9f)   lon:%.9f %.9f (%.9f)", min_q_lat,max_q_lat,max_q_lat-min_q_lat,  min_q_lon,max_q_lon,max_q_lon-min_q_lon); //llascale
}
      show_mouse_lla();
   }
   return max_dist;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
leaq 0x210a53(%rip), %r14    # 0x2f7000
movsd (%r14), %xmm0
leaq 0x210a1f(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm1
leaq 0x210a44(%rip), %r15    # 0x2f7008
movsd (%r15), %xmm2
movaps %xmm1, %xmm3
callq 0xd59ef
mulsd 0xf3af(%rip), %xmm0     # 0xf5988
mulsd 0xca57(%rip), %xmm0     # 0xf3038
movapd %xmm0, -0x40(%rbp)
leaq 0x2109e3(%rip), %rax    # 0x2f6fd0
movsd (%rax), %xmm0
leaq 0x210a18(%rip), %r12    # 0x2f7010
movsd (%r12), %xmm1
leaq 0x210a13(%rip), %r13    # 0x2f7018
movsd (%r13), %xmm3
movapd %xmm0, %xmm2
callq 0xd59ef
movapd -0x40(%rbp), %xmm2
movapd %xmm0, %xmm1
mulsd 0xf363(%rip), %xmm1     # 0xf5988
mulsd 0xca0b(%rip), %xmm1     # 0xf3038
movapd 0xcb5b(%rip), %xmm0     # 0xf3190
andpd %xmm0, %xmm2
andpd %xmm0, %xmm1
movapd %xmm1, %xmm0
maxsd %xmm2, %xmm0
leaq 0x210974(%rip), %rax    # 0x2f6fc0
movq (%rax), %rax
testq %rax, %rax
je 0xe6673
movzbl (%rax), %eax
cmpl $0x6c, %eax
je 0xe666b
cmpl $0x66, %eax
jne 0xe6673
mulsd 0xf2b7(%rip), %xmm0     # 0xf5920
jmp 0xe6673
mulsd 0x22165(%rip), %xmm0    # 0x1087d8
divsd 0xcac5(%rip), %xmm0     # 0xf3140
addsd 0xc9ed(%rip), %xmm0     # 0xf3070
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
leaq 0x210e6e(%rip), %rax    # 0x2f7500
movl (%rax), %eax
testl %ebx, %ebx
jne 0xe66a4
cmpl %eax, 0x745a6(%rip)     # 0x15ac44
je 0xe6732
movapd %xmm0, -0x40(%rbp)
movl %eax, 0x74595(%rip)     # 0x15ac44
leaq 0x23ebfe(%rip), %rax    # 0x3252b4
cmpl $0x0, (%rax)
je 0xe6729
leaq 0x11c202(%rip), %rax    # 0x2028c4
cmpb $0x0, (%rax)
je 0xe6729
leaq 0x2108da(%rip), %rax    # 0x2f6fa8
movq (%rax), %rdx
leaq 0x2422c8(%rip), %rdi    # 0x3289a0
leaq 0x38eaf(%rip), %rsi     # 0x11f58e
movapd %xmm2, %xmm0
movaps -0x40(%rbp), %xmm2
movb $0x3, %al
callq 0x9060
movsd (%r14), %xmm0
movsd (%r15), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
movsd (%r12), %xmm3
movsd (%r13), %xmm4
movapd %xmm4, %xmm5
subsd %xmm3, %xmm5
leaq 0x2423d5(%rip), %rdi    # 0x328af0
leaq 0x38e97(%rip), %rsi     # 0x11f5b9
movb $0x6, %al
callq 0x9060
callq 0xe649e
movaps -0x40(%rbp), %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq