// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x18
popq %rsi
pushq $0xc
popq %rdx
movq %rdi, -0x80(%rbp)
callq 0x459f7
movl %eax, %r15d
leaq -0x34(%rbp), %rdx
leaq -0x48(%rbp), %rcx
leaq -0x88(%rbp), %r8
leaq -0x4c(%rbp), %r9
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3b973
testl %eax, %eax
js 0x39901
movl %eax, %r13d
pushq $0x6
popq %rdx
leal -0x1(%r14), %eax
cmpl $0x7, %eax
ja 0x39923
movl $0x0, -0x2c(%rbp)
leaq 0x2b380(%rip), %rcx     # 0x64c6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r14, -0x40(%rbp)
movl %r15d, -0x30(%rbp)
jmpq *%rax
pushq $0x78
jmp 0x3993d
movl 0x9f0c0(%rbx), %ecx
leaq 0x2b635(%rip), %rsi     # 0x64f43
pushq $0x2
popq %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x455bc
pushq $-0x1
popq %rax
jmp 0x39a5d
cmpl $0x10, %r14d
je 0x39947
cmpl $0x20, %r14d
jne 0x39a51
movl %r15d, -0x30(%rbp)
movq %r14, -0x40(%rbp)
pushq $0x1
popq %rax
movl %eax, -0x2c(%rbp)
jmp 0x39959
pushq $0x5
jmp 0x39958
movl %r15d, -0x30(%rbp)
movq %r14, -0x40(%rbp)
movl $0xc0, -0x2c(%rbp)
pushq $0x4
popq %rdx
movl -0x4c(%rbp), %r14d
leaq 0x10(%rbx), %rax
movq %rax, -0x78(%rbp)
leaq 0x6f148(%rbx), %rax
movq %rax, -0x70(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x44(%rbp)
movq %rbx, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
subl $0x1, %r13d
jb 0x39a51
leal (%rdx,%r14), %eax
addl $0x6, %eax
movl 0x9f0c0(%rbx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x39a51
movq -0x80(%rbp), %r12
movq %r12, %rdi
movl %r14d, %esi
movq %rdx, %r15
callq 0x459f7
movl %eax, %ebx
addl -0x2c(%rbp), %ebx
leal (%r14,%r15), %esi
movq %r12, %rdi
pushq $0x6
popq %rdx
callq 0x459f7
movl %eax, %r12d
addl %r15d, %r14d
addl $0x6, %r14d
movq -0x40(%rbp), %rdi
movl %ebx, %esi
callq 0x452fd
testl %eax, %eax
je 0x39a2e
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0x78(%rbp), %rcx
movups (%rcx), %xmm0
movq -0x70(%rbp), %rcx
movups %xmm0, 0x30(%rcx,%rax)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, 0x78(%rcx,%rax)
movl -0x44(%rbp), %edx
movl %edx, 0x9c(%rcx,%rax)
movl %r12d, 0xb0(%rcx,%rax)
movb $0x1, 0x490(%rcx,%rax)
jmp 0x39a44
pushq $0x2
popq %rdi
leaq 0x2be07(%rip), %rsi     # 0x6583f
movl -0x30(%rbp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x455bc
movq -0x60(%rbp), %rbx
movq -0x58(%rbp), %rdx
jmp 0x3998b
xorl %ecx, %ecx
cmpl $0x0, -0x34(%rbp)
pushq $0xa
popq %rax
cmovnel %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq