// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_scpi_hardware()
void parse_scpi_hardware()
{
int status;

   log_packet_id("scpi hardware");

   msg_col = 0;
   if(get_msg_field()) {
      status = atoi(nmea_msg);
if(debug_file) fprintf(debug_file, "### hardware status:%04X\n", status);
      if(scpi_type == NORTEL_TYPE) {
        // 0x0001 - self test fail
        // 0x0002 - power fail
        // 0x0004 - GPS 1PPS fail
        // 0x0008 - OCXO fail
        // 0x0010 - EFC fail
        // 0x0020 - PLL fail
        // 0x0040 - EEPROM fail
        // 0x0080 - RAM fail
        // 0x0100 - FPGA fail
        // 0x0200 - antenna RF signal too high
        // 0x0400 - antenna RF signal too low
        // 0x0800 - GPS fail (TRAIM failure)
        // 0x1000 - PDOP fail
        if(status & 0x0002) critical_alarms |= CRIT_PWR;      // power
        else                critical_alarms &= (~CRIT_PWR);
        if(status & 0x0008) critical_alarms |= CRIT_OCXO;     // ocxo
        else                critical_alarms &= (~CRIT_OCXO);
        if(status & 0x0080) critical_alarms |= CRIT_RAM;      // RAM
        else                critical_alarms &= (CRIT_RAM);
        if(status & 0x01A5) critical_alarms |= CRIT_FPGA;     // various hardware
        else                critical_alarms &= (~CRIT_FPGA);
        if(!have_critical_alarms) need_redraw = 7701;
        have_critical_alarms = 555;

        if(status & 0x0010) minor_alarms |= MINOR_OSC_AGE;    // EFC limit
        else                minor_alarms &= (~MINOR_OSC_AGE);
        have_osc_age = 1;

        if(status & 0x0040) minor_alarms |= MINOR_EEPROM;    // eeprom
        else                minor_alarms &= (~MINOR_EEPROM);
        have_eeprom = 1;
      }
      else {
         critical_alarms = 0x0000;
         if(status & 0x003E) critical_alarms |= CRIT_PWR;       // power
         if(status & 0x0300) critical_alarms |= CRIT_GPS;       // GPS
         if(status & 0x1000) critical_alarms |= CRIT_OCXO;      // ref failure

         if(status & 0x00C0) minor_alarms |= MINOR_OSC_AGE;     // EFC limit
         else                minor_alarms &= (~MINOR_OSC_AGE);  // EFC limit

         if(status & 0x0800) minor_alarms |= MINOR_EEPROM;      // EEPROM fault
         else                minor_alarms &= (~MINOR_EEPROM) ;  // EEPROM ok
         have_eeprom = 1;

         if(!have_critical_alarms) need_redraw = 7708;
         have_critical_alarms = 8;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x8644a(%rip), %rdi     # 0x12505d
callq 0x58e77
leaq 0x29d025(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
callq 0x811da
testl %eax, %eax
je 0x9ed7b
leaq 0x29cbf7(%rip), %rdi    # 0x33b830
callq 0x95e0
movl %eax, %ebx
leaq 0x19f749(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x9ec5f
leaq 0x86415(%rip), %rsi     # 0x12506b
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
leaq 0x17c37a(%rip), %rax    # 0x21afe0
cmpl $0x4e, (%rax)
jne 0x9ecfa
leaq 0x26e55a(%rip), %rax    # 0x30d1d0
movl (%rax), %ecx
movl %ecx, %edx
andl $-0x1f, %edx
andl $0x2, %ecx
movl %ebx, %esi
andl $0xa, %esi
testb %bl, %bl
leal 0x2(%rdx,%rsi,2), %edx
cmovnsl %ecx, %edx
xorl %ecx, %ecx
testl $0x1a5, %ebx            # imm = 0x1A5
setne %cl
leal (%rdx,%rcx,8), %ecx
movl %ecx, (%rax)
leaq 0x26e603(%rip), %rax    # 0x30d2a8
cmpl $0x0, (%rax)
jne 0x9ecb7
leaq 0x179b93(%rip), %rcx    # 0x218844
movl $0x1e15, (%rcx)         # imm = 0x1E15
movl $0x22b, (%rax)          # imm = 0x22B
leaq 0x26e514(%rip), %rax    # 0x30d1d8
movl $0xfffffbfe, %ecx       # imm = 0xFFFFFBFE
andl (%rax), %ecx
movl %ebx, %edx
shrl $0x4, %edx
movl $0x1, %esi
andl %esi, %edx
orl %ecx, %edx
leaq 0x26e550(%rip), %rcx    # 0x30d230
movl %esi, (%rcx)
andl $0x40, %ebx
shll $0x4, %ebx
orl %edx, %ebx
movl %ebx, (%rax)
leaq 0x26e5b9(%rip), %rax    # 0x30d2ac
movl %esi, (%rax)
jmp 0x9ed7b
xorl %eax, %eax
testb $0x3e, %bl
setne %al
leal (,%rax,4), %ecx
testl $0x300, %ebx            # imm = 0x300
leal 0x8(,%rax,4), %edx
cmovel %ecx, %edx
leaq 0x26e4b0(%rip), %rax    # 0x30d1d0
movl %edx, (%rax)
btl $0xc, %ebx
jae 0x9ed2b
orb $0x10, (%rax)
xorl %eax, %eax
testb $-0x40, %bl
setne %al
leaq 0x26e49e(%rip), %rcx    # 0x30d1d8
movl $0xfffffbfe, %edx       # imm = 0xFFFFFBFE
andl (%rcx), %edx
shrl %ebx
andl $0x400, %ebx            # imm = 0x400
orl %eax, %ebx
orl %edx, %ebx
movl %ebx, (%rcx)
leaq 0x26e556(%rip), %rax    # 0x30d2ac
movl $0x1, (%rax)
leaq 0x26e545(%rip), %rax    # 0x30d2a8
cmpl $0x0, (%rax)
jne 0x9ed75
leaq 0x179ad5(%rip), %rcx    # 0x218844
movl $0x1e1c, (%rcx)         # imm = 0x1E1C
movl $0x8, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq