// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x2
popq %rbx
pushq $0x5a
popq %r14
pushq $0x61
popq %r15
callq 0x1e7dd
movl %ebx, %edi
callq 0x83d34
callq 0x1d8f0
cmpl $0x0, 0x20a4d3(%rip)    # 0x228f58
jne 0x1ea95
cmpl $0x0, 0x1e3db6(%rip)    # 0x202844
je 0x1ea95
callq 0xf426
cmpl $0x0, 0x1e3d9c(%rip)    # 0x202838
setne %al
movq 0x13c1e2(%rip), %rdx    # 0x15ac88
testq %rdx, %rdx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1eac0
movl 0x1e3d7b(%rip), %edi    # 0x202834
xorl %esi, %esi
callq 0xf1b3
andl $0x0, 0x1e3d71(%rip)    # 0x202838
callq 0x1a858
testl %eax, %eax
je 0x1ec3c
andl $0x0, 0x2d8961(%rip)    # 0x2f743c
cmpl $0x0, 0x30b41e(%rip)    # 0x329f00
je 0x1eaeb
andl $0x0, 0x30b415(%rip)    # 0x329f00
movq 0x20a3c6(%rip), %rax    # 0x228eb8
testq %rax, %rax
je 0x1eb28
cmpb $0x0, 0x20a3d2(%rip)    # 0x228ed0
jne 0x1eb28
movb $0x3, 0x302521(%rip)    # 0x321028
testq %rax, %rax
je 0x1eb56
callq 0x1c190
testl %eax, %eax
je 0x1eb56
cmpl $0xd, %eax
je 0x1eb56
callq 0xc067d
movq 0x20a392(%rip), %rax    # 0x228eb8
jmp 0x1eb07
cmpl $0x0, 0x1e66fd(%rip)    # 0x20522c
je 0x1eb3a
movb $0x4, 0x3024f0(%rip)    # 0x321028
jmp 0x1eb4e
cmpb $0x0, 0x1e66ef(%rip)    # 0x205230
je 0x1ebd8
movb $0x5, 0x3024da(%rip)    # 0x321028
movl %r15d, %edi
callq 0x42caf
callq 0x1d57a
movsd 0x2d89cd(%rip), %xmm0   # 0x2f7530
subsd 0x2d8a25(%rip), %xmm0   # 0x2f7590
mulsd 0xd4605(%rip), %xmm0    # 0xf3178
movl 0x2d8a2f(%rip), %eax    # 0x2f75a8
testl %eax, %eax
sete %cl
cmpb $0x0, 0x2d8a27(%rip)    # 0x2f75ac
sete %dl
orb %cl, %dl
cmpb $0x0, 0x2d7c17(%rip)    # 0x2f67a8
setne %cl
cmpl $0x0, 0x20a3bd(%rip)    # 0x228f58
setne %sil
orb %cl, %sil
orb %dl, %sil
cvttsd2si %xmm0, %ecx
movsd %xmm0, 0x2d89ef(%rip)   # 0x2f75a0
cmpl %ecx, %eax
setg %al
orb %sil, %al
jne 0x1ea6d
movl %r14d, %edi
callq 0xd140
movzbl 0x2d89de(%rip), %edi    # 0x2f75ac
callq 0xd140
jmp 0x1ea6d
callq 0xd1b9
testl %eax, %eax
je 0x1ebfe
movb $0x6, 0x302440(%rip)    # 0x321028
callq 0xd1d5
movl %eax, %edi
callq 0x42caf
testl %eax, %eax
je 0x1eb56
jmp 0x1ec3c
cmpq $0x0, 0x2097ba(%rip)    # 0x2283c0
je 0x1ec15
cmpl $0x0, 0x2097c9(%rip)    # 0x2283d8
je 0x1eb56
movq 0x1ee9dc(%rip), %rdi    # 0x20d5f8
testq %rdi, %rdi
je 0x1eb56
cmpl $0x0, 0x2d928c(%rip)    # 0x2f7eb8
jne 0x1eb56
callq 0xae83
jmp 0x1eb56
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq