// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
movzbl -0x1(%rbp), %eax
cmpl $0xd, %eax
jne 0xdb21c
jmp 0xdb4d0
movzbl -0x1(%rbp), %eax
cmpl $0x0, %eax
jne 0xdb22a
jmp 0xdb4d0
movzbl -0x1(%rbp), %eax
cmpl $0xa, %eax
jne 0xdb492
leaq 0x2f0ad2(%rip), %rdi    # 0x3cbd10
callq 0x9890
movl $0x2, %edi
callq 0xd9ec0
cmpl $0x0, %eax
je 0xdb257
jmp 0xdb4d0
leaq 0x2f0ab2(%rip), %rdi    # 0x3cbd10
leaq 0xad6f5(%rip), %rsi     # 0x18895a
callq 0x9090
cmpq $0x0, %rax
je 0xdb27f
movl $0x0, 0x2f3f42(%rip)    # 0x3cf1bc
jmp 0xdb471
leaq 0x2f0a8a(%rip), %rdi    # 0x3cbd10
leaq 0xaf6e2(%rip), %rsi     # 0x18a96f
callq 0x9090
cmpq $0x0, %rax
je 0xdb2a7
movl $0x2, 0x2f3f1a(%rip)    # 0x3cf1bc
jmp 0xdb46f
leaq 0x2f0a62(%rip), %rdi    # 0x3cbd10
leaq 0x95b30(%rip), %rsi     # 0x170de5
callq 0x9090
cmpq $0x0, %rax
je 0xdb325
movl $0x2, 0x2f3ef2(%rip)    # 0x3cf1bc
movl $0x1, 0x2f3eec(%rip)    # 0x3cf1c0
leaq 0x19eee5(%rip), %rax    # 0x27a1c0
cmpl $0x50, (%rax)
je 0xdb302
leaq 0x291d5b(%rip), %rax    # 0x36d042
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xdb300
leaq 0xe1a2a(%rip), %rax     # 0x1bcd20
movl $0x1, 0x2d0(%rax)
jmp 0xdb302
leaq 0x19c7c3(%rip), %rax    # 0x277acc
cmpl $0x0, (%rax)
jne 0xdb31b
leaq 0x19eeab(%rip), %rax    # 0x27a1c0
movl $0x50, (%rax)
callq 0x63c20
jmp 0xdb46d
cmpl $0x2, 0x2f3e90(%rip)    # 0x3cf1bc
jne 0xdb408
leaq 0x2f09d7(%rip), %rdi    # 0x3cbd10
leaq 0xad751(%rip), %rsi     # 0x188a91
callq 0x9090
cmpq $0x0, %rax
je 0xdb367
leaq 0x19ee8e(%rip), %rax    # 0x27a1e0
movl $0x0, (%rax)
movl $0x4, 0x2f3e5a(%rip)    # 0x3cf1bc
jmp 0xdb406
cmpl $0x1, 0x2f3e52(%rip)    # 0x3cf1c0
jne 0xdb3fa
leaq 0x2f0995(%rip), %rdi    # 0x3cbd10
leaq 0xad71d(%rip), %rsi     # 0x188a9f
callq 0x9090
cmpq $0x0, %rax
je 0xdb394
callq 0xdaf40
jmp 0xdb3f8
leaq 0x2f0975(%rip), %rdi    # 0x3cbd10
leaq 0xad706(%rip), %rsi     # 0x188aa8
callq 0x9090
cmpq $0x0, %rax
je 0xdb3b4
callq 0xdadb0
jmp 0xdb3f6
leaq 0x2f0955(%rip), %rdi    # 0x3cbd10
leaq 0xad6ef(%rip), %rsi     # 0x188ab1
callq 0x9090
cmpq $0x0, %rax
je 0xdb3d4
callq 0xdae80
jmp 0xdb3f4
leaq 0x2f0935(%rip), %rdi    # 0x3cbd10
leaq 0xad6d9(%rip), %rsi     # 0x188abb
callq 0x9090
cmpq $0x0, %rax
je 0xdb3f2
callq 0xdaee0
jmp 0xdb3f4
jmp 0xdb3f6
jmp 0xdb3f8
jmp 0xdb404
movl $0x3, 0x2f3db8(%rip)    # 0x3cf1bc
jmp 0xdb406
jmp 0xdb46b
cmpl $0x4, 0x2f3dad(%rip)    # 0x3cf1bc
jne 0xdb413
jmp 0xdb469
leaq 0x2f08f6(%rip), %rdi    # 0x3cbd10
leaq 0xad640(%rip), %rsi     # 0x188a61
callq 0x9090
cmpq $0x0, %rax
je 0xdb43d
movl $0x2, 0x2f3d8a(%rip)    # 0x3cf1c0
callq 0xdaf40
jmp 0xdb467
leaq 0x2f08cc(%rip), %rdi    # 0x3cbd10
leaq 0xad62a(%rip), %rsi     # 0x188a75
callq 0x9090
cmpq $0x0, %rax
je 0xdb465
movl $0x2, 0x2f3d60(%rip)    # 0x3cf1c0
callq 0xdaf40
jmp 0xdb467
jmp 0xdb469
jmp 0xdb46b
jmp 0xdb46d
jmp 0xdb46f
jmp 0xdb471
cmpl $0x3, 0x2f3d44(%rip)    # 0x3cf1bc
jne 0xdb47f
callq 0xdaf40
movl $0x0, 0x2f090b(%rip)    # 0x3cbd94
movb $0x0, 0x2f0880(%rip)    # 0x3cbd10
jmp 0xdb4d0
cmpl $0x7f, 0x2f08fb(%rip)   # 0x3cbd94
jge 0xdb4ce
movb -0x1(%rbp), %dl
movl 0x2f08f0(%rip), %eax    # 0x3cbd94
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x2f08e5(%rip)    # 0x3cbd94
movslq %eax, %rcx
leaq 0x2f0857(%rip), %rax    # 0x3cbd10
movb %dl, (%rax,%rcx)
movslq 0x2f08d1(%rip), %rcx    # 0x3cbd94
leaq 0x2f0846(%rip), %rax    # 0x3cbd10
movb $0x0, (%rax,%rcx)
jmp 0xdb4d0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)