// File: jkingan[P]ladyheather/heathgps.cpp
// Function: get_x72_response(char)
void get_x72_response(char c)
{
   // get the data returned by the HEALTH, etc messages
   if(c == 0x0D) return;
   if(c == 0x00) return;

   if(c == 0x0A) {  // end-of-line,  process it
      response_end:
      ++x72_line;
if(debug_file) fprintf(debug_file, "get_x72_response %d, line:%2d: %s\n", x72_response,x72_line, scpi_status_line);

      strupr(scpi_status_line);
      if(x72_response == X72_HEALTH_MSG) {
         parse_x72_val(x72_response);
      }
      else if(x72_response == X72_GET_CREG_MSG) {
         parse_x72_val(x72_response);
      }
      else if(x72_response == X72_GET_PPS_MSG) {
         parse_x72_val(x72_response);
      }
      else if(x72_response == X72_SET_DDS_MSG) {
         parse_x72_val(x72_response);
      }
      else if(x72_response == X72_SET_SRVC_MSG) {
         parse_x72_val(x72_response);
      }
      else if(x72_response == X72_SET_FC_MSG) {
         parse_x72_val(x72_response);
      }
      else if(x72_response == X72_INFO_MSG) {
         parse_x72_info();
      }

      if(strstr(scpi_status_line, "R>")) {  // command line prompt
         x72_response = 0;
         x72_line = 0;
         poll_next_x72();
      }

      scpi_col = 0;
      scpi_status_line[0] = 0;
      update_x72_screen();
   }
   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((scpi_status_line[0] == 'r') && (scpi_status_line[1] == '>')) {  // command line prompt -> end of message data
            goto response_end;
         }
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
movsbl -0x1(%rbp), %eax
cmpl $0xd, %eax
jne 0xc48fc
jmp 0xc4ac9
movsbl -0x1(%rbp), %eax
cmpl $0x0, %eax
jne 0xc490a
jmp 0xc4ac9
movsbl -0x1(%rbp), %eax
cmpl $0xa, %eax
jne 0xc4a6c
jmp 0xc4919
movl 0x307481(%rip), %eax    # 0x3cbda0
addl $0x1, %eax
movl %eax, 0x307478(%rip)    # 0x3cbda0
leaq 0x1d8c41(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xc4960
leaq 0x1d8c34(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl 0x307457(%rip), %edx    # 0x3cbd9c
movl 0x307455(%rip), %ecx    # 0x3cbda0
leaq 0xc2898(%rip), %rsi     # 0x1871ea
leaq 0x3073b7(%rip), %r8     # 0x3cbd10
movb $0x0, %al
callq 0x9550
leaq 0x3073a9(%rip), %rdi    # 0x3cbd10
callq 0x9890
cmpl $0x2c9, 0x307426(%rip)  # imm = 0x2C9
jne 0xc4988
movl 0x30741e(%rip), %edi    # 0x3cbd9c
callq 0xc2630
jmp 0xc4a22
cmpl $0x2c5, 0x30740a(%rip)  # imm = 0x2C5
jne 0xc49a1
movl 0x307402(%rip), %edi    # 0x3cbd9c
callq 0xc2630
jmp 0xc4a20
cmpl $0x2c1, 0x3073f1(%rip)  # imm = 0x2C1
jne 0xc49ba
movl 0x3073e9(%rip), %edi    # 0x3cbd9c
callq 0xc2630
jmp 0xc4a1e
cmpl $0x2bd, 0x3073d8(%rip)  # imm = 0x2BD
jne 0xc49d3
movl 0x3073d0(%rip), %edi    # 0x3cbd9c
callq 0xc2630
jmp 0xc4a1c
cmpl $0x2c3, 0x3073bf(%rip)  # imm = 0x2C3
jne 0xc49ec
movl 0x3073b7(%rip), %edi    # 0x3cbd9c
callq 0xc2630
jmp 0xc4a1a
cmpl $0x2bc, 0x3073a6(%rip)  # imm = 0x2BC
jne 0xc4a05
movl 0x30739e(%rip), %edi    # 0x3cbd9c
callq 0xc2630
jmp 0xc4a18
cmpl $0x2c0, 0x30738d(%rip)  # imm = 0x2C0
jne 0xc4a16
callq 0xc41f0
jmp 0xc4a18
jmp 0xc4a1a
jmp 0xc4a1c
jmp 0xc4a1e
jmp 0xc4a20
jmp 0xc4a22
leaq 0x3072e7(%rip), %rdi    # 0x3cbd10
leaq 0xc25f6(%rip), %rsi     # 0x187026
callq 0x9090
cmpq $0x0, %rax
je 0xc4a54
movl $0x0, 0x307357(%rip)    # 0x3cbd9c
movl $0x0, 0x307351(%rip)    # 0x3cbda0
callq 0x990c0
movl $0x0, 0x307336(%rip)    # 0x3cbd94
movb $0x0, 0x3072ab(%rip)    # 0x3cbd10
callq 0xc23c0
jmp 0xc4ac9
cmpl $0x7f, 0x307321(%rip)   # 0x3cbd94
jge 0xc4ac7
movb -0x1(%rbp), %dl
movl 0x307316(%rip), %eax    # 0x3cbd94
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x30730b(%rip)    # 0x3cbd94
movslq %eax, %rcx
leaq 0x30727d(%rip), %rax    # 0x3cbd10
movb %dl, (%rax,%rcx)
movslq 0x3072f7(%rip), %rcx    # 0x3cbd94
leaq 0x30726c(%rip), %rax    # 0x3cbd10
movb $0x0, (%rax,%rcx)
movsbl 0x307261(%rip), %eax    # 0x3cbd10
cmpl $0x72, %eax
jne 0xc4ac5
movsbl 0x307256(%rip), %eax    # 0x3cbd11
cmpl $0x3e, %eax
jne 0xc4ac5
jmp 0xc4919
jmp 0xc4ac7
jmp 0xc4ac9
addq $0x10, %rsp
popq %rbp
retq
nop