// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: check_tsip_end(unsigned char)
u08 check_tsip_end(u08 report_err)
{
   // handle the end of a TSIP message and check the error flags

   if(tsip_rptr != tsip_wptr) {  // we are not at the end of the message
      tsip_error |= END_ERROR;
   }
   if(tsip_error) {
      sprintf(out, "#     Bad packet. Err=%04X!", tsip_error);
      if(tsip_error & 0x08)   strcat(out, " byte ");
      if(tsip_error & 0x10)   strcat(out, " word ");
      if(tsip_error & 0x20)   strcat(out, " dword ");
      if(tsip_error & 0x40)   strcat(out, " float ");
      if(tsip_error & 0x80)   strcat(out, " double ");
      if(tsip_error & 0x100)  strcat(out, " tword ");
      if(tsip_error & 0x200)  strcat(out, " fp80 ");
      if(tsip_error & 0x400)  strcat(out, " NAN ");
      if(tsip_error & 0x800)  strcat(out, " range err ");
      if(tsip_error & 0x1000) strcat(out, " end err ");
      if(tsip_error & 0x2000) strcat(out, " eol ");
      if(tsip_error & 0x4000) strcat(out, " cksum ");
      if(tsip_error & 0x8000) strcat(out, " ovfl ");
      strcat(out, "\n");
      if(log_flush_mode && log_file) fflush(log_file);
      log_packet_id(out);

      ++bad_packets;
      return 1;
   }
   tsip_rptr = tsip_wptr = 0;
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x2d00af(%rip), %rax    # 0x322254
movzwl (%rax), %esi
leaq 0x2d00a3(%rip), %rcx    # 0x322252
leaq 0x1d6dba(%rip), %r14    # 0x228f70
movl (%r14), %edx
cmpw (%rcx), %si
jne 0x521d1
testl %edx, %edx
jne 0x521da
andw $0x0, (%rcx)
andw $0x0, (%rax)
xorl %eax, %eax
jmp 0x523ca
orl $0x1000, %edx           # imm = 0x1000
movl %edx, (%r14)
leaq 0x2d403f(%rip), %rbx    # 0x326220
leaq 0xb7f41(%rip), %rsi     # 0x10a129
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movl (%r14), %r14d
testb $0x8, %r14b
je 0x52212
movq %rbx, %rdi
callq 0x9120
movl $0x74796220, (%rbx,%rax) # imm = 0x74796220
movl $0x206574, 0x3(%rbx,%rax) # imm = 0x206574
testb $0x10, %r14b
je 0x5222f
movq %rbx, %rdi
callq 0x9120
movl $0x726f7720, (%rbx,%rax) # imm = 0x726F7720
movl $0x206472, 0x3(%rbx,%rax) # imm = 0x206472
movabsq $0x2064726f776420, %r15 # imm = 0x2064726F776420
testb $0x20, %r14b
je 0x5224b
movq %rbx, %rdi
callq 0x9120
movq %r15, (%rbx,%rax)
testb $0x40, %r14b
je 0x52267
movq %rbx, %rdi
callq 0x9120
movabsq $0x2074616f6c6620, %rcx # imm = 0x2074616F6C6620
movq %rcx, (%rbx,%rax)
testb %r14b, %r14b
jns 0x52287
movq %rbx, %rdi
callq 0x9120
movabsq $0x20656c62756f6420, %rcx # imm = 0x20656C62756F6420
movq %rcx, (%rbx,%rax)
movb $0x0, 0x8(%rbx,%rax)
btl $0x8, %r14d
jae 0x522a1
movq %rbx, %rdi
callq 0x9120
addq $0x1000, %r15           # imm = 0x1000
movq %r15, (%rbx,%rax)
btl $0x9, %r14d
jae 0x522bf
movq %rbx, %rdi
callq 0x9120
movl $0x38706620, (%rbx,%rax) # imm = 0x38706620
movl $0x203038, 0x3(%rbx,%rax) # imm = 0x203038
btl $0xa, %r14d
jae 0x522dc
movq %rbx, %rdi
callq 0x9120
movl $0x4e414e20, (%rbx,%rax) # imm = 0x4E414E20
movw $0x20, 0x4(%rbx,%rax)
btl $0xb, %r14d
jae 0x52301
movq %rbx, %rdi
callq 0x9120
movabsq $0x652065676e617220, %rcx # imm = 0x652065676E617220
movq %rcx, (%rbx,%rax)
movl $0x207272, 0x8(%rbx,%rax) # imm = 0x207272
btl $0xc, %r14d
jae 0x52325
movq %rbx, %rdi
callq 0x9120
movabsq $0x72726520646e6520, %rcx # imm = 0x72726520646E6520
movq %rcx, (%rbx,%rax)
movw $0x20, 0x8(%rbx,%rax)
btl $0xd, %r14d
jae 0x52342
movq %rbx, %rdi
callq 0x9120
movl $0x6c6f6520, (%rbx,%rax) # imm = 0x6C6F6520
movw $0x20, 0x4(%rbx,%rax)
btl $0xe, %r14d
jae 0x5235f
movq %rbx, %rdi
callq 0x9120
movabsq $0x206d75736b6320, %rcx # imm = 0x206D75736B6320
movq %rcx, (%rbx,%rax)
testw %r14w, %r14w
jns 0x5237c
movq %rbx, %rdi
callq 0x9120
movl $0x66766f20, (%rbx,%rax) # imm = 0x66766F20
movl $0x206c66, 0x3(%rbx,%rax) # imm = 0x206C66
movq %rbx, %rdi
callq 0x9120
leaq 0x1d6095(%rip), %rcx    # 0x228420
cmpl $0x0, (%rcx)
movw $0xa, (%rbx,%rax)
setne %al
leaq 0x1d5fc2(%rip), %rcx    # 0x228360
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x523b3
callq 0x9420
leaq 0x2d3e66(%rip), %rdi    # 0x326220
callq 0x520bf
leaq 0x1d6bc2(%rip), %rax    # 0x228f88
incl (%rax)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq