// File: 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
subq $0x10, %rsp
movb %dil, %al
movb %al, -0x2(%rbp)
leaq 0x31c53f(%rip), %rax    # 0x397434
movzwl (%rax), %eax
leaq 0x31c533(%rip), %rcx    # 0x397432
movzwl (%rcx), %ecx
cmpl %ecx, %eax
je 0x7af1e
leaq 0x223243(%rip), %rax    # 0x29e150
movl (%rax), %ecx
orl $0x1000, %ecx           # imm = 0x1000
leaq 0x223234(%rip), %rax    # 0x29e150
movl %ecx, (%rax)
leaq 0x22322b(%rip), %rax    # 0x29e150
cmpl $0x0, (%rax)
je 0x7b194
leaq 0x22321b(%rip), %rax    # 0x29e150
movl (%rax), %edx
leaq 0x3204c2(%rip), %rdi    # 0x39b400
leaq 0x1084fc(%rip), %rsi    # 0x183441
movb $0x0, %al
callq 0x9060
leaq 0x2231fd(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x7af70
leaq 0x32049c(%rip), %rdi    # 0x39b400
leaq 0x1084f2(%rip), %rsi    # 0x18345d
callq 0x96a0
leaq 0x2231d9(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x7af94
leaq 0x320478(%rip), %rdi    # 0x39b400
leaq 0x1084d5(%rip), %rsi    # 0x183464
callq 0x96a0
leaq 0x2231b5(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x7afb8
leaq 0x320454(%rip), %rdi    # 0x39b400
leaq 0x1084b8(%rip), %rsi    # 0x18346b
callq 0x96a0
leaq 0x223191(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x7afdc
leaq 0x320430(%rip), %rdi    # 0x39b400
leaq 0x10849c(%rip), %rsi    # 0x183473
callq 0x96a0
leaq 0x22316d(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x7b002
leaq 0x32040a(%rip), %rdi    # 0x39b400
leaq 0x10847e(%rip), %rsi    # 0x18347b
callq 0x96a0
leaq 0x223147(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x7b028
leaq 0x3203e4(%rip), %rdi    # 0x39b400
leaq 0x108461(%rip), %rsi    # 0x183484
callq 0x96a0
leaq 0x223121(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x7b04e
leaq 0x3203be(%rip), %rdi    # 0x39b400
leaq 0x108443(%rip), %rsi    # 0x18348c
callq 0x96a0
leaq 0x2230fb(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x7b074
leaq 0x320398(%rip), %rdi    # 0x39b400
leaq 0x108424(%rip), %rsi    # 0x183493
callq 0x96a0
leaq 0x2230d5(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x7b09a
leaq 0x320372(%rip), %rdi    # 0x39b400
leaq 0x108404(%rip), %rsi    # 0x183499
callq 0x96a0
leaq 0x2230af(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x7b0c0
leaq 0x32034c(%rip), %rdi    # 0x39b400
leaq 0x1083ea(%rip), %rsi    # 0x1834a5
callq 0x96a0
leaq 0x223089(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x7b0e6
leaq 0x320326(%rip), %rdi    # 0x39b400
leaq 0x1083ce(%rip), %rsi    # 0x1834af
callq 0x96a0
leaq 0x223063(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x7b10c
leaq 0x320300(%rip), %rdi    # 0x39b400
leaq 0x1083ae(%rip), %rsi    # 0x1834b5
callq 0x96a0
leaq 0x22303d(%rip), %rax    # 0x29e150
movl (%rax), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x7b132
leaq 0x3202da(%rip), %rdi    # 0x39b400
leaq 0x108390(%rip), %rsi    # 0x1834bd
callq 0x96a0
leaq 0x3202c7(%rip), %rdi    # 0x39b400
leaq 0x11d4e6(%rip), %rsi    # 0x198626
callq 0x96a0
leaq 0x2224b4(%rip), %rax    # 0x29d600
cmpl $0x0, (%rax)
je 0x7b16d
leaq 0x2223e8(%rip), %rax    # 0x29d540
cmpq $0x0, (%rax)
je 0x7b16d
leaq 0x2223db(%rip), %rax    # 0x29d540
movq (%rax), %rdi
callq 0x9430
leaq 0x32028c(%rip), %rdi    # 0x39b400
callq 0x7add0
leaq 0x222fe8(%rip), %rax    # 0x29e168
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x222fdc(%rip), %rax    # 0x29e168
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x7b1b0
leaq 0x31c297(%rip), %rax    # 0x397432
movw $0x0, (%rax)
leaq 0x31c28d(%rip), %rax    # 0x397434
movw $0x0, (%rax)
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)