// File: jkingan[P]ladyheather/heathgps.cpp
// Function: decode_ubx_msg()
void decode_ubx_msg()
{
static int ubx_bytes = 0;  // how many bytes received between time messages
   // Here we decode and parse Ublox UBX format messages

   start_msg_decode(1);
if(ubx_msg_id == UBX_UTC) ubx_bytes = (tsip_wptr+8);
else ubx_bytes += (tsip_wptr+8);
if(ubx_bytes > max_ubx_bytes) max_ubx_bytes = ubx_bytes;
if(1 && debug_file) {  //plugh
   fprintf(debug_file, "Decode UBX: %04X  len:%-3d  bytes:%-4d  max:%-4d\n", ubx_msg_id,tsip_wptr+8, ubx_bytes, max_ubx_bytes);
}

   if     (ubx_msg_id == UBX_NAV)        parse_ubx_nav();
   else if(ubx_msg_id == UBX_STATUS)     parse_ubx_status();
   else if(ubx_msg_id == UBX_CLOCK)      parse_ubx_clock();
   else if(ubx_msg_id == UBX_DOP)        parse_ubx_dop();
   else if(ubx_msg_id == UBX_SPEED)      parse_ubx_speed();
   else if(ubx_msg_id == UBX_UTC)        parse_ubx_utc();
   else if(ubx_msg_id == UBX_GPS)        parse_ubx_gps();
   else if(ubx_msg_id == UBX_SVN)        parse_ubx_svn();
   else if(ubx_msg_id == UBX_RAW)        parse_ubx_raw();
   else if(ubx_msg_id == UBX_RAWX)       parse_ubx_rawx();
   else if(ubx_msg_id == UBX_SBAS)       parse_ubx_sbas();
   else if(ubx_msg_id == UBX_ORB)        parse_ubx_orb();
   else if(ubx_msg_id == UBX_SOL)        parse_ubx_sol();
   else if(ubx_msg_id == UBX_SFRBX)      parse_ubx_sfrbx();
   else if(ubx_msg_id == UBX_SFRB)       parse_ubx_sfrb();
   else if(ubx_msg_id == TRK_SFRBX)      parse_trk_sfrbx();
   else if(ubx_msg_id == TRK_MEAS)       parse_trk_meas();
   else if(ubx_msg_id == UBX_PPS)        parse_ubx_pps();
   else if(ubx_msg_id == UBX_TP)         parse_ubx_tp();
   else if(ubx_msg_id == UBX_TP5)        parse_ubx_tp5();
   else if(ubx_msg_id == UBX_GNSS)       parse_ubx_gnss();
   else if(ubx_msg_id == UBX_CFG)        parse_ubx_cfg();
   else if(ubx_msg_id == UBX_MON)        parse_ubx_mon();
   else if(ubx_msg_id == UBX_VER)        parse_ubx_ver();
   else if(ubx_msg_id == UBX_LEAP)       parse_ubx_leap();
   else if(ubx_msg_id == UBX_DATUM)      parse_ubx_datum();
   else if(ubx_msg_id == UBX_NAK)        parse_ubx_nak();
   else if(ubx_msg_id == UBX_ACK)        parse_ubx_ack();
   else if(ubx_msg_id == UBX_CFG_ANT)    parse_ubx_ant();
   else if(ubx_msg_id == UBX_NAVX5)      parse_ubx_navx5();
   else if(ubx_msg_id == UBX_CFG_TMODE)  parse_ubx_tmode(1);
   else if(ubx_msg_id == UBX_CFG_TMODE2) parse_ubx_tmode(2);  // M8T
   else if(ubx_msg_id == UBX_NAV_RATE)   parse_ubx_rate();
   else if(ubx_msg_id == UBX_SVIN)       parse_ubx_svin();
   else                                  ignore_ubx_msg(ubx_msg_id);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x1, %edi
callq 0xae4a0
movzwl 0x2ffe0b(%rip), %eax    # 0x3cbc60
cmpl $0x121, %eax            # imm = 0x121
jne 0xcbe71
leaq 0x2cb5cf(%rip), %rax    # 0x397432
movzwl (%rax), %eax
addl $0x8, %eax
movl %eax, 0x305239(%rip)    # 0x3d10a8
jmp 0xcbe8a
leaq 0x2cb5ba(%rip), %rax    # 0x397432
movzwl (%rax), %eax
addl $0x8, %eax
addl 0x305224(%rip), %eax    # 0x3d10a8
movl %eax, 0x30521e(%rip)    # 0x3d10a8
movl 0x305218(%rip), %eax    # 0x3d10a8
cmpl 0x2ffdda(%rip), %eax    # 0x3cbc70
jle 0xcbea4
movl 0x30520a(%rip), %eax    # 0x3d10a8
movl %eax, 0x2ffdcc(%rip)    # 0x3cbc70
leaq 0x1d16c5(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xcbeeb
leaq 0x1d16b8(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movzwl 0x2ffd9e(%rip), %edx    # 0x3cbc60
leaq 0x2cb569(%rip), %rax    # 0x397432
movzwl (%rax), %ecx
addl $0x8, %ecx
movl 0x3051d2(%rip), %r8d    # 0x3d10a8
movl 0x2ffd93(%rip), %r9d    # 0x3cbc70
leaq 0xbbc1f(%rip), %rsi     # 0x187b03
movb $0x0, %al
callq 0x9550
movzwl 0x2ffd6e(%rip), %eax    # 0x3cbc60
cmpl $0x102, %eax            # imm = 0x102
jne 0xcbf03
callq 0xc9650
jmp 0xcc264
movzwl 0x2ffd56(%rip), %eax    # 0x3cbc60
cmpl $0x103, %eax            # imm = 0x103
jne 0xcbf1b
callq 0xc9780
jmp 0xcc262
movzwl 0x2ffd3e(%rip), %eax    # 0x3cbc60
cmpl $0x122, %eax            # imm = 0x122
jne 0xcbf33
callq 0xc98e0
jmp 0xcc260
movzwl 0x2ffd26(%rip), %eax    # 0x3cbc60
cmpl $0x104, %eax            # imm = 0x104
jne 0xcbf4b
callq 0xc9920
jmp 0xcc25e
movzwl 0x2ffd0e(%rip), %eax    # 0x3cbc60
cmpl $0x112, %eax            # imm = 0x112
jne 0xcbf63
callq 0xc9a50
jmp 0xcc25c
movzwl 0x2ffcf6(%rip), %eax    # 0x3cbc60
cmpl $0x121, %eax            # imm = 0x121
jne 0xcbf7b
callq 0xc9b10
jmp 0xcc25a
movzwl 0x2ffcde(%rip), %eax    # 0x3cbc60
cmpl $0x120, %eax            # imm = 0x120
jne 0xcbf93
callq 0xc9d70
jmp 0xcc258
movzwl 0x2ffcc6(%rip), %eax    # 0x3cbc60
cmpl $0x130, %eax            # imm = 0x130
jne 0xcbfab
callq 0xc9f00
jmp 0xcc256
movzwl 0x2ffcae(%rip), %eax    # 0x3cbc60
cmpl $0x210, %eax            # imm = 0x210
jne 0xcbfc3
callq 0xca1e0
jmp 0xcc254
movzwl 0x2ffc96(%rip), %eax    # 0x3cbc60
cmpl $0x215, %eax            # imm = 0x215
jne 0xcbfdb
callq 0xca510
jmp 0xcc252
movzwl 0x2ffc7e(%rip), %eax    # 0x3cbc60
cmpl $0x132, %eax            # imm = 0x132
jne 0xcbff3
callq 0xca930
jmp 0xcc250
movzwl 0x2ffc66(%rip), %eax    # 0x3cbc60
cmpl $0x134, %eax            # imm = 0x134
jne 0xcc00b
callq 0xca910
jmp 0xcc24e
movzwl 0x2ffc4e(%rip), %eax    # 0x3cbc60
cmpl $0x106, %eax            # imm = 0x106
jne 0xcc023
callq 0xca9b0
jmp 0xcc24c
movzwl 0x2ffc36(%rip), %eax    # 0x3cbc60
cmpl $0x213, %eax            # imm = 0x213
jne 0xcc03b
callq 0xca970
jmp 0xcc24a
movzwl 0x2ffc1e(%rip), %eax    # 0x3cbc60
cmpl $0x211, %eax            # imm = 0x211
jne 0xcc053
callq 0xca950
jmp 0xcc248
movzwl 0x2ffc06(%rip), %eax    # 0x3cbc60
cmpl $0x310, %eax            # imm = 0x310
jne 0xcc06b
callq 0xca990
jmp 0xcc246
movzwl 0x2ffbee(%rip), %eax    # 0x3cbc60
cmpl $0x30f, %eax            # imm = 0x30F
jne 0xcc083
callq 0xca9d0
jmp 0xcc244
movzwl 0x2ffbd6(%rip), %eax    # 0x3cbc60
cmpl $0x607, %eax            # imm = 0x607
jne 0xcc09b
callq 0xcb000
jmp 0xcc242
movzwl 0x2ffbbe(%rip), %eax    # 0x3cbc60
cmpl $0xd01, %eax            # imm = 0xD01
jne 0xcc0b3
callq 0xcbb20
jmp 0xcc240
movzwl 0x2ffba6(%rip), %eax    # 0x3cbc60
cmpl $0x631, %eax            # imm = 0x631
jne 0xcc0cb
callq 0xcb190
jmp 0xcc23e
movzwl 0x2ffb8e(%rip), %eax    # 0x3cbc60
cmpl $0x63e, %eax            # imm = 0x63E
jne 0xcc0e3
callq 0xcbc10
jmp 0xcc23c
movzwl 0x2ffb76(%rip), %eax    # 0x3cbc60
cmpl $0x624, %eax            # imm = 0x624
jne 0xcc0fb
callq 0xcaf80
jmp 0xcc23a
movzwl 0x2ffb5e(%rip), %eax    # 0x3cbc60
cmpl $0xa09, %eax            # imm = 0xA09
jne 0xcc113
callq 0xca9f0
jmp 0xcc238
movzwl 0x2ffb46(%rip), %eax    # 0x3cbc60
cmpl $0xa04, %eax            # imm = 0xA04
jne 0xcc12b
callq 0xcad80
jmp 0xcc236
movzwl 0x2ffb2e(%rip), %eax    # 0x3cbc60
cmpl $0xb02, %eax            # imm = 0xB02
jne 0xcc143
callq 0xc9e10
jmp 0xcc234
movzwl 0x2ffb16(%rip), %eax    # 0x3cbc60
cmpl $0x606, %eax            # imm = 0x606
jne 0xcc15b
callq 0xcaf50
jmp 0xcc232
movzwl 0x2ffafe(%rip), %eax    # 0x3cbc60
cmpl $0x500, %eax            # imm = 0x500
jne 0xcc173
callq 0xc95f0
jmp 0xcc230
movzwl 0x2ffae6(%rip), %eax    # 0x3cbc60
cmpl $0x501, %eax            # imm = 0x501
jne 0xcc18b
callq 0xc9620
jmp 0xcc22e
movzwl 0x2fface(%rip), %eax    # 0x3cbc60
cmpl $0x613, %eax            # imm = 0x613
jne 0xcc1a3
callq 0xcaaf0
jmp 0xcc22c
movzwl 0x2ffab6(%rip), %eax    # 0x3cbc60
cmpl $0x623, %eax            # imm = 0x623
jne 0xcc1b8
callq 0xcacf0
jmp 0xcc22a
movzwl 0x2ffaa1(%rip), %eax    # 0x3cbc60
cmpl $0x61d, %eax            # imm = 0x61D
jne 0xcc1d2
movl $0x1, %edi
callq 0xcab20
jmp 0xcc228
movzwl 0x2ffa87(%rip), %eax    # 0x3cbc60
cmpl $0x63d, %eax            # imm = 0x63D
jne 0xcc1ec
movl $0x2, %edi
callq 0xcab20
jmp 0xcc226
movzwl 0x2ffa6d(%rip), %eax    # 0x3cbc60
cmpl $0x608, %eax            # imm = 0x608
jne 0xcc201
callq 0xcbba0
jmp 0xcc224
movzwl 0x2ffa58(%rip), %eax    # 0x3cbc60
cmpl $0xd04, %eax            # imm = 0xD04
jne 0xcc216
callq 0xcac10
jmp 0xcc222
movzwl 0x2ffa43(%rip), %edi    # 0x3cbc60
callq 0xcbe00
jmp 0xcc224
jmp 0xcc226
jmp 0xcc228
jmp 0xcc22a
jmp 0xcc22c
jmp 0xcc22e
jmp 0xcc230
jmp 0xcc232
jmp 0xcc234
jmp 0xcc236
jmp 0xcc238
jmp 0xcc23a
jmp 0xcc23c
jmp 0xcc23e
jmp 0xcc240
jmp 0xcc242
jmp 0xcc244
jmp 0xcc246
jmp 0xcc248
jmp 0xcc24a
jmp 0xcc24c
jmp 0xcc24e
jmp 0xcc250
jmp 0xcc252
jmp 0xcc254
jmp 0xcc256
jmp 0xcc258
jmp 0xcc25a
jmp 0xcc25c
jmp 0xcc25e
jmp 0xcc260
jmp 0xcc262
jmp 0xcc264
leaq 0x1d1335(%rip), %rax    # 0x29d5a0
cmpq $0x0, (%rax)
je 0xcc28f
leaq 0x1b6568(%rip), %rax    # 0x2827e0
cmpq $0x0, (%rax)
je 0xcc28f
leaq 0x1b655b(%rip), %rax    # 0x2827e0
movq (%rax), %rax
movl %eax, %edi
callq 0xb8b0
leaq 0x1d1eea(%rip), %rax    # 0x29e180
movl $0x1, (%rax)
popq %rbp
retq
nop