// File: DoubleString[P]RtConverter/src/Rtklib/ublox.cpp
// Function: bamboo::decode_rxmsfrbx(bamboo::raw_t*)
static int decode_rxmsfrbx(raw_t *raw)
{
    int prn,sat,sys;
    unsigned char *p=raw->buff+6;
    
    trace(4,"decode_rxmsfrbx: len=%d\n",raw->len);
    
    if (raw->outtype) {
        sprintf(raw->msgtype,"UBX RXM-SFRBX (%4d): sys=%d prn=%3d",raw->len,
                U1(p),U1(p+1));
    }
    if (!(sys=ubx_sys(U1(p)))) {
        trace(2,"ubx rxmsfrbx sys id error: sys=%d\n",U1(p));
        return -1;
    }
    prn=U1(p+1)+(sys==SYS_QZS?192:0);
    if (!(sat=satno(sys,prn))) {
        if (sys==SYS_GLO&&prn==255) {
            return 0; /* suppress error for unknown glo satellite */
        }
        trace(2,"ubx rxmsfrbx sat number error: sys=%d prn=%d\n",sys,prn);
        return -1;
    }
    switch (sys) {
        case SYS_GPS: return decode_nav (raw,sat,8);
        case SYS_QZS: return decode_nav (raw,sat,8);
        case SYS_GAL: return decode_enav(raw,sat,8);
        case SYS_CMP: return decode_cnav(raw,sat,8);
        case SYS_GLO: return decode_gnav(raw,sat,8,U1(p+3));
        case SYS_SBS: return decode_snav(raw,sat,8);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x81a90, %rax          # imm = 0x81A90
addq $0x6, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x81a78(%rax), %edx
movl $0x4, %edi
leaq 0x20d61(%rip), %rsi     # 0xcbba5
movb $0x0, %al
callq 0x8b980
movq -0x10(%rbp), %rax
cmpl $0x0, 0x81a8c(%rax)
je 0xaae8b
movq -0x10(%rbp), %rdi
addq $0x70e70, %rdi          # imm = 0x70E70
movq -0x10(%rbp), %rax
movl 0x81a78(%rax), %edx
movq -0x28(%rbp), %rax
movzbl (%rax), %ecx
movq -0x28(%rbp), %rax
movzbl 0x1(%rax), %r8d
leaq 0x20d3a(%rip), %rsi     # 0xcbbbe
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rax
movzbl (%rax), %edi
callq 0xac810
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jne 0xaaec5
movq -0x28(%rbp), %rax
movzbl (%rax), %edx
movl $0x2, %edi
leaq 0x20d30(%rip), %rsi     # 0xcbbe2
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xaaff0
movq -0x28(%rbp), %rax
movzbl 0x1(%rax), %eax
movl -0x1c(%rbp), %esi
xorl %ecx, %ecx
movl $0xc0, %edx
cmpl $0x10, %esi
cmovel %edx, %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x1c(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x8b1b0
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0xaaf35
cmpl $0x4, -0x1c(%rbp)
jne 0xaaf10
cmpl $0xff, -0x14(%rbp)
jne 0xaaf10
movl $0x0, -0x4(%rbp)
jmp 0xaaff0
movl -0x1c(%rbp), %edx
movl -0x14(%rbp), %ecx
movl $0x2, %edi
leaq 0x20ce3(%rip), %rsi     # 0xcbc05
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xaaff0
movl -0x1c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x1f, %eax
ja 0xaafe9
movq -0x30(%rbp), %rax
leaq 0x1f500(%rip), %rcx     # 0xca454
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
movl $0x8, %edx
callq 0xad2c0
movl %eax, -0x4(%rbp)
jmp 0xaaff0
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
movl $0x8, %edx
callq 0xad2c0
movl %eax, -0x4(%rbp)
jmp 0xaaff0
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
movl $0x8, %edx
callq 0xad4b0
movl %eax, -0x4(%rbp)
jmp 0xaaff0
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
movl $0x8, %edx
callq 0xadc50
movl %eax, -0x4(%rbp)
jmp 0xaaff0
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
movq -0x28(%rbp), %rax
movzbl 0x3(%rax), %ecx
movl $0x8, %edx
callq 0xae0e0
movl %eax, -0x4(%rbp)
jmp 0xaaff0
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
movl $0x8, %edx
callq 0xae4c0
movl %eax, -0x4(%rbp)
jmp 0xaaff0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)