// File: /workspace/github_cpp_makefile_star2_O3/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 0x9417c(%rip), %rdi     # 0x1240d8
callq 0x58dc2
leaq 0x2addd4(%rip), %rbx    # 0x33dd3c
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
leaq 0x18b073(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x8ffb6
leaq 0x2ab8af(%rip), %rdi    # 0x33b830
leaq 0x9415c(%rip), %rsi     # 0x1240e4
callq 0x9090
testq %rax, %rax
je 0x90146
movzbl 0x7(%rax), %ecx
cmpl $0x30, %ecx
je 0x90009
cmpl $0x31, %ecx
jne 0x9002b
leaq 0x27d221(%rip), %rcx    # 0x30d1d0
movl (%rcx), %ecx
orl $0x8, %ecx
jmp 0x90015
callq 0x810b1
testl %eax, %eax
je 0x8ffda
leaq 0x2aba7a(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, (%rbx)
leaq 0x27d410(%rip), %rax    # 0x30d3e4
movl $0x1, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x90074
leaq 0x2aba52(%rip), %rax    # 0x33ba40
movzbl (%rax), %eax
cmpl $0x4f, %eax
je 0x90052
cmpl $0x41, %eax
jne 0x90074
leaq 0x27d1ce(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
orl $0x8, %eax
jmp 0x9005e
leaq 0x27d1c0(%rip), %rcx    # 0x30d1d0
movl (%rcx), %ecx
andl $-0x9, %ecx
leaq 0x27d1b4(%rip), %rdx    # 0x30d1d0
movl %ecx, (%rdx)
leaq 0x27d283(%rip), %rcx    # 0x30d2a8
movl $0x1, (%rcx)
movzbl 0x8(%rax), %ecx
cmpl $0x30, %ecx
je 0x900e6
cmpl $0x31, %ecx
jne 0x90108
leaq 0x27d190(%rip), %rcx    # 0x30d1d8
movl (%rcx), %ecx
orl $0x6, %ecx
jmp 0x900f2
leaq 0x27d177(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
andl $-0x9, %eax
leaq 0x27d16b(%rip), %rcx    # 0x30d1d0
movl %eax, (%rcx)
leaq 0x27d23a(%rip), %rax    # 0x30d2a8
movl $0x1, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x901dd
leaq 0x2ab9b8(%rip), %rax    # 0x33ba40
movb (%rax), %al
movzbl %al, %ecx
cmpl $0x52, %ecx
jg 0x900bc
cmpl $0x46, %ecx
je 0x901e4
cmpl $0x48, %ecx
je 0x90207
cmpl $0x49, %ecx
jne 0x901fc
leaq 0x27d3e3(%rip), %rax    # 0x30d497
movb $0x1, (%rax)
jmp 0x901dd
cmpl $0x53, %ecx
je 0x901f0
cmpl $0x54, %ecx
je 0x90213
cmpl $0x57, %ecx
jne 0x901fc
leaq 0x27d3b9(%rip), %rax    # 0x30d497
movb $0xa, (%rax)
jmp 0x901dd
leaq 0x27d0eb(%rip), %rcx    # 0x30d1d8
movl (%rcx), %ecx
andl $-0x7, %ecx
leaq 0x27d0df(%rip), %rdx    # 0x30d1d8
movl %ecx, (%rdx)
leaq 0x27d12a(%rip), %rcx    # 0x30d22c
movl $0x1, (%rcx)
movzbl 0xc(%rax), %eax
cmpl $0x30, %eax
je 0x90124
cmpl $0x31, %eax
jne 0x90146
leaq 0x27d0b3(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
orl $0x10, %eax
jmp 0x90130
leaq 0x27d0a5(%rip), %rax    # 0x30d1d0
movl (%rax), %eax
andl $-0x11, %eax
leaq 0x27d099(%rip), %rcx    # 0x30d1d0
movl %eax, (%rcx)
leaq 0x27d168(%rip), %rax    # 0x30d2a8
movl $0x1, (%rax)
leaq 0x2ab6e3(%rip), %rdi    # 0x33b830
leaq 0x93f98(%rip), %rsi     # 0x1240ec
callq 0x9090
testq %rax, %rax
je 0x90179
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
movl %eax, (%rbx)
leaq 0x27d271(%rip), %rax    # 0x30d3e4
movl $0x1, (%rax)
leaq 0x2ab6b0(%rip), %rdi    # 0x33b830
leaq 0x93f6a(%rip), %rsi     # 0x1240f1
callq 0x9090
testq %rax, %rax
je 0x901dd
leaq 0x18ae54(%rip), %rcx    # 0x21afec
cmpl $0x11b2, (%rcx)         # imm = 0x11B2
je 0x901dd
movsbl 0x8(%rax), %ecx
addl $-0x30, %ecx
leaq 0x2adba2(%rip), %rdx    # 0x33dd50
movl %ecx, (%rdx)
movsbl 0x9(%rax), %ecx
addl $-0x30, %ecx
leaq 0x2adb96(%rip), %rdx    # 0x33dd54
movl %ecx, (%rdx)
movsbl 0xa(%rax), %eax
addl $-0x30, %eax
leaq 0x2adb8a(%rip), %rcx    # 0x33dd58
movl %eax, (%rcx)
leaq 0x2adb75(%rip), %rax    # 0x33dd4c
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x27d2ac(%rip), %rax    # 0x30d497
movb $0x5, (%rax)
jmp 0x901dd
leaq 0x27d2a0(%rip), %rax    # 0x30d497
movb $0x4, (%rax)
jmp 0x901dd
leaq 0x27d294(%rip), %rcx    # 0x30d497
movb %al, (%rcx)
jmp 0x901dd
leaq 0x27d289(%rip), %rax    # 0x30d497
movb $0x2, (%rax)
jmp 0x901dd
leaq 0x27d27d(%rip), %rax    # 0x30d497
movb $0x0, (%rax)
jmp 0x901dd