// File: 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
subq $0x10, %rsp
leaq 0xc2106(%rip), %rdi     # 0x1873c5
callq 0x7add0
leaq 0x2d7c51(%rip), %rax    # 0x39cf1c
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x0, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
leaq 0x1b4ee2(%rip), %rax    # 0x27a1c8
cmpl $0x4f, (%rax)
jne 0xc5522
leaq 0x2d571a(%rip), %rdi    # 0x39aa10
leaq 0xc20d4(%rip), %rsi     # 0x1873d1
callq 0x9090
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xc5443
movq -0x10(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xc534d
leaq 0x2a7080(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x8, %ecx
leaq 0x2a7074(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x2a7143(%rip), %rax    # 0x36c488
movl $0x1, (%rax)
jmp 0xc537d
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0xc537b
leaq 0x2a7050(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $-0x9, %ecx
leaq 0x2a7044(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x2a7113(%rip), %rax    # 0x36c488
movl $0x1, (%rax)
jmp 0xc537d
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x31, %eax
jne 0xc53ae
leaq 0x2a7027(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x6, %ecx
leaq 0x2a701b(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x2a7066(%rip), %rax    # 0x36c40c
movl $0x1, (%rax)
jmp 0xc53df
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x30, %eax
jne 0xc53dd
leaq 0x2a6ff6(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x7, %ecx
leaq 0x2a6fea(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x2a7035(%rip), %rax    # 0x36c40c
movl $0x1, (%rax)
jmp 0xc53df
movq -0x10(%rbp), %rax
movsbl 0x5(%rax), %eax
cmpl $0x31, %eax
jne 0xc5410
leaq 0x2a6fbd(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x10, %ecx
leaq 0x2a6fb1(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x2a7080(%rip), %rax    # 0x36c488
movl $0x1, (%rax)
jmp 0xc5441
movq -0x10(%rbp), %rax
movsbl 0x5(%rax), %eax
cmpl $0x30, %eax
jne 0xc543f
leaq 0x2a6f8c(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $-0x11, %ecx
leaq 0x2a6f80(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x2a704f(%rip), %rax    # 0x36c488
movl $0x1, (%rax)
jmp 0xc5441
jmp 0xc5443
leaq 0x2d55c6(%rip), %rdi    # 0x39aa10
leaq 0xc1f88(%rip), %rsi     # 0x1873d9
callq 0x9090
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xc548e
movq -0x10(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x95c0
movl %eax, %ecx
leaq 0x2d7a9d(%rip), %rax    # 0x39cf1c
movl %ecx, (%rax)
leaq 0x2a713c(%rip), %rax    # 0x36c5c4
movl $0x1, (%rax)
leaq 0x2d557b(%rip), %rdi    # 0x39aa10
leaq 0xc1f42(%rip), %rsi     # 0x1873de
callq 0x9090
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xc551d
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x95c0
movl %eax, -0x8(%rbp)
leaq 0x1b4d01(%rip), %rax    # 0x27a1cc
cmpl $0x11b2, (%rax)         # imm = 0x11B2
je 0xc551b
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
subl $0x30, %ecx
leaq 0x2d7a4c(%rip), %rax    # 0x39cf30
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %ecx
subl $0x30, %ecx
leaq 0x2d7a3c(%rip), %rax    # 0x39cf34
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %ecx
subl $0x30, %ecx
leaq 0x2d7a2c(%rip), %rax    # 0x39cf38
movl %ecx, (%rax)
leaq 0x2d7a17(%rip), %rax    # 0x39cf2c
movl $0x1, (%rax)
jmp 0xc551d
jmp 0xc5660
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc5550
leaq 0x2d56ed(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, %ecx
leaq 0x2d79db(%rip), %rax    # 0x39cf1c
movl %ecx, (%rax)
leaq 0x2a707a(%rip), %rax    # 0x36c5c4
movl $0x1, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc55bd
leaq 0x2d56bf(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
movl %eax, -0x4(%rbp)
cmpl $0x41, -0x4(%rbp)
jne 0xc5591
leaq 0x2a6e3c(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x8, %ecx
leaq 0x2a6e30(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x2a6eff(%rip), %rax    # 0x36c488
movl $0x1, (%rax)
jmp 0xc55bb
cmpl $0x4f, -0x4(%rbp)
jne 0xc55b9
leaq 0x2a6e12(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
andl $-0x9, %ecx
leaq 0x2a6e06(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
leaq 0x2a6ed5(%rip), %rax    # 0x36c488
movl $0x1, (%rax)
jmp 0xc55bb
jmp 0xc55bd
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc565e
leaq 0x2d564e(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
movl %eax, -0x8(%rbp)
cmpl $0x49, -0x8(%rbp)
jne 0xc55ea
leaq 0x2a7092(%rip), %rax    # 0x36c677
movb $0x1, (%rax)
jmp 0xc565c
cmpl $0x46, -0x8(%rbp)
jne 0xc55fc
leaq 0x2a7080(%rip), %rax    # 0x36c677
movb $0x5, (%rax)
jmp 0xc565a
cmpl $0x48, -0x8(%rbp)
jne 0xc560e
leaq 0x2a706e(%rip), %rax    # 0x36c677
movb $0x2, (%rax)
jmp 0xc5658
cmpl $0x57, -0x8(%rbp)
jne 0xc5620
leaq 0x2a705c(%rip), %rax    # 0x36c677
movb $0xa, (%rax)
jmp 0xc5656
cmpl $0x53, -0x8(%rbp)
jne 0xc5632
leaq 0x2a704a(%rip), %rax    # 0x36c677
movb $0x4, (%rax)
jmp 0xc5654
cmpl $0x54, -0x8(%rbp)
jne 0xc5644
leaq 0x2a7038(%rip), %rax    # 0x36c677
movb $0x0, (%rax)
jmp 0xc5652
movl -0x8(%rbp), %eax
movb %al, %cl
leaq 0x2a7027(%rip), %rax    # 0x36c677
movb %cl, (%rax)
jmp 0xc5654
jmp 0xc5656
jmp 0xc5658
jmp 0xc565a
jmp 0xc565c
jmp 0xc565e
jmp 0xc5660
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)