// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: do_gps()
void do_gps()
{
int i;

   while(1) {    // the main processing loop...  repeat until exit requested
      x11_resize_check();     // see if screen has been re-sized

      fake_second_check(2);   // see if we should fake a missing time stamp second
      fine_tick_check();      // doing synchonized audible tick clock

      if(first_key) ;         // dont redraw screen while keyboard menu active
      else if(need_redraw) {
//sprintf(plot_title, "need redraw:%d", need_redraw);
         redraw_screen();
      }

      if(force_dump && unit_file_name) {   // forced screen dump
         dump_screen(invert_dump, 0, unit_file_name);
      }
      force_dump = 0;

      if(!serve_gps(0)) {  // time to exit the progaam
         break;
      }
      got_timing_msg = 0;  // used to prevent keyboard lockout if data comming in at high nav rates

      if(f11_flag) {  //// !!!! debug
         f11_flag = 0;
      }

      if(script_file && (script_pause == 0)) {  // reading chars from script file
         system_busy = 3;
         while(script_file) {  // process a full line of commands
            i = process_script_file();
            if((i == 0) || (i == 0x0D)) break;
            update_pwm();
         }
      }
      else if(force_si_cmd) {
         system_busy = 4;
         do_kbd('a');
      }
      else if(tide_kbd_cmd) {
         system_busy = 5;
         do_kbd('a');
      }
      else if(KBHIT()) {   // key pressed
         system_busy = 6;
         i = get_kbd();    // get the keyboard character
         i = do_kbd(i);    // process the character
         if(i) break;      // it's time to stop this madness
      }
      else if(sim_file && (sim_eof == 0)) {  // allow fast simulation file processing... use /sw if throttling or sleep needed
      }
      else if(idle_sleep && (set_system_time == 0)) {  // sleep a while when we are not busy to keep cpu usage down
         Sleep(idle_sleep);
      }

      process_extra_ports(6);  // handle data from extra serial ports

      // screen saver keyboard idle time check
      idle_time = (jd_utc - last_kbd_jd) * (24.0 * 60.0);
// sprintf(debug_text, "idle_timeout:%d  idle_time:%g  screen:%c  fk:%d", idle_timeout, idle_time*60.0, idle_screen, first_key);
      if(idle_timeout && idle_screen  && (zoom_screen == 0) && (first_key == 0)) {
         if((int) idle_time >= idle_timeout) {  // zoom to digital clock display
            add_kbd('Z');
            add_kbd(idle_screen);
         }
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
xorl %ebx, %ebx
leaq 0x32021c(%rip), %r14    # 0x340000
callq 0x1fb36
movl $0x2, %edi
callq 0x90b38
callq 0x1e9b4
cmpl $0x0, 0x21f159(%rip)    # 0x23ef58
jne 0x1fe0f
cmpl $0x0, 0x1f8a3c(%rip)    # 0x218844
je 0x1fe0f
callq 0xfa97
cmpl $0x0, 0x1f8a22(%rip)    # 0x218838
setne %al
movq 0x150e68(%rip), %rdx    # 0x170c88
testq %rdx, %rdx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1fe3a
movl 0x1f8a01(%rip), %edi    # 0x218834
xorl %esi, %esi
callq 0xf7a8
movl $0x0, 0x1f89f4(%rip)    # 0x218838
callq 0x1b44c
testl %eax, %eax
je 0x1ffee
movl $0x0, 0x2ed5e1(%rip)    # 0x30d43c
cmpl $0x0, 0x32009e(%rip)    # 0x33ff00
je 0x1fe6e
movl $0x0, 0x320092(%rip)    # 0x33ff00
cmpq $0x0, 0x21f042(%rip)    # 0x23eeb8
je 0x1fea7
cmpb $0x0, 0x21f051(%rip)    # 0x23eed0
jne 0x1fea7
movb $0x3, 0x3171a0(%rip)    # 0x337028
callq 0x1d128
testl %eax, %eax
je 0x1fed7
cmpl $0xd, %eax
je 0x1fed7
callq 0xd1efe
cmpq $0x0, 0x21f015(%rip)    # 0x23eeb8
jne 0x1fe88
jmp 0x1fed7
cmpl $0x0, 0x1fb37e(%rip)    # 0x21b22c
je 0x1feb9
movb $0x4, 0x317171(%rip)    # 0x337028
jmp 0x1fecd
cmpb $0x0, 0x1fb370(%rip)    # 0x21b230
je 0x1ff5b
movb $0x5, 0x31715b(%rip)    # 0x337028
movl $0x61, %edi
callq 0x469dc
callq 0x1e5c3
movsd 0x2ed64c(%rip), %xmm0   # 0x30d530
subsd 0x2ed6a4(%rip), %xmm0   # 0x30d590
mulsd 0xe9284(%rip), %xmm0    # 0x109178
movl 0x2ed6ae(%rip), %eax    # 0x30d5a8
testl %eax, %eax
sete %cl
cmpb $0x0, 0x2ed6a6(%rip)    # 0x30d5ac
sete %dl
orb %cl, %dl
cmpb $0x0, 0x2ec896(%rip)    # 0x30c7a8
setne %cl
cmpl $0x0, 0x21f03c(%rip)    # 0x23ef58
setne %sil
orb %cl, %sil
orb %dl, %sil
cvttsd2si %xmm0, %ecx
movsd %xmm0, 0x2ed66e(%rip)   # 0x30d5a0
cmpl %ecx, %eax
setg %al
orb %sil, %al
jne 0x1fde4
movl $0x5a, %edi
callq 0xd4c8
movzbl 0x2ed65b(%rip), %edi    # 0x30d5ac
callq 0xd4c8
jmp 0x1fde4
callq 0xa80b
mulsd 0xe90d0(%rip), %xmm0    # 0x109038
addsd 0xe90e8(%rip), %xmm0    # 0x109058
movsd %xmm0, 0x2ed620(%rip)   # 0x30d598
movl 0x3200ca(%rip), %eax    # 0x340048
cmpl %eax, 0x3200c0(%rip)    # 0x340044
jne 0x1ffc4
cmpq $0x0, 0x21e432(%rip)    # 0x23e3c0
je 0x1ff9d
cmpl $0x0, 0x21e441(%rip)    # 0x23e3d8
je 0x1fed7
movq 0x203654(%rip), %rdi    # 0x2235f8
testq %rdi, %rdi
je 0x1fed7
cmpl $0x0, 0x2edf04(%rip)    # 0x30deb8
jne 0x1fed7
callq 0xafe8
jmp 0x1fed7
leal 0x1(%rax), %ecx
cmpl $0xf, %eax
cmovgel %ebx, %ecx
movb $0x6, 0x317054(%rip)    # 0x337028
movl %ecx, 0x32006e(%rip)    # 0x340048
movslq %ecx, %rax
movl (%r14,%rax,4), %edi
callq 0x469dc
testl %eax, %eax
je 0x1fed7
popq %rbx
popq %r14
popq %rbp
retq