// File: /workspace/github_cpp_makefile_star2_O2/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
callq 0x51408
leaq 0x1b5121(%rip), %rax    # 0x228f6c
andl $0x0, (%rax)
leaq 0x2ae3ff(%rip), %rax    # 0x322254
andw $0x0, (%rax)
callq 0x51b3c
leaq 0x1b50f7(%rip), %rbx    # 0x228f5c
movw %ax, (%rbx)
leaq 0x1b50ef(%rip), %rcx    # 0x228f5e
xorl %edx, %edx
movb %dl, (%rcx)
leaq 0x2ad1af(%rip), %rcx    # 0x321029
movb %dl, (%rcx)
leaq 0x1b5115(%rip), %rcx    # 0x228f98
incq (%rcx)
leaq 0x1b50e3(%rip), %rcx    # 0x228f70
andl $0x0, (%rcx)
movl %eax, 0x2e1f2e(%rip)    # 0x355dc4
andw $0x0, 0x2e1f22(%rip)    # 0x355dc0
xorl %edi, %edi
callq 0x73d28
movl 0x2e6f51(%rip), %eax    # 0x35adfc
incl %eax
movl %eax, 0x2e6f49(%rip)    # 0x35adfc
cmpl $0x64, %eax
jne 0x73ede
leaq 0x28338d(%rip), %rax    # 0x2f724c
cmpl $0x0, (%rax)
jne 0x73ede
leaq 0x283f97(%rip), %rax    # 0x2f7e62
cmpb $0x0, (%rax)
jne 0x73ede
leaq 0xd3e59(%rip), %rax     # 0x147d30
andl $0x0, 0x2d0(%rax)
movzwl (%rbx), %eax
movzbl %al, %eax
movw %ax, (%rbx)
leal -0x40(%rax), %ecx
cmpl $0x2d, %ecx
ja 0x73f09
leaq 0x9502e(%rip), %rdx     # 0x108f24
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
callq 0x685a6
jmp 0x7403b
cmpl $0x1c, %eax
je 0x74036
cmpl $0x13, %eax
jne 0x73f24
pushq $0x13
popq %rdi
callq 0x73a8c
jmp 0x7403b
leal -0x70(%rax), %ecx
cmpl $0x14, %ecx
ja 0x74090
leaq 0x950a5(%rip), %rdx     # 0x108fdc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
callq 0x6aa7f
jmp 0x7403b
callq 0x6a574
jmp 0x7403b
pushq $0x5d
jmp 0x7401d
callq 0x6a3d2
jmp 0x7403b
callq 0x6967f
jmp 0x7403b
callq 0x6919f
jmp 0x7403b
callq 0x69731
jmp 0x7403b
callq 0x6a2ee
jmp 0x7403b
callq 0x687a7
jmp 0x7403b
callq 0x68922
jmp 0x7403b
callq 0x68def
jmp 0x7403b
callq 0x687d8
jmp 0x7403b
callq 0x69262
jmp 0x7403b
callq 0x685f5
jmp 0x7403b
callq 0x6a80c
jmp 0x7403b
callq 0x6916e
jmp 0x7403b
callq 0x6877b
jmp 0x7403b
callq 0x6985c
jmp 0x7403b
callq 0x68ec4
jmp 0x7403b
callq 0x690c4
jmp 0x7403b
callq 0x6988d
jmp 0x7403b
xorl %edi, %edi
jmp 0x7402f
callq 0x69126
jmp 0x7403b
callq 0x6934a
jmp 0x7403b
callq 0x693a4
jmp 0x7403b
callq 0x6a7ea
jmp 0x7403b
callq 0x693c1
jmp 0x7403b
pushq $0x5c
popq %rdi
callq 0x6a641
jmp 0x7403b
callq 0x6a291
jmp 0x7403b
pushq $0x1
popq %rdi
callq 0x6a832
jmp 0x7403b
callq 0x681ce
leaq 0x28429e(%rip), %rax    # 0x2f82e0
cmpb $0x0, 0x17a11(%rax)
je 0x74052
movb $0x0, 0x17a11(%rax)
leaq 0x1b4367(%rip), %rax    # 0x2283c0
cmpq $0x0, (%rax)
setne %al
leaq 0x199599(%rip), %rcx    # 0x20d600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x7407c
callq 0xae83
leaq 0x1b4f1d(%rip), %rax    # 0x228fa0
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x8f, %eax
je 0x74101
cmpl $0xbb, %eax
je 0x7410b
cmpl $0xdc, %eax
jne 0x740ac
callq 0x7170f
jmp 0x7403b
movzwl %ax, %edi
jmp 0x73f1a
callq 0x6ac47
jmp 0x7403b
callq 0x6acb2
jmp 0x7403b
callq 0x6ac21
jmp 0x7403b
callq 0x6ab11
jmp 0x7403b
callq 0x6ac81
jmp 0x7403b
callq 0x6aba4
jmp 0x7403b
callq 0x6abfb
jmp 0x7403b
callq 0x6ac64
jmp 0x7403b
callq 0x73977
jmp 0x7403b
callq 0x6f683
jmp 0x7403b