// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_perdsys()
void parse_perdsys()
{
   get_msg_field();
   if(strstr(msg_field, "VERSION")) {  
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_device, msg_field);
      }
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_version, msg_field);
      }
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_query, msg_field);
      }
      if(get_msg_field()) {
         msg_field[32] = 0;
         strcpy(esip_model, msg_field);
         if(strstr(esip_model, "GT8736")) furuno_type = 8736;
         else if(strstr(esip_model, "GT87")) furuno_type = 87;
         else furuno_type = 0;
      }
      have_info |= ALL_ID_INFO;
   }
   else if(strstr(msg_field, "GPIO")) {  // gpio0 .. gpio8
      if(get_msg_field()) { 
         minor_alarms &= (~MINOR_ANT_NO_PWR);
         // !!!!!! this decode does NOT match the G87 docs !!!!!
         if(furuno_type == 8736) {  // GT8736
            if     ((msg_field[0] == 'H') && (msg_field[2] == 'L')) minor_alarms |= MINOR_ANT_SHORT;  // short
            else if((msg_field[0] == 'H') && (msg_field[2] == 'H')) minor_alarms |= MINOR_ANT_OPEN;   // open
            else if((msg_field[0] == 'L') && (msg_field[2] == 'H')) ;  // normal
            else if((msg_field[0] == 'L') && (msg_field[2] == 'L')) minor_alarms |= MINOR_ANT_NO_PWR; // unkn
         }
         else {  // GT87
            if     ((msg_field[0] == 'L') && (msg_field[2] == 'H')) minor_alarms |= MINOR_ANT_SHORT;  // short
            else if((msg_field[0] == 'H') && (msg_field[2] == 'H')) minor_alarms |= MINOR_ANT_OPEN;   // open
            else if((msg_field[0] == 'H') && (msg_field[2] == 'L')) ;  // normal
            else if((msg_field[0] == 'L') && (msg_field[2] == 'L')) minor_alarms |= MINOR_ANT_NO_PWR; // unkn
         }
         have_antenna = 87;
//sprintf(debug_text, "GPIO:%s", msg_field);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
callq 0x75767
leaq 0x2acefe(%rip), %rbx    # 0x325a40
leaq 0x9517d(%rip), %rsi     # 0x10dcc6
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x78c1c
callq 0x75767
testl %eax, %eax
je 0x78b76
movb $0x0, 0x20(%rbx)
leaq 0x2ae742(%rip), %rdi    # 0x3272b0
movq %rbx, %rsi
callq 0x9330
callq 0x75767
testl %eax, %eax
je 0x78b92
movb $0x0, 0x20(%rbx)
leaq 0x2ae756(%rip), %rdi    # 0x3272e0
movq %rbx, %rsi
callq 0x9330
callq 0x75767
testl %eax, %eax
je 0x78bae
movb $0x0, 0x20(%rbx)
leaq 0x2ae76a(%rip), %rdi    # 0x327310
movq %rbx, %rsi
callq 0x9330
callq 0x75767
testl %eax, %eax
je 0x78c0d
movb $0x0, 0x20(%rbx)
leaq 0x2ae77e(%rip), %r14    # 0x327340
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9330
leaq 0x94279(%rip), %rsi     # 0x10ce4d
movq %r14, %rdi
callq 0x9090
movl $0x2220, %ecx           # imm = 0x2220
testq %rax, %rax
jne 0x78c04
leaq 0x2ae753(%rip), %rdi    # 0x327340
leaq 0x94260(%rip), %rsi     # 0x10ce54
callq 0x9090
xorl %edx, %edx
testq %rax, %rax
pushq $0x57
popq %rcx
cmovel %edx, %ecx
leaq 0x27f195(%rip), %rax    # 0x2f7da0
movl %ecx, (%rax)
leaq 0x27ed60(%rip), %rax    # 0x2f7974
orb $0xf, (%rax)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2ace1d(%rip), %rbx    # 0x325a40
leaq 0x91bc4(%rip), %rsi     # 0x10a7ee
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x78c17
callq 0x75767
testl %eax, %eax
je 0x78c17
leaq 0x27e591(%rip), %rax    # 0x2f71d8
movl (%rax), %ecx
movl %ecx, %edx
andl $-0x7, %edx
movl %edx, (%rax)
leaq 0x27f149(%rip), %rsi    # 0x2f7da0
cmpl $0x2220, (%rsi)         # imm = 0x2220
movb (%rbx), %dil
movb 0x2(%rbx), %sil
movl %edi, %r8d
jne 0x78cac
xorb $0x48, %r8b
movl %esi, %r9d
xorb $0x4c, %r9b
orb %r8b, %r9b
je 0x78cbf
movl %esi, %r9d
xorb $0x48, %r9b
orb %r9b, %r8b
je 0x78ccd
cmpb $0x48, %sil
sete %dl
cmpb $0x4c, %sil
sete %sil
cmpb $0x4c, %dil
sete %dil
andb %dil, %dl
xorb %dil, %dl
andb %sil, %dl
cmpb $0x1, %dl
je 0x78cdb
jmp 0x78ce2
xorb $0x4c, %r8b
movl %esi, %r9d
xorb $0x48, %r9b
movl %r8d, %r10d
orb %r9b, %r10b
jne 0x78cc4
orl $0x4, %edx
jmp 0x78ce0
xorb $0x48, %dil
orb %r9b, %dil
jne 0x78cd2
orl $0x2, %edx
jmp 0x78ce0
xorb $0x4c, %sil
orb %sil, %r8b
jne 0x78ce2
orl $0x6, %ecx
movl %ecx, %edx
movl %edx, (%rax)
leaq 0x27e543(%rip), %rax    # 0x2f722c
movl $0x57, (%rax)
jmp 0x78c17