// File: /workspace/github_cpp_makefile_star2_O1/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 0xfb962
leaq 0x23f757(%rip), %rbx    # 0x33b290
movsd %xmm0, (%rbx)
leaq 0x23f7fc(%rip), %rax    # 0x33b340
movl $0x2, (%rax)
leaq 0x2114af(%rip), %rax    # 0x30d000
movsd (%rax), %xmm1
leaq 0x2114ac(%rip), %rax    # 0x30d008
movsd (%rax), %xmm2
movapd %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd 0xd4f8(%rip), %xmm3     # 0x109068
mulsd %xmm3, %xmm0
movsd 0xfd8c(%rip), %xmm4     # 0x10b908
mulsd %xmm4, %xmm0
leaq 0x23f789(%rip), %r14    # 0x33b310
movsd %xmm0, (%r14)
leaq 0x21147d(%rip), %rax    # 0x30d010
movsd (%rax), %xmm5
leaq 0x21147a(%rip), %rax    # 0x30d018
movsd (%rax), %xmm6
movapd %xmm5, %xmm7
addsd %xmm6, %xmm7
mulsd %xmm3, %xmm7
mulsd %xmm4, %xmm7
leaq 0x23f75f(%rip), %r15    # 0x33b318
movsd %xmm7, (%r15)
leaq 0x21141b(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm3
leaq 0x23f750(%rip), %r12    # 0x33b320
movsd %xmm3, (%r12)
subsd %xmm1, %xmm2
movsd %xmm2, 0x35839e(%rip)   # 0x453f80
subsd %xmm5, %xmm6
movsd %xmm6, 0x35839a(%rip)   # 0x453f88
callq 0x9710
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
cmpeqsd %xmm2, %xmm1
movsd 0xfd20(%rip), %xmm2     # 0x10b928
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm1, %xmm2
leaq 0x2113ad(%rip), %rax    # 0x30cfc8
movlpd %xmm2, (%rax)
movsd (%rbx), %xmm0
mulsd 0xd47d(%rip), %xmm0     # 0x1090a8
movsd %xmm0, 0x358355(%rip)   # 0x453f88
leaq 0x211386(%rip), %rax    # 0x30cfc0
movq (%rax), %rax
testq %rax, %rax
je 0xfbc61
movzbl (%rax), %eax
cmpl $0x6c, %eax
je 0xfbc59
cmpl $0x66, %eax
jne 0xfbc61
divsd 0xfc41(%rip), %xmm0     # 0x10b898
jmp 0xfbc61
divsd 0x22b4f(%rip), %xmm0    # 0x11e7b0
movsd %xmm0, -0x28(%rbp)
movsd (%r12), %xmm1
xorpd %xmm0, %xmm0
callq 0xe765f
mulsd 0x2245b(%rip), %xmm0    # 0x11e0d8
mulsd 0xd3b3(%rip), %xmm0     # 0x109038
movsd 0x3582fb(%rip), %xmm1   # 0x453f88
divsd %xmm0, %xmm1
mulsd 0x223f7(%rip), %xmm1    # 0x11e090
xorpd %xmm2, %xmm2
cmpltsd %xmm0, %xmm2
andpd %xmm1, %xmm2
movlpd %xmm2, 0x3582da(%rip)   # 0x453f88
leaq 0x11cc0f(%rip), %r12    # 0x2188c4
cmpb $0x0, (%r12)
je 0xfbcdf
movsd (%rbx), %xmm0
leaq 0x242f79(%rip), %rdi    # 0x33ec40
leaq 0x39907(%rip), %rsi     # 0x1355d5
movl $0xa, %edx
movsd -0x28(%rbp), %xmm1
movb $0x3, %al
callq 0x9060
movsd 0x3582a1(%rip), %xmm4   # 0x453f88
movsd %xmm4, 0x358291(%rip)   # 0x453f80
cmpb $0x0, (%r12)
je 0xfbd39
movsd (%rbx), %xmm0
leaq 0x23f5b7(%rip), %rax    # 0x33b2b8
movsd (%rax), %xmm1
movsd 0xd44b(%rip), %xmm3     # 0x109158
movsd (%r14), %xmm2
mulsd %xmm3, %xmm2
mulsd (%r15), %xmm3
leaq 0x24306e(%rip), %rdi    # 0x33ed90
leaq 0x398ea(%rip), %rsi     # 0x135613
movl $0xa, %edx
movapd %xmm4, %xmm5
movb $0x6, %al
callq 0x9060
movsd (%rbx), %xmm0
mulsd 0x3093b(%rip), %xmm0    # 0x12c680
leaq 0x23f56c(%rip), %rax    # 0x33b2b8
movsd %xmm0, (%rax)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq