// File: /workspace/github_cpp_makefile_star2_O2/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 0x8ae05(%rip), %rdi     # 0x10e020
callq 0x520bf
leaq 0x2a4b15(%rip), %rbx    # 0x327d3c
orl $-0x1, (%rbx)
leaq 0x181db7(%rip), %rax    # 0x204fe8
cmpl $0x4f, (%rax)
jne 0x83272
leaq 0x2a25f3(%rip), %rdi    # 0x325830
leaq 0x8ade8(%rip), %rsi     # 0x10e02c
callq 0x9090
testq %rax, %rax
je 0x833ec
movzbl 0x7(%rax), %ecx
cmpl $0x30, %ecx
je 0x832c5
cmpl $0x31, %ecx
jne 0x832e7
leaq 0x273f65(%rip), %rcx    # 0x2f71d0
movl (%rcx), %ecx
orl $0x8, %ecx
jmp 0x832d1
callq 0x75767
testl %eax, %eax
je 0x83296
leaq 0x2a27be(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, (%rbx)
leaq 0x274154(%rip), %rax    # 0x2f73e4
movl $0x1, (%rax)
callq 0x75767
testl %eax, %eax
je 0x83330
leaq 0x2a2796(%rip), %rax    # 0x325a40
movzbl (%rax), %eax
cmpl $0x4f, %eax
je 0x8330e
cmpl $0x41, %eax
jne 0x83330
leaq 0x273f12(%rip), %rax    # 0x2f71d0
movl (%rax), %eax
orl $0x8, %eax
jmp 0x8331a
leaq 0x273f04(%rip), %rcx    # 0x2f71d0
movl (%rcx), %ecx
andl $-0x9, %ecx
leaq 0x273ef8(%rip), %rdx    # 0x2f71d0
movl %ecx, (%rdx)
leaq 0x273fc7(%rip), %rcx    # 0x2f72a8
movl $0x1, (%rcx)
movzbl 0x8(%rax), %ecx
cmpl $0x30, %ecx
je 0x8338c
cmpl $0x31, %ecx
jne 0x833ae
leaq 0x273ed4(%rip), %rcx    # 0x2f71d8
movl (%rcx), %ecx
orl $0x6, %ecx
jmp 0x83398
leaq 0x273ebb(%rip), %rax    # 0x2f71d0
movl (%rax), %eax
andl $-0x9, %eax
leaq 0x273eaf(%rip), %rcx    # 0x2f71d0
movl %eax, (%rcx)
leaq 0x273f7e(%rip), %rax    # 0x2f72a8
movl $0x1, (%rax)
callq 0x75767
testl %eax, %eax
je 0x83483
leaq 0x2a26fc(%rip), %rax    # 0x325a40
movzbl (%rax), %eax
cmpl $0x46, %eax
je 0x834c5
cmpl $0x48, %eax
je 0x834b9
cmpl $0x57, %eax
je 0x8348a
cmpl $0x53, %eax
je 0x834a2
cmpl $0x54, %eax
je 0x83496
cmpl $0x49, %eax
jne 0x834ae
leaq 0x274113(%rip), %rax    # 0x2f7497
movb $0x1, (%rax)
jmp 0x83483
leaq 0x273e45(%rip), %rcx    # 0x2f71d8
movl (%rcx), %ecx
andl $-0x7, %ecx
leaq 0x273e39(%rip), %rdx    # 0x2f71d8
movl %ecx, (%rdx)
leaq 0x273e84(%rip), %rcx    # 0x2f722c
movl $0x1, (%rcx)
movzbl 0xc(%rax), %eax
cmpl $0x30, %eax
je 0x833ca
cmpl $0x31, %eax
jne 0x833ec
leaq 0x273e0d(%rip), %rax    # 0x2f71d0
movl (%rax), %eax
orl $0x10, %eax
jmp 0x833d6
leaq 0x273dff(%rip), %rax    # 0x2f71d0
movl (%rax), %eax
andl $-0x11, %eax
leaq 0x273df3(%rip), %rcx    # 0x2f71d0
movl %eax, (%rcx)
leaq 0x273ec2(%rip), %rax    # 0x2f72a8
movl $0x1, (%rax)
leaq 0x2a243d(%rip), %rdi    # 0x325830
leaq 0x8ac3a(%rip), %rsi     # 0x10e034
callq 0x9090
testq %rax, %rax
je 0x8341f
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
movl %eax, (%rbx)
leaq 0x273fcb(%rip), %rax    # 0x2f73e4
movl $0x1, (%rax)
leaq 0x2a240a(%rip), %rdi    # 0x325830
leaq 0x8ac0c(%rip), %rsi     # 0x10e039
callq 0x9090
testq %rax, %rax
je 0x83483
leaq 0x181bae(%rip), %rcx    # 0x204fec
cmpl $0x11b2, (%rcx)         # imm = 0x11B2
je 0x83483
movsbl 0x8(%rax), %ecx
addl $-0x30, %ecx
leaq 0x2a48fc(%rip), %rdx    # 0x327d50
movl %ecx, (%rdx)
movsbl 0x9(%rax), %ecx
addl $-0x30, %ecx
leaq 0x2a48f0(%rip), %rdx    # 0x327d54
movl %ecx, (%rdx)
movsbl 0xa(%rax), %eax
addl $-0x30, %eax
leaq 0x2a48e4(%rip), %rcx    # 0x327d58
movl %eax, (%rcx)
leaq 0x2a48cf(%rip), %rax    # 0x327d4c
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x274006(%rip), %rax    # 0x2f7497
movb $0xa, (%rax)
jmp 0x83483
leaq 0x273ffa(%rip), %rax    # 0x2f7497
movb $0x0, (%rax)
jmp 0x83483
leaq 0x273fee(%rip), %rax    # 0x2f7497
movb $0x4, (%rax)
jmp 0x83483
leaq 0x273fe2(%rip), %rcx    # 0x2f7497
movb %al, (%rcx)
jmp 0x83483
leaq 0x273fd7(%rip), %rax    # 0x2f7497
movb $0x2, (%rax)
jmp 0x83483
leaq 0x273fcb(%rip), %rax    # 0x2f7497
movb $0x5, (%rax)
jmp 0x83483