// File: /workspace/github_cpp_makefile_star2_O1/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 0xa1596
cmpl $0xd, %edi
je 0xa1596
cmpl $0xa, %edi
jne 0xa156f
pushq %rbp
movq %rsp, %rbp
leaq 0x2cb60f(%rip), %rdi    # 0x36cb40
callq 0x9899
movl $0x2, %edi
callq 0xa0567
testl %eax, %eax
jne 0xa1646
leaq 0x2cb5f1(%rip), %rdi    # 0x36cb40
leaq 0x84030(%rip), %rsi     # 0x125586
callq 0x9090
testq %rax, %rax
je 0xa1597
movl $0x0, 0x2cea82(%rip)    # 0x36ffec
jmp 0xa1627
movslq 0x2cb64e(%rip), %rax    # 0x36cbc4
cmpq $0x7e, %rax
jg 0xa1596
leaq 0x1(%rax), %rcx
movl %ecx, 0x2cb63e(%rip)    # 0x36cbc4
leaq 0x2cb5b3(%rip), %rcx    # 0x36cb40
movb %dil, (%rax,%rcx)
movb $0x0, 0x1(%rax,%rcx)
retq
leaq 0x2cb5a2(%rip), %rdi    # 0x36cb40
leaq 0x85f45(%rip), %rsi     # 0x1274ea
callq 0x9090
testq %rax, %rax
je 0xa15bb
movl $0x2, 0x2cea33(%rip)    # 0x36ffec
jmp 0xa1627
leaq 0x2cb57e(%rip), %rdi    # 0x36cb40
leaq 0x6981f(%rip), %rsi     # 0x10ade8
callq 0x9090
testq %rax, %rax
je 0xa1648
movl $0x2, 0x2cea0f(%rip)    # 0x36ffec
movl $0x1, 0x2cea09(%rip)    # 0x36fff0
leaq 0x1799f2(%rip), %rax    # 0x21afe0
cmpl $0x50, (%rax)
je 0xa1610
leaq 0x26c868(%rip), %rcx    # 0x30de62
cmpb $0x0, (%rcx)
jne 0xa1610
leaq 0xbc72a(%rip), %rcx     # 0x15dd30
movl $0x1, 0x2d0(%rcx)
leaq 0x1772d5(%rip), %rcx    # 0x2188ec
cmpl $0x0, (%rcx)
jne 0xa1622
movl $0x50, (%rax)
callq 0x47650
cmpl $0x3, 0x2ce9be(%rip)    # 0x36ffec
jne 0xa1635
callq 0xa12ea
movl $0x0, 0x2cb585(%rip)    # 0x36cbc4
movb $0x0, 0x2cb4fa(%rip)    # 0x36cb40
popq %rbp
retq
movl 0x2ce99e(%rip), %eax    # 0x36ffec
cmpl $0x4, %eax
je 0xa1627
leaq 0x2cb4e6(%rip), %rdi    # 0x36cb40
cmpl $0x2, %eax
jne 0xa1689
leaq 0x84057(%rip), %rsi     # 0x1256bd
callq 0x9090
testq %rax, %rax
je 0xa16ca
leaq 0x179989(%rip), %rax    # 0x21b000
movl $0x0, (%rax)
movl $0x4, 0x2ce965(%rip)    # 0x36ffec
jmp 0xa1627
leaq 0x83ffd(%rip), %rsi     # 0x12568d
callq 0x9090
testq %rax, %rax
jne 0xa16b6
leaq 0x2cb49f(%rip), %rdi    # 0x36cb40
leaq 0x83ff9(%rip), %rsi     # 0x1256a1
callq 0x9090
testq %rax, %rax
je 0xa1627
movl $0x2, 0x2ce930(%rip)    # 0x36fff0
callq 0xa12ea
jmp 0xa1627
cmpl $0x1, 0x2ce91f(%rip)    # 0x36fff0
jne 0xa170d
leaq 0x2cb466(%rip), %rdi    # 0x36cb40
leaq 0x83fea(%rip), %rsi     # 0x1256cb
callq 0x9090
testq %rax, %rax
jne 0xa16c0
leaq 0x2cb44e(%rip), %rdi    # 0x36cb40
leaq 0x83fdb(%rip), %rsi     # 0x1256d4
callq 0x9090
testq %rax, %rax
je 0xa171c
callq 0xa11da
jmp 0xa1627
movl $0x3, 0x2ce8d5(%rip)    # 0x36ffec
jmp 0xa1627
leaq 0x2cb41d(%rip), %rdi    # 0x36cb40
leaq 0x83fb3(%rip), %rsi     # 0x1256dd
callq 0x9090
testq %rax, %rax
je 0xa173e
callq 0xa1264
jmp 0xa1627
leaq 0x2cb3fb(%rip), %rdi    # 0x36cb40
leaq 0x83f9b(%rip), %rsi     # 0x1256e7
callq 0x9090
testq %rax, %rax
je 0xa1627
callq 0xa12ab
jmp 0xa1627