// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: send_byte(unsigned char)
void send_byte(u08 val)
{
   // send a byte to the receiver and update the message checksum
   // NEW_RCVR
   if(log_file && (log_stream & LOG_PACKET_START)) {
      if(superpacket) fprintf(log_file, "Superpacket:    %02X\n", val);
   }
   if(log_file && (log_stream & LOG_SENT_DATA) && sts) fprintf(log_file, "{%02X} ", val);

   superpacket = 0;

   sendout(RCVR_PORT, val, eom_flag);  
   ++tsip_send_count;

   nmea_tx_cksum ^= val;  // we always update these since we may need to send
   moto_tx_cksum ^= val;  // ... messaages in these formats to wake up other receivers
   venus_tx_cksum ^= val;
   sirf_tx_cksum += val;
   ss_tx_cksum += val;
   rt17_tx_cksum += val;

   if(rcvr_type == TSIP_RCVR) {
      if(val == DLE) {  // we are sending a TSIP message
         sendout(RCVR_PORT, DLE, eom_flag);  // DLE character must be sent twice
         ++tsip_send_count;
      }
   }
   else if(rcvr_type == NVS_RCVR) {
      nvs_tx_crc = calc_nvs_crc(nvs_tx_crc, val);
      if(val == DLE) {  // we are sending a TSIP message
         nvs_tx_crc = calc_nvs_crc(nvs_tx_crc, DLE);
         sendout(RCVR_PORT, DLE, eom_flag);  // DLE character must be sent twice
         ++tsip_send_count;
      }
   }
   else if(rcvr_type == UBX_RCVR) { // sending ublox ubx message
      ubx_txa += val;    // add byte to message checksums
      ubx_txb += ubx_txa;
   }
   else if(rcvr_type == ZODIAC_RCVR) {
      if(zodiac_tx_cnt & 1) zodiac_tx_cksum += ( (((u16) val) * 256) + zodiac_low_byte );
      else zodiac_low_byte = (u16) val;
      ++zodiac_tx_cnt;
   }

   eom_flag = ADD_CHAR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edi, %ebx
leaq 0x1d5f5a(%rip), %r12    # 0x228360
movq (%r12), %rdi
movzbl %bl, %r14d
testq %rdi, %rdi
je 0x52463
leaq 0x1d5ff6(%rip), %r15    # 0x228410
testb $0x4, (%r15)
je 0x52443
cmpb $0x0, 0x307be9(%rip)    # 0x35a010
je 0x52443
leaq 0xb7d5c(%rip), %rsi     # 0x10a18c
movl %r14d, %edx
xorl %eax, %eax
callq 0x9560
movq (%r12), %rdi
testq %rdi, %rdi
je 0x52463
testb $0x10, (%r15)
je 0x52463
cmpl $0x0, 0x307bc4(%rip)    # 0x35a014
je 0x52463
leaq 0xb7d49(%rip), %rsi     # 0x10a1a2
movl %r14d, %edx
xorl %eax, %eax
callq 0x9560
movb $0x0, 0x307ba6(%rip)    # 0x35a010
movl 0x3039a0(%rip), %edx    # 0x355e10
pushq $0xa
popq %rdi
movl %r14d, %esi
callq 0xba3b
incl 0x303997(%rip)          # 0x355e18
xorb %r14b, 0x30462e(%rip)   # 0x356ab6
xorb %r14b, 0x304634(%rip)   # 0x356ac3
xorb %r14b, 0x30463d(%rip)   # 0x356ad3
addw %r14w, 0x304656(%rip)   # 0x356af4
addw %r14w, 0x304616(%rip)   # 0x356abc
addb %r14b, 0x304613(%rip)   # 0x356ac0
leaq 0x1b041c(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x800, %rax            # imm = 0x800
je 0x5250d
cmpq $0x4, %rax
je 0x524e1
cmpq $0x100, %rax            # imm = 0x100
je 0x524f8
cmpq $0x1, %rax
jne 0x52589
cmpb $0x10, %bl
je 0x52552
jmp 0x52589
addb 0x304591(%rip), %bl     # 0x356a78
movb %bl, 0x30458b(%rip)     # 0x356a78
addb %bl, 0x304586(%rip)     # 0x356a79
jmp 0x52589
movzwl 0x304619(%rip), %eax    # 0x356b18
testb $0x1, %al
jne 0x5256b
movw %r14w, 0x304629(%rip)   # 0x356b34
jmp 0x52580
movzwl 0x3045f0(%rip), %edx    # 0x356b04
movl %edx, %eax
shrl $0x8, %eax
movzwl %r14w, %ecx
xorl %eax, %ecx
shll $0x8, %edx
leaq 0x101e57(%rip), %rax    # 0x154380
movzwl (%rax,%rcx,2), %ecx
xorl %ecx, %edx
movw %dx, 0x3045ce(%rip)     # 0x356b04
cmpb $0x10, %bl
jne 0x52589
movzwl %dx, %edx
shrl $0x8, %edx
xorl $0x10, %edx
shll $0x8, %ecx
xorw (%rax,%rdx,2), %cx
movw %cx, 0x3045b2(%rip)     # 0x356b04
movl 0x3038b8(%rip), %edx    # 0x355e10
pushq $0xa
popq %rdi
pushq $0x10
popq %rsi
callq 0xba3b
incl 0x3038af(%rip)          # 0x355e18
jmp 0x52589
movzwl %r14w, %ecx
shll $0x8, %ecx
addw 0x3045bb(%rip), %cx     # 0x356b34
addw %cx, 0x30459a(%rip)     # 0x356b1a
incl %eax
movw %ax, 0x30458f(%rip)     # 0x356b18
andl $0x0, 0x303880(%rip)    # 0x355e10
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq