// File: /workspace/github_cpp_makefile_star2_O1/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 0x211684(%rip), %r14    # 0x30d000
movsd (%r14), %xmm0
leaq 0x211650(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x211675(%rip), %r15    # 0x30d008
movsd (%r15), %xmm2
movaps %xmm1, %xmm3
callq 0xe956f
mulsd 0xff60(%rip), %xmm0     # 0x10b908
mulsd 0xd688(%rip), %xmm0     # 0x109038
movapd %xmm0, -0x40(%rbp)
leaq 0x211614(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x211649(%rip), %r12    # 0x30d010
movsd (%r12), %xmm1
leaq 0x211644(%rip), %r13    # 0x30d018
movsd (%r13), %xmm3
movapd %xmm0, %xmm2
callq 0xe956f
movapd -0x40(%rbp), %xmm2
movapd %xmm0, %xmm1
mulsd 0xff14(%rip), %xmm1     # 0x10b908
mulsd 0xd63c(%rip), %xmm1     # 0x109038
movapd 0xd77c(%rip), %xmm0     # 0x109180
andpd %xmm0, %xmm2
andpd %xmm0, %xmm1
movapd %xmm1, %xmm0
maxsd %xmm2, %xmm0
leaq 0x2115a5(%rip), %rax    # 0x30cfc0
movq (%rax), %rax
testq %rax, %rax
je 0xfba42
movzbl (%rax), %eax
cmpl $0x6c, %eax
je 0xfba3a
cmpl $0x66, %eax
jne 0xfba42
mulsd 0xfe60(%rip), %xmm0     # 0x10b898
jmp 0xfba42
mulsd 0x22d6e(%rip), %xmm0    # 0x11e7b0
divsd 0xd6ee(%rip), %xmm0     # 0x109138
addsd 0xd61e(%rip), %xmm0     # 0x109070
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movapd %xmm0, -0x40(%rbp)
testl %ebx, %ebx
jne 0xfba78
movl 0x751db(%rip), %eax     # 0x170c44
leaq 0x211a90(%rip), %rcx    # 0x30d500
cmpl (%rcx), %eax
je 0xfbb06
leaq 0x211a81(%rip), %rax    # 0x30d500
movl (%rax), %eax
movl %eax, 0x751bd(%rip)     # 0x170c44
leaq 0x23f826(%rip), %rax    # 0x33b2b4
cmpl $0x0, (%rax)
je 0xfbb01
leaq 0x11ce2a(%rip), %rax    # 0x2188c4
cmpb $0x0, (%rax)
je 0xfbb01
leaq 0x211502(%rip), %rax    # 0x30cfa8
movq (%rax), %rdx
leaq 0x242ef0(%rip), %rdi    # 0x33e9a0
leaq 0x39ac7(%rip), %rsi     # 0x13557e
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 0x242ffd(%rip), %rdi    # 0x33eaf0
leaq 0x39aaf(%rip), %rsi     # 0x1355a9
movb $0x6, %al
callq 0x9060
callq 0xfb85c
movaps -0x40(%rbp), %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq