// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_star_status()
void parse_star_status() 
{
int gps;
int mode;
char *s;

   // unit status
   log_packet_id("Star status");

   star_led = (-1);
   gps = 0;
   mode = 0;
//sprintf(plot_title, "status:%s", nmea_msg);

   if(star_type == OSA_TYPE) {
      s = strstr(nmea_msg, "ALARMS:");
      if(s) {  // !!!! 4531
         s = s + 7;
         if(s[0] == '1') {
            critical_alarms |= CRIT_GPS;
            have_critical_alarms = 1;
         }
         else if(s[0] == '0') {
            critical_alarms &= (~CRIT_GPS);
            have_critical_alarms = 1;
         }

         if(s[1] == '1') {
            minor_alarms |= MINOR_ANT_NO_PWR;
            have_antenna = 1;
         }
         else if(s[1] == '0') {
            minor_alarms &= (~MINOR_ANT_NO_PWR);
            have_antenna = 1;
         }

         if(s[5] == '1') {
            critical_alarms |= CRIT_OCXO;
            have_critical_alarms = 1;
         }
         else if(s[5] == '0') {
            critical_alarms &= (~CRIT_OCXO);
            have_critical_alarms = 1;
         }
      }

      s = strstr(nmea_msg, "LED:");
      if(s) {
         s = s + 4;
         star_led = atoi(s);
         have_star_led = 1;
      }

      s = strstr(nmea_msg, "STAT_IN:");  // !!!! 4531
      if(s) {
         s = s + 8;
         mode = atoi(s);
         if(osa_model != 4530) {
            osa_stat1 = s[0] - '0';
            osa_stat2 = s[1] - '0';
            osa_stat3 = s[2] - '0';
            have_osa_stat = 1;
         }
      }
   }
   else {
      if(get_msg_field()) {
        star_led = atoi(msg_field);
        have_star_led = 1;
      }

      if(get_msg_field()) {
         gps = msg_field[0];
         if(gps == 'A') {   // GPS alarm
            critical_alarms |= CRIT_GPS;
            have_critical_alarms = 1;
         }
         else if(gps == 'O') {   // GPS ok
            critical_alarms &= (~CRIT_GPS);
            have_critical_alarms = 1;
         }
      }

      if(get_msg_field()) {
         mode = msg_field[0];
         if     (mode == 'I') discipline_mode = DIS_MODE_POWERUP;
         else if(mode == 'F') discipline_mode = DIS_MODE_FAST_RECOVERY;
         else if(mode == 'H') discipline_mode = DIS_MODE_AUTO_HOLD;
         else if(mode == 'W') discipline_mode = DIS_MODE_WARMUP;
         else if(mode == 'S') discipline_mode = DIS_MODE_RECOVERY;
         else if(mode == 'T') discipline_mode = DIS_MODE_NORMAL;
         else                 discipline_mode = mode;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x94110(%rip), %rdi     # 0x123ff8
callq 0x58e77
leaq 0x2ade48(%rip), %rbx    # 0x33dd3c
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
leaq 0x18b0e7(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x8ff42
leaq 0x2ab923(%rip), %rdi    # 0x33b830
leaq 0x940f0(%rip), %rsi     # 0x124004
callq 0x9090
testq %rax, %rax
je 0x900d2
movzbl 0x7(%rax), %ecx
cmpl $0x30, %ecx
je 0x8ff95
cmpl $0x31, %ecx
jne 0x8ffb7
leaq 0x27d295(%rip), %rcx    # 0x30d1d0
movl (%rcx), %ecx
orl $0x8, %ecx
jmp 0x8ffa1
callq 0x811da
testl %eax, %eax
je 0x8ff66
leaq 0x2abaee(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, (%rbx)
leaq 0x27d484(%rip), %rax    # 0x30d3e4
movl $0x1, (%rax)
callq 0x811da
testl %eax, %eax
je 0x90000
leaq 0x2abac6(%rip), %rax    # 0x33ba40
movzbl (%rax), %eax
cmpl $0x4f, %eax
je 0x8ffde
cmpl $0x41, %eax
jne 0x90000
leaq 0x27d242(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
orl $0x8, %eax
jmp 0x8ffea
leaq 0x27d234(%rip), %rcx    # 0x30d1d0
movl (%rcx), %ecx
andl $-0x9, %ecx
leaq 0x27d228(%rip), %rdx    # 0x30d1d0
movl %ecx, (%rdx)
leaq 0x27d2f7(%rip), %rcx    # 0x30d2a8
movl $0x1, (%rcx)
movzbl 0x8(%rax), %ecx
cmpl $0x30, %ecx
je 0x90072
cmpl $0x31, %ecx
jne 0x90094
leaq 0x27d204(%rip), %rcx    # 0x30d1d8
movl (%rcx), %ecx
orl $0x6, %ecx
jmp 0x9007e
leaq 0x27d1eb(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
andl $-0x9, %eax
leaq 0x27d1df(%rip), %rcx    # 0x30d1d0
movl %eax, (%rcx)
leaq 0x27d2ae(%rip), %rax    # 0x30d2a8
movl $0x1, (%rax)
callq 0x811da
testl %eax, %eax
je 0x90169
leaq 0x2aba2c(%rip), %rax    # 0x33ba40
movb (%rax), %al
movzbl %al, %ecx
cmpl $0x52, %ecx
jg 0x90048
cmpl $0x46, %ecx
je 0x90170
cmpl $0x48, %ecx
je 0x90193
cmpl $0x49, %ecx
jne 0x90188
leaq 0x27d457(%rip), %rax    # 0x30d497
movb $0x1, (%rax)
jmp 0x90169
cmpl $0x53, %ecx
je 0x9017c
cmpl $0x54, %ecx
je 0x9019f
cmpl $0x57, %ecx
jne 0x90188
leaq 0x27d42d(%rip), %rax    # 0x30d497
movb $0xa, (%rax)
jmp 0x90169
leaq 0x27d15f(%rip), %rcx    # 0x30d1d8
movl (%rcx), %ecx
andl $-0x7, %ecx
leaq 0x27d153(%rip), %rdx    # 0x30d1d8
movl %ecx, (%rdx)
leaq 0x27d19e(%rip), %rcx    # 0x30d22c
movl $0x1, (%rcx)
movzbl 0xc(%rax), %eax
cmpl $0x30, %eax
je 0x900b0
cmpl $0x31, %eax
jne 0x900d2
leaq 0x27d127(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
orl $0x10, %eax
jmp 0x900bc
leaq 0x27d119(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
andl $-0x11, %eax
leaq 0x27d10d(%rip), %rcx    # 0x30d1d0
movl %eax, (%rcx)
leaq 0x27d1dc(%rip), %rax    # 0x30d2a8
movl $0x1, (%rax)
leaq 0x2ab757(%rip), %rdi    # 0x33b830
leaq 0x93f2c(%rip), %rsi     # 0x12400c
callq 0x9090
testq %rax, %rax
je 0x90105
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
movl %eax, (%rbx)
leaq 0x27d2e5(%rip), %rax    # 0x30d3e4
movl $0x1, (%rax)
leaq 0x2ab724(%rip), %rdi    # 0x33b830
leaq 0x93efe(%rip), %rsi     # 0x124011
callq 0x9090
testq %rax, %rax
je 0x90169
leaq 0x18aec8(%rip), %rcx    # 0x21afec
cmpl $0x11b2, (%rcx)         # imm = 0x11B2
je 0x90169
movsbl 0x8(%rax), %ecx
addl $-0x30, %ecx
leaq 0x2adc16(%rip), %rdx    # 0x33dd50
movl %ecx, (%rdx)
movsbl 0x9(%rax), %ecx
addl $-0x30, %ecx
leaq 0x2adc0a(%rip), %rdx    # 0x33dd54
movl %ecx, (%rdx)
movsbl 0xa(%rax), %eax
addl $-0x30, %eax
leaq 0x2adbfe(%rip), %rcx    # 0x33dd58
movl %eax, (%rcx)
leaq 0x2adbe9(%rip), %rax    # 0x33dd4c
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x27d320(%rip), %rax    # 0x30d497
movb $0x5, (%rax)
jmp 0x90169
leaq 0x27d314(%rip), %rax    # 0x30d497
movb $0x4, (%rax)
jmp 0x90169
leaq 0x27d308(%rip), %rcx    # 0x30d497
movb %al, (%rcx)
jmp 0x90169
leaq 0x27d2fd(%rip), %rax    # 0x30d497
movb $0x2, (%rax)
jmp 0x90169
leaq 0x27d2f1(%rip), %rax    # 0x30d497
movb $0x0, (%rax)
jmp 0x90169