// File: /workspace/github_cpp_makefile_star2_O2/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 0x21063e(%rip), %rax    # 0x2f6fd0
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
leaq 0x210636(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq 0x21062e(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq 0x210686(%rip), %rax    # 0x2f7048
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq 0x21067e(%rip), %rax    # 0x2f7050
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq 0x210676(%rip), %rax    # 0x2f7058
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xc9736
pushq $0x1
popq %rdi
callq 0xe53f2
leaq 0x11e931(%rip), %rax    # 0x205330
movq (%rax), %r14
leaq 0x23e8c3(%rip), %r12    # 0x3252cc
leaq 0x11e910(%rip), %r15    # 0x205320
xorl %r13d, %r13d
leaq 0x11e90e(%rip), %rax    # 0x205328
cmpq (%rax), %r14
je 0xe6af9
leaq -0x108(%rbp), %rdi
movq %r14, %rsi
callq 0xf9c7
movsd -0xc8(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm2
movsd -0x70(%rbp), %xmm3
movsd -0xd8(%rbp), %xmm4
movsd 0xef2f(%rip), %xmm6     # 0xf5988
mulsd %xmm6, %xmm4
movsd -0xd0(%rbp), %xmm5
mulsd %xmm6, %xmm5
leaq 0x210560(%rip), %rax    # 0x2f6fd0
movsd %xmm4, (%rax)
leaq 0x21055d(%rip), %rax    # 0x2f6fd8
movsd %xmm5, (%rax)
leaq 0x21055a(%rip), %rax    # 0x2f6fe0
movsd %xmm0, (%rax)
leaq 0x2105b7(%rip), %rax    # 0x2f7048
movsd %xmm1, (%rax)
leaq 0x2105b4(%rip), %rax    # 0x2f7050
movsd %xmm2, (%rax)
leaq 0x2105b1(%rip), %rax    # 0x2f7058
movsd %xmm3, (%rax)
leaq 0x23e836(%rip), %rax    # 0x3252e8
movl (%rax), %eax
xorl %edx, %edx
movl $0xe10, %ecx            # imm = 0xE10
divl %ecx
xorl %edx, %edx
pushq $0xc
popq %rcx
divl %ecx
movl $0x1, (%r12)
leal 0x3(%rdx), %esi
movl %ebx, %edi
callq 0xc9a95
andl $0x0, (%r12)
incq %r14
movq (%r15), %rax
cmpq %rax, %r14
movl $0x0, %ecx
cmovgeq %rcx, %r14
incq %r13
cmpq %rax, %r13
jl 0xe6a13
leaq 0x2104d0(%rip), %rax    # 0x2f6fd0
movsd -0x58(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x2104c8(%rip), %rax    # 0x2f6fd8
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x2104c0(%rip), %rax    # 0x2f6fe0
movsd -0x48(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x210518(%rip), %rax    # 0x2f7048
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x210510(%rip), %rax    # 0x2f7050
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x210508(%rip), %rax    # 0x2f7058
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq