// File: /workspace/github_cpp_makefile_star2_O2/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 0x925f1
cmpl $0xd, %edi
je 0x925f1
cmpl $0xa, %edi
jne 0x925ca
pushq %rbp
movq %rsp, %rbp
leaq 0x2c45a8(%rip), %rdi    # 0x356b40
callq 0x988f
pushq $0x2
popq %rdi
callq 0x916e0
testl %eax, %eax
jne 0x92622
leaq 0x2c4590(%rip), %rdi    # 0x356b40
leaq 0x7cff7(%rip), %rsi     # 0x10f5ae
callq 0x9090
testq %rax, %rax
je 0x925f2
andl $0x0, 0x2c7a24(%rip)    # 0x359fec
jmp 0x92614
movslq 0x2c45f3(%rip), %rax    # 0x356bc4
cmpq $0x7e, %rax
jg 0x925f1
leaq 0x1(%rax), %rcx
movl %ecx, 0x2c45e3(%rip)    # 0x356bc4
leaq 0x2c4558(%rip), %rcx    # 0x356b40
movb %dil, (%rax,%rcx)
movb $0x0, 0x1(%rax,%rcx)
retq
leaq 0x2c4547(%rip), %rdi    # 0x356b40
leaq 0x7eefa(%rip), %rsi     # 0x1114fa
callq 0x9090
testq %rax, %rax
je 0x92624
movl $0x2, 0x2c79d8(%rip)    # 0x359fec
andl $0x0, 0x2c45a9(%rip)    # 0x356bc4
movb $0x0, 0x2c451e(%rip)    # 0x356b40
popq %rbp
retq
leaq 0x2c4515(%rip), %rdi    # 0x356b40
leaq 0x62841(%rip), %rsi     # 0xf4e73
callq 0x9090
testq %rax, %rax
je 0x926a7
movl $0x2, 0x2c79a6(%rip)    # 0x359fec
movl $0x1, 0x2c79a0(%rip)    # 0x359ff0
leaq 0x172989(%rip), %rax    # 0x204fe0
cmpl $0x50, (%rax)
je 0x92679
leaq 0x2657ff(%rip), %rcx    # 0x2f7e62
cmpb $0x0, (%rcx)
jne 0x92679
leaq 0xb56c1(%rip), %rcx     # 0x147d30
movl $0x1, 0x2d0(%rcx)
leaq 0x17026c(%rip), %rcx    # 0x2028ec
cmpl $0x0, (%rcx)
jne 0x9268b
movl $0x50, (%rax)
callq 0x43898
cmpl $0x3, 0x2c7955(%rip)    # 0x359fec
jne 0x92614
callq 0x9235d
jmp 0x92614
movl 0x2c793f(%rip), %eax    # 0x359fec
cmpl $0x4, %eax
je 0x92614
leaq 0x2c4483(%rip), %rdi    # 0x356b40
cmpl $0x2, %eax
jne 0x926ec
leaq 0x7d01c(%rip), %rsi     # 0x10f6e5
callq 0x9090
testq %rax, %rax
je 0x9272d
leaq 0x172926(%rip), %rax    # 0x205000
andl $0x0, (%rax)
movl $0x4, 0x2c7905(%rip)    # 0x359fec
jmp 0x92614
leaq 0x7cfc2(%rip), %rsi     # 0x10f6b5
callq 0x9090
testq %rax, %rax
jne 0x92719
leaq 0x2c443c(%rip), %rdi    # 0x356b40
leaq 0x7cfbe(%rip), %rsi     # 0x10f6c9
callq 0x9090
testq %rax, %rax
je 0x92690
movl $0x2, 0x2c78cd(%rip)    # 0x359ff0
callq 0x9235d
jmp 0x92690
cmpl $0x1, 0x2c78bc(%rip)    # 0x359ff0
jne 0x92770
leaq 0x2c4403(%rip), %rdi    # 0x356b40
leaq 0x7cfaf(%rip), %rsi     # 0x10f6f3
callq 0x9090
testq %rax, %rax
jne 0x92723
leaq 0x2c43eb(%rip), %rdi    # 0x356b40
leaq 0x7cfa0(%rip), %rsi     # 0x10f6fc
callq 0x9090
testq %rax, %rax
je 0x9277f
callq 0x9225a
jmp 0x92690
movl $0x3, 0x2c7872(%rip)    # 0x359fec
jmp 0x9269d
leaq 0x2c43ba(%rip), %rdi    # 0x356b40
leaq 0x7cf78(%rip), %rsi     # 0x10f705
callq 0x9090
testq %rax, %rax
je 0x927a1
callq 0x922db
jmp 0x92690
leaq 0x2c4398(%rip), %rdi    # 0x356b40
leaq 0x7cf60(%rip), %rsi     # 0x10f70f
callq 0x9090
testq %rax, %rax
je 0x92690
callq 0x92320
jmp 0x92690