// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %rdi
callq 0xe6593
leaq 0x23eb31(%rip), %rbx    # 0x325290
movsd %xmm0, (%rbx)
leaq 0x23ebd6(%rip), %rax    # 0x325340
movl $0x2, (%rax)
leaq 0x210889(%rip), %rax    # 0x2f7000
movsd (%rax), %xmm1
leaq 0x210886(%rip), %rax    # 0x2f7008
movsd (%rax), %xmm2
movapd %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd 0xc8d2(%rip), %xmm3     # 0xf3068
mulsd %xmm3, %xmm0
movsd 0xf1e6(%rip), %xmm4     # 0xf5988
mulsd %xmm4, %xmm0
leaq 0x23eb63(%rip), %r14    # 0x325310
movsd %xmm0, (%r14)
leaq 0x210857(%rip), %rax    # 0x2f7010
movsd (%rax), %xmm5
leaq 0x210854(%rip), %rax    # 0x2f7018
addsd (%rax), %xmm5
mulsd %xmm3, %xmm5
mulsd %xmm4, %xmm5
leaq 0x23eb41(%rip), %r15    # 0x325318
movsd %xmm5, (%r15)
leaq 0x2107fd(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm3
leaq 0x23eb32(%rip), %r12    # 0x325320
movsd %xmm3, (%r12)
subsd %xmm1, %xmm2
movsd %xmm2, 0x3576a0(%rip)   # 0x43dea0
callq 0x9710
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
cmpeqsd %xmm2, %xmm1
movsd 0xf18e(%rip), %xmm2     # 0xf59a8
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm1, %xmm2
leaq 0x21079b(%rip), %rax    # 0x2f6fc8
movlpd %xmm2, (%rax)
movsd (%rbx), %xmm0
mulsd 0xc86b(%rip), %xmm0     # 0xf30a8
movsd %xmm0, 0x357663(%rip)   # 0x43dea8
leaq 0x210774(%rip), %rax    # 0x2f6fc0
movq (%rax), %rax
testq %rax, %rax
je 0xe6873
movzbl (%rax), %eax
cmpl $0x6c, %eax
je 0xe686b
cmpl $0x66, %eax
jne 0xe6873
divsd 0xf0b7(%rip), %xmm0     # 0xf5920
jmp 0xe6873
divsd 0x21f65(%rip), %xmm0    # 0x1087d8
movsd %xmm0, -0x28(%rbp)
movsd (%r12), %xmm1
xorpd %xmm0, %xmm0
callq 0xd3c65
mulsd 0x21969(%rip), %xmm0    # 0x1081f8
mulsd 0xc7a1(%rip), %xmm0     # 0xf3038
movsd 0x357609(%rip), %xmm1   # 0x43dea8
divsd %xmm0, %xmm1
mulsd 0x21905(%rip), %xmm1    # 0x1081b0
xorpd %xmm2, %xmm2
cmpltsd %xmm0, %xmm2
andpd %xmm1, %xmm2
movlpd %xmm2, 0x3575e8(%rip)   # 0x43dea8
leaq 0x11bffd(%rip), %r12    # 0x2028c4
cmpb $0x0, (%r12)
je 0xe6949
movsd (%rbx), %xmm0
leaq 0x242367(%rip), %rdi    # 0x328c40
leaq 0x38d05(%rip), %rsi     # 0x11f5e5
pushq $0xa
popq %rdx
movsd -0x28(%rbp), %xmm1
movb $0x3, %al
callq 0x9060
movsd 0x3575b1(%rip), %xmm4   # 0x43dea8
movsd %xmm4, 0x3575a1(%rip)   # 0x43dea0
cmpb $0x0, (%r12)
je 0xe6951
movsd (%rbx), %xmm0
leaq 0x23e9a7(%rip), %rax    # 0x3252b8
movsd (%rax), %xmm1
movsd 0xc843(%rip), %xmm3     # 0xf3160
movsd (%r14), %xmm2
mulsd %xmm3, %xmm2
mulsd (%r15), %xmm3
leaq 0x24245e(%rip), %rdi    # 0x328d90
leaq 0x38cea(%rip), %rsi     # 0x11f623
pushq $0xa
popq %rdx
movapd %xmm4, %xmm5
movb $0x6, %al
callq 0x9060
jmp 0xe6951
movsd %xmm2, 0x35754f(%rip)   # 0x43dea0
movsd (%rbx), %xmm0
mulsd 0x2fd2b(%rip), %xmm0    # 0x116688
leaq 0x23e954(%rip), %rax    # 0x3252b8
movsd %xmm0, (%rax)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq