// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathmsc.cpp
// Function: rebuild_lla_plot(int)
void rebuild_lla_plot(int draw)
{
struct PLOT_Q q;
double old_lat, old_lon, old_alt;
double old_lat_tide, old_lon_tide, old_alt_tide;
long i;
long count;
int color;

   // rebuild the LLA scattergram image from the plot queue data

   old_lat = lat;
   old_lon = lon;
   old_alt = alt;
   old_lat_tide = lat_tide;
   old_lon_tide = lon_tide;
   old_alt_tide = alt_tide;

   plot_lla_axes(10);    // erase the old scattergram
   #ifdef BUFFER_LLA
      clear_lla_points(1);
   #endif
   count = 0;

   i = plot_q_out;   // dumping the full queue
   while(i != plot_q_in) {  // rebuilt the scattergram from plot queue lat/lon data
      q = get_plot_q(i);

      lat = (double) q.data[ONE] * DEG_TO_RAD;
      lon = (double) q.data[TWO] * DEG_TO_RAD;
      alt = (double) q.data[THREE];

      lat_tide = (double) q.data[ELEVEN];
      lon_tide = (double) q.data[TWELVE];
      alt_tide = (double) q.data[THIRTEEN];
 
      color = lla_points / (60L*60L);
      color %= 12;
      in_rebuild_lla = 1;   // prevent recursion with plot_lla_point()
      plot_lla_point(draw, color+3); 
      in_rebuild_lla = 0;

      if(0 && (count == 0)) {  // !!!! this does not work = draw X at start of scattergram data
         dot(lla_xi+1,lla_yi+1, color+3);
         dot(lla_xi+2,lla_yi+2, color+3);
         dot(lla_xi+1,lla_yi-1, color+3);
         dot(lla_xi+2,lla_yi-2, color+3);
         dot(lla_xi-1,lla_yi+1, color+3);
         dot(lla_xi-2,lla_yi+2, color+3);
         dot(lla_xi-1,lla_yi-1, color+3);
         dot(lla_xi-2,lla_yi-2, color+3);
      }

      if(++i >= plot_q_size) i = 0;
      if(++count >= plot_q_size) break;
   }

   lat = old_lat;
   lon = old_lon;
   alt = old_alt;
   lat_tide = old_lat_tide;
   lon_tide = old_lon_tide;
   alt_tide = old_alt_tide;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %edi, %ebx
leaq 0x211256(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
leaq 0x21124e(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq 0x211246(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq 0x21129e(%rip), %rax    # 0x30d048
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq 0x211296(%rip), %rax    # 0x30d050
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq 0x21128e(%rip), %rax    # 0x30d058
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xdac25
movl $0x1, %edi
callq 0xfa6ba
leaq 0x11f547(%rip), %rax    # 0x21b330
movq (%rax), %r14
leaq 0x23f4d9(%rip), %r13    # 0x33b2cc
leaq 0x11f526(%rip), %r12    # 0x21b320
xorl %r15d, %r15d
leaq 0x11f524(%rip), %rax    # 0x21b328
cmpq (%rax), %r14
je 0xfbef7
leaq -0x108(%rbp), %rdi
movq %r14, %rsi
callq 0x10141
movsd -0xc8(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm2
movsd -0x70(%rbp), %xmm3
movsd -0xd8(%rbp), %xmm4
movsd 0xfac5(%rip), %xmm6     # 0x10b908
mulsd %xmm6, %xmm4
movsd -0xd0(%rbp), %xmm5
mulsd %xmm6, %xmm5
leaq 0x211176(%rip), %rax    # 0x30cfd0
movsd %xmm4, (%rax)
leaq 0x211173(%rip), %rax    # 0x30cfd8
movsd %xmm5, (%rax)
leaq 0x211170(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
leaq 0x2111cd(%rip), %rax    # 0x30d048
movsd %xmm1, (%rax)
leaq 0x2111ca(%rip), %rax    # 0x30d050
movsd %xmm2, (%rax)
leaq 0x2111c7(%rip), %rax    # 0x30d058
movsd %xmm3, (%rax)
leaq 0x23f44c(%rip), %rax    # 0x33b2e8
movl (%rax), %esi
movl $0x91a2b3c5, %eax       # imm = 0x91A2B3C5
imulq %rax, %rsi
shrq $0x2b, %rsi
imulq $0x15555556, %rsi, %rax # imm = 0x15555556
shrq $0x20, %rax
shll $0x2, %eax
leal (%rax,%rax,2), %eax
subl %eax, %esi
movl $0x1, (%r13)
addl $0x3, %esi
movl %ebx, %edi
callq 0xdafbe
movl $0x0, (%r13)
incq %r14
movq (%r12), %rax
cmpq %rax, %r14
movl $0x0, %ecx
cmovgeq %rcx, %r14
incq %r15
cmpq %rax, %r15
jl 0xfbdfd
leaq 0x2110d2(%rip), %rax    # 0x30cfd0
movsd -0x58(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x2110ca(%rip), %rax    # 0x30cfd8
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x2110c2(%rip), %rax    # 0x30cfe0
movsd -0x48(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x21111a(%rip), %rax    # 0x30d048
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x211112(%rip), %rax    # 0x30d050
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x21110a(%rip), %rax    # 0x30d058
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq