// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: change_lla_scale()
void change_lla_scale()
{
double lw;
double radius;

   // re-scale the lat/lon scattergram if the lat/lon span changes

   LLA_SPAN = calc_lla_span(1);  // meters or feet per division
   user_set_ref_lla = 2;
   ref_lat = ((min_q_lat + max_q_lat) / 2.0) * DEG_TO_RAD;
   ref_lon = ((min_q_lon + max_q_lon) / 2.0) * DEG_TO_RAD;
   ref_alt = alt;

   ref_lat_span = (max_q_lat - min_q_lat);  // in degrees
   ref_lon_span = (max_q_lon - min_q_lon);

   cos_factor = cos(ref_lat);
   if(cos_factor == 0.0) cos_factor = 0.001;
   lw = ref_lon_span = ((double)LLA_SPAN * (double) LLA_DIVISIONS);  // scattergram width in meters or feet
   if(angle_units) {
      if(angle_units[0] == 'f') lw /= FEET_PER_METER;  // lw now in meters
      else if(angle_units[0] == 'l') lw /= LG_PER_METER;  // lw now in meters
   }

   radius = (2.0*PI*earth_radius(0.0,ref_alt)*1000.0);    // divided by earth circumference in meters
   if(radius > 0.0) ref_lon_span /= radius;
   else ref_lon_span = 0.0;
   ref_lon_span *= 360.0;  // scattergram width in degrees
if(show_debug_info) sprintf(debug_text3, "lla_span:%f  lla_divs:%d  lw:%.9f  ref_lon_span: %.9f degrees", LLA_SPAN,LLA_DIVISIONS,lw,ref_lon_span);  //llascale
   ref_lat_span = ref_lon_span;
if(show_debug_info) {
   sprintf(debug_text4, "new span,divs %d,%.2f:  last:%.2f  ref:%.9f %.9f  dist:%.9f %.9f",   //llascale
   LLA_DIVISIONS, LLA_SPAN, last_lla_span, ref_lat*RAD_TO_DEG,ref_lon*RAD_TO_DEG, ref_lat_span,ref_lon_span);
}
   last_lla_span = LLA_SPAN * LLA_THRESH;  //llascale
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl $0x1, %edi
callq 0xfc0e0
leaq 0x23efe2(%rip), %rbx    # 0x33b290
movsd %xmm0, (%rbx)
leaq 0x23f087(%rip), %rax    # 0x33b340
movl $0x2, (%rax)
leaq 0x210d3a(%rip), %rax    # 0x30d000
movsd (%rax), %xmm1
leaq 0x210d37(%rip), %rax    # 0x30d008
movsd (%rax), %xmm2
movapd %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd 0xcd83(%rip), %xmm3     # 0x109068
mulsd %xmm3, %xmm0
movsd 0xf61f(%rip), %xmm4     # 0x10b910
mulsd %xmm4, %xmm0
leaq 0x23f014(%rip), %r14    # 0x33b310
movsd %xmm0, (%r14)
leaq 0x210d08(%rip), %rax    # 0x30d010
movsd (%rax), %xmm5
leaq 0x210d05(%rip), %rax    # 0x30d018
addsd (%rax), %xmm5
mulsd %xmm3, %xmm5
mulsd %xmm4, %xmm5
leaq 0x23eff2(%rip), %r15    # 0x33b318
movsd %xmm5, (%r15)
leaq 0x210cae(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm3
leaq 0x23efe3(%rip), %r12    # 0x33b320
movsd %xmm3, (%r12)
subsd %xmm1, %xmm2
movsd %xmm2, 0x357b51(%rip)   # 0x453ea0
callq 0x9710
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
cmpeqsd %xmm2, %xmm1
movsd 0xf5c7(%rip), %xmm2     # 0x10b930
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm1, %xmm2
leaq 0x210c4c(%rip), %rax    # 0x30cfc8
movlpd %xmm2, (%rax)
movsd (%rbx), %xmm0
mulsd 0xcd1c(%rip), %xmm0     # 0x1090a8
movsd %xmm0, 0x357b14(%rip)   # 0x453ea8
leaq 0x210c25(%rip), %rax    # 0x30cfc0
movq (%rax), %rax
testq %rax, %rax
je 0xfc3c2
movzbl (%rax), %eax
cmpl $0x6c, %eax
je 0xfc3ba
cmpl $0x66, %eax
jne 0xfc3c2
divsd 0xf4f0(%rip), %xmm0     # 0x10b8a8
jmp 0xfc3c2
divsd 0x2249e(%rip), %xmm0    # 0x11e860
movsd %xmm0, -0x28(%rbp)
movsd (%r12), %xmm1
xorpd %xmm0, %xmm0
callq 0xe80f9
mulsd 0x21da2(%rip), %xmm0    # 0x11e180
mulsd 0xcc52(%rip), %xmm0     # 0x109038
movsd 0x357aba(%rip), %xmm1   # 0x453ea8
divsd %xmm0, %xmm1
mulsd 0x21d3e(%rip), %xmm1    # 0x11e138
xorpd %xmm2, %xmm2
cmpltsd %xmm0, %xmm2
andpd %xmm1, %xmm2
movlpd %xmm2, 0x357a99(%rip)   # 0x453ea8
leaq 0x11c4ae(%rip), %r12    # 0x2188c4
cmpb $0x0, (%r12)
je 0xfc49c
movsd (%rbx), %xmm0
leaq 0x242818(%rip), %rdi    # 0x33ec40
leaq 0x39296(%rip), %rsi     # 0x1356c5
movl $0xa, %edx
movsd -0x28(%rbp), %xmm1
movb $0x3, %al
callq 0x9060
movsd 0x357a60(%rip), %xmm4   # 0x453ea8
movsd %xmm4, 0x357a50(%rip)   # 0x453ea0
cmpb $0x0, (%r12)
je 0xfc4a4
movsd (%rbx), %xmm0
leaq 0x23ee56(%rip), %rax    # 0x33b2b8
movsd (%rax), %xmm1
movsd 0xccf2(%rip), %xmm3     # 0x109160
movsd (%r14), %xmm2
mulsd %xmm3, %xmm2
mulsd (%r15), %xmm3
leaq 0x24290d(%rip), %rdi    # 0x33ed90
leaq 0x39279(%rip), %rsi     # 0x135703
movl $0xa, %edx
movapd %xmm4, %xmm5
movb $0x6, %al
callq 0x9060
jmp 0xfc4a4
movsd %xmm2, 0x3579fc(%rip)   # 0x453ea0
movsd (%rbx), %xmm0
mulsd 0x302b8(%rip), %xmm0    # 0x12c768
leaq 0x23ee01(%rip), %rax    # 0x33b2b8
movsd %xmm0, (%rax)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq