// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: get_uccm_loop(unsigned char)
void get_uccm_loop(u08 c)
{
   if(c == 0x0D) return;   // samsung
   if(c == 0x00) return;

   if(c == 0x0A) {  // end-of-line,  process it
      strupr(scpi_status_line);
      if(uccm_time_line(2)) return;  // time code message in middle of the loop message

      if(strstr(scpi_status_line, "COMMAND COMPLETE")) {
         uccm_loop = 0;
      }
      else if(strstr(scpi_status_line, "DAC")) {  // loop info header line
         uccm_loop = 2;
      }
      else if(strstr(scpi_status_line, "----")) {  // Symmetricom loop info header line
         uccm_loop = 2;
         loop_fmt = SYMMETRICOM_FMT;
         if(scpi_type != UCCMP_TYPE) {
            if(user_set_temp_plot == 0) plot[TEMP].show_plot = 1;
         }
         if(user_set_scpi_type == 0) scpi_type = UCCMP_TYPE;
         config_msg_ofs();
      }
      else if(uccm_loop == 2) { // skip the header line(s)
         if(0 || strstr(scpi_status_line, "SERIAL NUMBER")) { // we got syst:stat
            have_uccm_loop = 0;
            uccm_loop = 4;
         }
         else if(loop_fmt == SYMMETRICOM_FMT) {  // Symmetricom
            if(strstr(scpi_status_line, "FREQ COR")) {  // the payload line we want
               decode_uccm_loop();
            }
            else if(strstr(scpi_status_line, "TEMP COR")) {  // the payload line we want
               decode_uccm_temp();
            }
            else if(strstr(scpi_status_line, "PHASE COR")) {  // the payload line we want
               decode_uccm_phase();
            }
            else if(strstr(scpi_status_line, "GPS PHASE")) {  // the payload line we want
               decode_uccm_gps_phase();
            }
         }
         else uccm_loop = 3;    // next line has the goodies
      }
      else if(uccm_loop == 4) {  // skip to Command Complete
      }
      else if(strstr(scpi_status_line, "OCXO : ")) {  // samsung
         loop_fmt = SAMSUNG_FMT;
         decode_uccm_loop();
      }
      else if(strstr(scpi_status_line, "EXT : ")) {  // samsung
         loop_fmt = SAMSUNG_FMT;
         decode_uccm_loop();
      }

      if(uccm_loop == 3) {  // we are in the info data area, decode it
         decode_uccm_loop();
      }

      scpi_col = 0;
      scpi_status_line[0] = 0;
   }
   else {  // accumulate the status line
      if(scpi_col < ((int)sizeof(scpi_status_line)-2)) {
         scpi_status_line[scpi_col++] = c;
         scpi_status_line[scpi_col] = 0;
      }
// if(debug_file) fprintf(debug_file, "info_line col:%d c:%d: stat:%d [%s]\n", scpi_col, c, uccm_loop, scpi_status_line);
   }
}

