// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: decode_tsip_message()
void decode_tsip_message()
{
   flush_debug();

   msg_fault = 0x00;
   tsip_rptr = 0;
   msg_id = get_next_tsip();

   subcode = 0x00;
   first_msg = 0;
   last_msg = msg_id;
   ++wakeup_tsip_msg; // we have seen a TSIP message
   tsip_error = 0;    // this flag gets set if we see something wrong in a message
   early_end = 0;
   new_packet(0);

   ++tsip_packets;
   if(tsip_packets == 100) {
      if((have_temperature == 0) && (user_set_temp_plot == 0)) {  // no temperature readings to plot
         plot[TEMP].show_plot = 0;
      }
   }

   msg_id &= 0xFF;
   if     (msg_id == 0x13) get_unknown_msg(0x13);
   else if(msg_id == 0x1C) get_ebolt_version();
   else if(msg_id == 0x40) get_almanac_data();     // almanac data page
   else if(msg_id == 0x41) get_gps_time();         // ntpx, RES 360. SV6 family
   else if(msg_id == 0x42) get_single_ecef_fix();
   else if(msg_id == 0x43) get_velocity_fix();
   else if(msg_id == 0x44) get_sv6_sat_list();
   else if(msg_id == 0x45) get_version_info();
   else if(msg_id == 0x46) get_ebolt_health1();
   else if(msg_id == 0x47) get_sig_levels();
   else if(msg_id == 0x48) get_system_msg();       // GPS system message (get with packet 0x28)
   else if(msg_id == 0x49) get_alm_health();
   else if(msg_id == 0x4A) get_single_lla_fix(); 
   else if(msg_id == 0x4B) get_ebolt_health2();
   else if(msg_id == 0x4C) get_sv6_config(); 
   else if(msg_id == 0x4D) get_sv6_osc_offset(); 
   else if(msg_id == 0x4E) get_set_time_response(); //response to set GPS time (packet 0x2E)
   else if(msg_id == 0x4F) get_sv6_utc_info(); 
   else if(msg_id == 0x54) get_clock_bias();
   else if(msg_id == 0x55) get_io_options();
   else if(msg_id == 0x56) get_enu_velocity_fix();
   else if(msg_id == 0x57) get_last_fix_info();
   else if(msg_id == 0x58) get_packet_58();
   else if(msg_id == 0x59) get_sat_health();
   else if(msg_id == 0x5A) get_raw_data();
   else if(msg_id == 0x5B) get_eph_status();
   else if(msg_id == 0x5C) get_sat_tracking(0x5C);
   else if(msg_id == 0x5D) get_sat_tracking(0x5D); // res 360 receiver
   else if(msg_id == 0x5E) get_fix_status();       // additional fix status
   else if(msg_id == 0x5F) get_eeprom_status();
   else if(msg_id == 0x6C) get_sat_list(1);        // res 360 receiver
   else if(msg_id == 0x6D) get_sat_list(0);
   else if(msg_id == 0x70) get_filter_config();
   else if(msg_id == 0x72) get_posn_filter();
   else if(msg_id == 0x74) get_alt_filter();
   else if(msg_id == 0x75) get_high8_mode();
   else if(msg_id == 0x76) get_high6_mode();
   else if(msg_id == 0x78) get_diff_age();
   else if(msg_id == 0x82) get_diff_mode();
   else if(msg_id == 0x83) get_ecef_fix();
   else if(msg_id == 0x84) get_lla_fix();
   else if(msg_id == 0x8F) get_timing_msg();
   else if(msg_id == 0xBB) get_tsip_config();
   else if(msg_id == LUXOR_ID) get_luxor_packet();
   else                        get_unknown_msg(msg_id);

   if(com[RCVR_PORT].com_error) {    // we had a com timeout so were skipping serial reads
      com[RCVR_PORT].com_error = 0;  // we can stop searching since data is now comming in
   }

   if(sim_file && sim_delay) {  // throttle sim file messages
      Sleep(sim_delay);
   }
   saw_rcvr_msg = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x1bee7f(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x7f52a
leaq 0x1bef08(%rip), %rax    # 0x23e428
cmpl $0x0, (%rax)
je 0x7f52a
callq 0x9420
leaq 0x1bfa3b(%rip), %rax    # 0x23ef6c
movl $0x0, (%rax)
leaq 0x2b8d16(%rip), %rax    # 0x338254
xorl %ecx, %ecx
movw %cx, (%rax)
movw %cx, 0x2ec876(%rip)     # 0x36bdc0
leaq 0x2b8d01(%rip), %rdx    # 0x338252
cmpw %cx, (%rdx)
je 0x7f567
movw $0x1, (%rax)
leaq 0x2b7cee(%rip), %rax    # 0x337250
movzbl (%rax), %eax
jmp 0x7f56c
movl $0x2000, %eax           # imm = 0x2000
leaq 0x1bf9e9(%rip), %rbx    # 0x23ef5c
movw %ax, (%rbx)
leaq 0x1bf9e1(%rip), %rcx    # 0x23ef5e
xorl %edx, %edx
movb %dl, (%rcx)
leaq 0x2b7aa1(%rip), %rcx    # 0x337029
movb %dl, (%rcx)
leaq 0x1bfa07(%rip), %rcx    # 0x23ef98
incq (%rcx)
movl %eax, 0x2ec82a(%rip)    # 0x36bdc4
leaq 0x1bf9cf(%rip), %rax    # 0x23ef70
movl $0x0, (%rax)
movw $0x0, 0x2ec810(%rip)    # 0x36bdc0
xorl %edi, %edi
callq 0x7f3d1
movl 0x2f183f(%rip), %eax    # 0x370dfc
incl %eax
movl %eax, 0x2f1837(%rip)    # 0x370dfc
cmpl $0x64, %eax
jne 0x7f5f3
leaq 0x28dc7b(%rip), %rax    # 0x30d24c
cmpl $0x0, (%rax)
jne 0x7f5f3
leaq 0x28e885(%rip), %rax    # 0x30de62
cmpb $0x0, (%rax)
jne 0x7f5f3
leaq 0xde747(%rip), %rax     # 0x15dd30
movl $0x0, 0x2d0(%rax)
movzbl (%rbx), %eax
movw %ax, (%rbx)
leal -0x40(%rax), %ecx
cmpl $0x2d, %ecx
ja 0x7f61b
leaq 0x9f918(%rip), %rdx     # 0x11ef20
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
callq 0x72098
jmp 0x7f768
cmpl $0x1c, %eax
je 0x7f763
cmpl $0x13, %eax
jne 0x7f638
movl $0x13, %edi
callq 0x7f0fb
jmp 0x7f768
movzwl %ax, %edi
cmpl $0x8e, %edi
jg 0x7f7bd
leal -0x70(%rdi), %eax
cmpl $0x14, %eax
ja 0x7f83d
leaq 0x9f97e(%rip), %rcx     # 0x11efd8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x74c0c
jmp 0x7f768
callq 0x7459f
jmp 0x7f768
movl $0x5d, %edi
jmp 0x7f749
callq 0x743e9
jmp 0x7f768
callq 0x73423
jmp 0x7f768
callq 0x72e6c
jmp 0x7f768
callq 0x734dc
jmp 0x7f768
callq 0x742ae
jmp 0x7f768
callq 0x722f3
jmp 0x7f768
callq 0x724f3
jmp 0x7f768
callq 0x72a65
jmp 0x7f768
callq 0x72324
jmp 0x7f768
callq 0x72f61
jmp 0x7f768
callq 0x720f8
jmp 0x7f768
callq 0x7494d
jmp 0x7f768
callq 0x72e3b
jmp 0x7f768
callq 0x722c7
jmp 0x7f768
callq 0x73665
jmp 0x7f768
callq 0x72b57
jmp 0x7f768
callq 0x72d59
jmp 0x7f768
callq 0x73696
jmp 0x7f768
xorl %edi, %edi
jmp 0x7f75c
callq 0x72dda
jmp 0x7f768
callq 0x73060
jmp 0x7f768
callq 0x730bd
jmp 0x7f768
callq 0x74909
jmp 0x7f768
callq 0x730eb
jmp 0x7f768
movl $0x5c, %edi
callq 0x746bb
jmp 0x7f768
callq 0x741f3
jmp 0x7f768
movl $0x1, %edi
callq 0x74984
jmp 0x7f768
callq 0x71b8e
leaq 0x28eb71(%rip), %rax    # 0x30e2e0
cmpb $0x0, 0x17a11(%rax)
je 0x7f77f
movb $0x0, 0x17a11(%rax)
leaq 0x1bec3a(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
setne %al
leaq 0x1a3e6c(%rip), %rcx    # 0x223600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x7f7a9
callq 0xaff7
leaq 0x1bf7f0(%rip), %rax    # 0x23efa0
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x8f, %edi
je 0x7f829
cmpl $0xbb, %edi
je 0x7f833
cmpl $0xdc, %edi
jne 0x7f83d
callq 0x7cab7
jmp 0x7f768
callq 0x74e3a
jmp 0x7f768
callq 0x74ce2
jmp 0x7f768
callq 0x74dcc
jmp 0x7f768
callq 0x74eb6
jmp 0x7f768
callq 0x74d75
jmp 0x7f768
callq 0x74e57
jmp 0x7f768
callq 0x74e85
jmp 0x7f768
callq 0x74e03
jmp 0x7f768
callq 0x7efc2
jmp 0x7f768
callq 0x79fd9
jmp 0x7f768
jmp 0x7f62e