// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gptst()
void parse_gptst()
{
int status;
double id;
int t1,t2;

   // test results
   t1 = t2 = status = 0;
   id = 0;

   if(get_msg_field()) {
      status = atoi(msg_field);
      if(status == 0) need_redraw = 8527;
   }

   if(get_msg_field()) {
      id = atof(msg_field);
      furuno_pgm = (int) (id / 100.0);
      furuno_ver = (int) fmod(id, 100.0);
      have_info |= ALL_ID_INFO;
   }

   if(get_msg_field()) {
      t1 = atoi(msg_field);
   }

   if(get_msg_field()) {
      t2 = atoi(msg_field);

      critical_alarms = 0;
      have_critical_alarms = 1;
      have_antenna = 1;

      if(t2 & 0x01) {  // ROM error
         critical_alarms |= CRIT_ROM;
      }

      if(t2 & 0x02) {  // RAM error
         critical_alarms |= CRIT_RAM;
      }

      if(t2 & 0x04) {  // antenna error
         minor_alarms |= MINOR_ANT_NO_PWR;
      }
      else {
         minor_alarms &= (~MINOR_ANT_NO_PWR);
      }

      if(t2 & 0x08) {  // backup param error
         critical_alarms |= CRIT_RTC;
      }
   }

   if(status == 0) {
      send_furuno_cmd("GPtrq,1");  // finish self test
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb4363
leaq 0x2e68da(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0xb4361
leaq 0x1c36c9(%rip), %rax    # 0x277a24
movl $0x214f, (%rax)         # imm = 0x214F
jmp 0xb4363
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb43d0
leaq 0x2e68ac(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0xbacc5(%rip), %xmm1    # 0x16f050
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
leaq 0x2e80da(%rip), %rax    # 0x39c474
movl %ecx, (%rax)
movsd -0x10(%rbp), %xmm0
movsd 0xbaca7(%rip), %xmm1    # 0x16f050
callq 0x94d0
cvttsd2si %xmm0, %ecx
leaq 0x2e80bf(%rip), %rax    # 0x39c478
movl %ecx, (%rax)
leaq 0x2b8792(%rip), %rax    # 0x36cb54
movl (%rax), %ecx
orl $0xf, %ecx
leaq 0x2b8786(%rip), %rax    # 0x36cb54
movl %ecx, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb43e9
leaq 0x2e683f(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x14(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb44c6
leaq 0x2e6822(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x18(%rbp)
leaq 0x2b7fa3(%rip), %rax    # 0x36c3b0
movl $0x0, (%rax)
leaq 0x2b806e(%rip), %rax    # 0x36c488
movl $0x1, (%rax)
leaq 0x2b7fe5(%rip), %rax    # 0x36c40c
movl $0x1, (%rax)
movl -0x18(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xb444d
leaq 0x2b7f71(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x2b7f65(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x18(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xb446d
leaq 0x2b7f51(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x2b7f45(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
movl -0x18(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xb448f
leaq 0x2b7f39(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x6, %ecx
leaq 0x2b7f2d(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xb44a4
leaq 0x2b7f22(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x7, %ecx
leaq 0x2b7f16(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
movl -0x18(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xb44c4
leaq 0x2b7efa(%rip), %rax    # 0x36c3b0
movl (%rax), %ecx
orl $0x10, %ecx
leaq 0x2b7eee(%rip), %rax    # 0x36c3b0
movl %ecx, (%rax)
jmp 0xb44c6
cmpl $0x0, -0x4(%rbp)
jne 0xb44d8
leaq 0xd1c40(%rip), %rdi     # 0x186113
callq 0x83270
addq $0x20, %rsp
popq %rbp
retq
nop