// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr5(bamboo::rtcm_t*, int)
static int decode_ssr5(rtcm_t *rtcm, int sys)
{
    double udint;
    int i,j,type,nsat,sync,iod,prn,sat,ura,np,offp;
    
    type=getbitu(rtcm->buff,24,12);
    
    if ((nsat=decode_ssr2_head(rtcm,sys,&sync,&iod,&udint,&i))<0) {
        trace(2,"rtcm3 %d length error: len=%d\n",type,rtcm->len);
        return -1;
    }
    switch (sys) {
        case SYS_GPS: np=6; offp=  0; break;
        case SYS_GLO: np=5; offp=  0; break;
        case SYS_GAL: np=6; offp=  0; break;
        case SYS_QZS: np=4; offp=192; break;
        case SYS_CMP: np=6; offp=  1; break;
        case SYS_SBS: np=6; offp=120; break;
        default: return sync?0:10;
    }
    for (j=0;j<nsat&&i+6+np<=rtcm->len*8;j++) {
        prn=getbitu(rtcm->buff,i,np)+offp; i+=np;
        ura=getbitu(rtcm->buff,i, 6);      i+= 6;
        
        if (!(sat=satno(sys,prn))) {
            trace(2,"rtcm3 %d satellite number error: prn=%d\n",type,prn);
            continue;
        }
        rtcm->ssr[sat-1].t0 [3]=rtcm->time;
        rtcm->ssr[sat-1].udi[3]=udint;
        rtcm->ssr[sat-1].iod[3]=iod;
        rtcm->ssr[sat-1].ura=ura;
        rtcm->ssr[sat-1].update=1;
    }
    return sync?0:10;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %r14d
movq %rdi, %rbx
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movq %rdi, -0x88(%rbp)
movl $0x18, %esi
movl $0xc, %edx
callq 0x4d9d6
movl %eax, %r15d
leaq -0x3c(%rbp), %rdx
leaq -0x50(%rbp), %rcx
leaq -0x90(%rbp), %r8
leaq -0x54(%rbp), %r9
movq %rbx, %rdi
movl %r14d, %esi
callq 0x42d40
testl %eax, %eax
js 0x40b33
movl %eax, %r13d
movl $0x6, %eax
movq %rax, -0x38(%rbp)
leal -0x1(%r14), %eax
cmpl $0x7, %eax
ja 0x40b59
movl $0x0, -0x2c(%rbp)
leaq 0x2e063(%rip), %rcx     # 0x6eb7c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r14, -0x48(%rbp)
movl %r15d, -0x30(%rbp)
jmpq *%rax
movl $0x78, -0x2c(%rbp)
jmp 0x40b99
movl 0x9f0c0(%rbx), %ecx
leaq 0x2e407(%rip), %rsi     # 0x6ef47
movl $0x2, %edi
movl %r15d, %edx
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x40cb4
cmpl $0x10, %r14d
je 0x40b81
cmpl $0x20, %r14d
jne 0x40ca6
movl %r15d, -0x30(%rbp)
movq %r14, -0x48(%rbp)
movl $0x1, -0x2c(%rbp)
jmp 0x40b99
movl $0x5, %eax
jmp 0x40b95
movl %r15d, -0x30(%rbp)
movq %r14, -0x48(%rbp)
movl $0xc0, -0x2c(%rbp)
movl $0x4, %eax
movq %rax, -0x38(%rbp)
testl %r13d, %r13d
je 0x40ca6
movl -0x54(%rbp), %r14d
leaq 0x10(%rbx), %rax
movq %rax, -0x70(%rbp)
leaq 0x6f148(%rbx), %rax
movq %rax, -0x68(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rax
addl $0x6, %eax
movq %rax, -0x80(%rbp)
movq %rbx, -0x78(%rbp)
movq -0x38(%rbp), %r15
movq -0x80(%rbp), %rax
addl %r14d, %eax
movl 0x9f0c0(%rbx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x40ca6
movq -0x88(%rbp), %r12
movq %r12, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x4d9d6
movl %eax, %ebx
addl -0x2c(%rbp), %ebx
leal (%r14,%r15), %esi
movq %r12, %rdi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %r12d
movq -0x48(%rbp), %rdi
movl %ebx, %esi
callq 0x4d28d
testl %eax, %eax
je 0x40c76
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0x70(%rbp), %rcx
movups (%rcx), %xmm0
movq -0x68(%rbp), %rcx
movups %xmm0, 0x30(%rcx,%rax)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, 0x78(%rcx,%rax)
movl -0x4c(%rbp), %edx
movl %edx, 0x9c(%rcx,%rax)
movl %r12d, 0xb0(%rcx,%rax)
movb $0x1, 0x490(%rcx,%rax)
jmp 0x40c8e
movl $0x2, %edi
leaq 0x2ebc1(%rip), %rsi     # 0x6f843
movl -0x30(%rbp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4d55d
movq -0x38(%rbp), %rax
addl %eax, %r14d
addl $0x6, %r14d
decl %r13d
movq -0x78(%rbp), %rbx
jne 0x40bdf
xorl %ecx, %ecx
cmpl $0x0, -0x3c(%rbp)
movl $0xa, %eax
cmovnel %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq