// File: /workspace/github_cpp_makefile_star2_O1/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 0x3201f6(%rip), %r14    # 0x340000
callq 0x1fb66
movl $0x2, %edi
callq 0x90ac8
callq 0x1e9d5
cmpl $0x0, 0x21f133(%rip)    # 0x23ef58
jne 0x1fe35
cmpl $0x0, 0x1f8a16(%rip)    # 0x218844
je 0x1fe35
callq 0xfb1a
cmpl $0x0, 0x1f89fc(%rip)    # 0x218838
setne %al
movq 0x150e42(%rip), %rdx    # 0x170c88
testq %rdx, %rdx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1fe60
movl 0x1f89db(%rip), %edi    # 0x218834
xorl %esi, %esi
callq 0xf82a
movl $0x0, 0x1f89ce(%rip)    # 0x218838
callq 0x1b42d
testl %eax, %eax
je 0x20014
movl $0x0, 0x2ed5bb(%rip)    # 0x30d43c
cmpl $0x0, 0x320078(%rip)    # 0x33ff00
je 0x1fe94
movl $0x0, 0x32006c(%rip)    # 0x33ff00
cmpq $0x0, 0x21f01c(%rip)    # 0x23eeb8
je 0x1fecd
cmpb $0x0, 0x21f02b(%rip)    # 0x23eed0
jne 0x1fecd
movb $0x3, 0x31717a(%rip)    # 0x337028
cmpq $0x0, 0x21f002(%rip)    # 0x23eeb8
je 0x1fefd
callq 0x1d0ea
testl %eax, %eax
je 0x1fefd
cmpl $0xd, %eax
je 0x1fefd
callq 0xd1865
jmp 0x1feae
cmpl $0x0, 0x1fb358(%rip)    # 0x21b22c
je 0x1fedf
movb $0x4, 0x31714b(%rip)    # 0x337028
jmp 0x1fef3
cmpb $0x0, 0x1fb34a(%rip)    # 0x21b230
je 0x1ff81
movb $0x5, 0x317135(%rip)    # 0x337028
movl $0x61, %edi
callq 0x4691f
callq 0x1e5f9
movsd 0x2ed626(%rip), %xmm0   # 0x30d530
subsd 0x2ed67e(%rip), %xmm0   # 0x30d590
mulsd 0xe9256(%rip), %xmm0    # 0x109170
movl 0x2ed688(%rip), %eax    # 0x30d5a8
testl %eax, %eax
sete %cl
cmpb $0x0, 0x2ed680(%rip)    # 0x30d5ac
sete %dl
orb %cl, %dl
cmpb $0x0, 0x2ec870(%rip)    # 0x30c7a8
setne %cl
cmpl $0x0, 0x21f016(%rip)    # 0x23ef58
setne %sil
orb %cl, %sil
orb %dl, %sil
cvttsd2si %xmm0, %ecx
movsd %xmm0, 0x2ed648(%rip)   # 0x30d5a0
cmpl %ecx, %eax
setg %al
orb %sil, %al
jne 0x1fe0a
movl $0x5a, %edi
callq 0xd4e7
movzbl 0x2ed635(%rip), %edi    # 0x30d5ac
callq 0xd4e7
jmp 0x1fe0a
callq 0xa826
mulsd 0xe90aa(%rip), %xmm0    # 0x109038
addsd 0xe90c2(%rip), %xmm0    # 0x109058
movsd %xmm0, 0x2ed5fa(%rip)   # 0x30d598
movl 0x3200a4(%rip), %eax    # 0x340048
cmpl %eax, 0x32009a(%rip)    # 0x340044
jne 0x1ffea
cmpq $0x0, 0x21e40c(%rip)    # 0x23e3c0
je 0x1ffc3
cmpl $0x0, 0x21e41b(%rip)    # 0x23e3d8
je 0x1fefd
movq 0x20362e(%rip), %rdi    # 0x2235f8
testq %rdi, %rdi
je 0x1fefd
cmpl $0x0, 0x2edede(%rip)    # 0x30deb8
jne 0x1fefd
callq 0xaff7
jmp 0x1fefd
leal 0x1(%rax), %ecx
cmpl $0xf, %eax
cmovgel %ebx, %ecx
movb $0x6, 0x31702e(%rip)    # 0x337028
movl %ecx, 0x320048(%rip)    # 0x340048
movslq %ecx, %rax
movl (%r14,%rax,4), %edi
callq 0x4691f
testl %eax, %eax
je 0x1fefd
popq %rbx
popq %r14
popq %rbp
retq