// Assembly:
testl %edi, %edi
je 0xa179a
cmpl $0xd, %edi
je 0xa179a
cmpl $0xa, %edi
jne 0xa1773
pushq %rbp
movq %rsp, %rbp
leaq 0x2cb404(%rip), %rdi    # 0x36cb40
callq 0x9899
movl $0x2, %edi
callq 0xa0779
testl %eax, %eax
jne 0xa17ce
leaq 0x2cb3ea(%rip), %rdi    # 0x36cb40
leaq 0x83f09(%rip), %rsi     # 0x125666
callq 0x9090
testq %rax, %rax
je 0xa179b
movl $0x0, 0x2ce87b(%rip)    # 0x36ffec
jmp 0xa17bd
movslq 0x2cb44a(%rip), %rax    # 0x36cbc4
cmpq $0x7e, %rax
jg 0xa179a
leaq 0x1(%rax), %rcx
movl %ecx, 0x2cb43a(%rip)    # 0x36cbc4
leaq 0x2cb3af(%rip), %rcx    # 0x36cb40
movb %dil, (%rax,%rcx)
movb $0x0, 0x1(%rax,%rcx)
retq
leaq 0x2cb39e(%rip), %rdi    # 0x36cb40
leaq 0x85e0c(%rip), %rsi     # 0x1275b5
callq 0x9090
testq %rax, %rax
je 0xa17d0
movl $0x2, 0x2ce82f(%rip)    # 0x36ffec
movl $0x0, 0x2cb3fd(%rip)    # 0x36cbc4
movb $0x0, 0x2cb372(%rip)    # 0x36cb40
popq %rbp
retq
leaq 0x2cb369(%rip), %rdi    # 0x36cb40
leaq 0x6961a(%rip), %rsi     # 0x10adf8
callq 0x9090
testq %rax, %rax
je 0xa1853
movl $0x2, 0x2ce7fa(%rip)    # 0x36ffec
movl $0x1, 0x2ce7f4(%rip)    # 0x36fff0
leaq 0x1797dd(%rip), %rax    # 0x21afe0
cmpl $0x50, (%rax)
je 0xa1825
leaq 0x26c653(%rip), %rcx    # 0x30de62
cmpb $0x0, (%rcx)
jne 0xa1825
leaq 0xbc515(%rip), %rcx     # 0x15dd30
movl $0x1, 0x2d0(%rcx)
leaq 0x1770c0(%rip), %rcx    # 0x2188ec
cmpl $0x0, (%rcx)
jne 0xa1837
movl $0x50, (%rax)
callq 0x4771f
cmpl $0x3, 0x2ce7a9(%rip)    # 0x36ffec
jne 0xa17bd
callq 0xa14fa
jmp 0xa17bd
movl 0x2ce793(%rip), %eax    # 0x36ffec
cmpl $0x4, %eax
je 0xa17bd
leaq 0x2cb2d7(%rip), %rdi    # 0x36cb40
cmpl $0x2, %eax
jne 0xa189b
leaq 0x83f28(%rip), %rsi     # 0x12579d
callq 0x9090
testq %rax, %rax
je 0xa18dc
leaq 0x17977a(%rip), %rax    # 0x21b000
movl $0x0, (%rax)
movl $0x4, 0x2ce756(%rip)    # 0x36ffec
jmp 0xa17bd
leaq 0x83ecb(%rip), %rsi     # 0x12576d
callq 0x9090
testq %rax, %rax
jne 0xa18c8
leaq 0x2cb28d(%rip), %rdi    # 0x36cb40
leaq 0x83ec7(%rip), %rsi     # 0x125781
callq 0x9090
testq %rax, %rax
je 0xa183c
movl $0x2, 0x2ce71e(%rip)    # 0x36fff0
callq 0xa14fa
jmp 0xa183c
cmpl $0x1, 0x2ce70d(%rip)    # 0x36fff0
jne 0xa191f
leaq 0x2cb254(%rip), %rdi    # 0x36cb40
leaq 0x83eb8(%rip), %rsi     # 0x1257ab
callq 0x9090
testq %rax, %rax
jne 0xa18d2
leaq 0x2cb23c(%rip), %rdi    # 0x36cb40
leaq 0x83ea9(%rip), %rsi     # 0x1257b4
callq 0x9090
testq %rax, %rax
je 0xa192e
callq 0xa13f1
jmp 0xa183c
movl $0x3, 0x2ce6c3(%rip)    # 0x36ffec
jmp 0xa1849
leaq 0x2cb20b(%rip), %rdi    # 0x36cb40
leaq 0x83e81(%rip), %rsi     # 0x1257bd
callq 0x9090
testq %rax, %rax
je 0xa1950
callq 0xa1474
jmp 0xa183c
leaq 0x2cb1e9(%rip), %rdi    # 0x36cb40
leaq 0x83e69(%rip), %rsi     # 0x1257c7
callq 0x9090
testq %rax, %rax
je 0xa183c
callq 0xa14bb
jmp 0xa183c