// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr2(bamboo::rtcm_t*, int)
static int decode_ssr2(rtcm_t *rtcm, int sys)
{
    double udint,dclk[3];
    int i,j,k,type,sync,iod,nsat,prn,sat,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+70+np<=rtcm->len*8;j++) {
        prn    =getbitu(rtcm->buff,i,np)+offp; i+=np;
        dclk[0]=getbits(rtcm->buff,i,22)*1E-4; i+=22;
        dclk[1]=getbits(rtcm->buff,i,21)*1E-6; i+=21;
        dclk[2]=getbits(rtcm->buff,i,27)*2E-8; i+=27;
        
        if (!(sat=satno(sys,prn))) {
            trace(2,"rtcm3 %d satellite number error: prn=%d\n",type,prn);
            continue;
        }
        rtcm->ssr[sat-1].t0 [1]=rtcm->time;
        rtcm->ssr[sat-1].udi[1]=udint;
        rtcm->ssr[sat-1].iod[1]=iod;
        
        for (k=0;k<3;k++) {
            rtcm->ssr[sat-1].dclk[k]=dclk[k];
        }
        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, %ebx
movq %rdi, %r15
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movq %rdi, -0x88(%rbp)
movl $0x18, %esi
movl $0xc, %edx
callq 0x4d9d6
movl %eax, %r14d
leaq -0x34(%rbp), %rdx
leaq -0x54(%rbp), %rcx
leaq -0x90(%rbp), %r8
leaq -0x58(%rbp), %r9
movq %r15, %rdi
movl %ebx, %esi
callq 0x42d40
testl %eax, %eax
js 0x40021
movl $0x6, %edx
leal -0x1(%rbx), %esi
cmpl $0x7, %esi
ja 0x40048
movl $0x0, -0x2c(%rbp)
leaq 0x2eb15(%rip), %rcx     # 0x6eb1c
movslq (%rcx,%rsi,4), %rsi
addq %rcx, %rsi
movq %rbx, -0x40(%rbp)
movl %r14d, -0x30(%rbp)
jmpq *%rsi
movl $0x78, -0x2c(%rbp)
jmp 0x40082
movl 0x9f0c0(%r15), %ecx
leaq 0x2ef18(%rip), %rsi     # 0x6ef47
movl $0x2, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4020c
cmpl $0x10, %ebx
je 0x4006e
cmpl $0x20, %ebx
jne 0x401fe
movl %r14d, -0x30(%rbp)
movq %rbx, -0x40(%rbp)
movl $0x1, -0x2c(%rbp)
jmp 0x40082
movl $0x5, %edx
jmp 0x40082
movl %r14d, -0x30(%rbp)
movq %rbx, -0x40(%rbp)
movl $0xc0, -0x2c(%rbp)
movl $0x4, %edx
testl %eax, %eax
je 0x401fe
movl -0x58(%rbp), %r14d
leaq 0x10(%r15), %rcx
movq %rcx, -0x70(%rbp)
leaq 0x6f148(%r15), %rcx
movq %rcx, -0x68(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x54(%rbp), %ecx
movl %ecx, -0x44(%rbp)
leal (%rdx,%r14), %ebx
leal 0x46(%rdx), %ecx
movl %ecx, -0x48(%rbp)
movq %r15, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
leal 0x46(%rbx), %esi
movl 0x9f0c0(%r15), %ecx
shll $0x3, %ecx
cmpl %ecx, %esi
jg 0x401fe
movl %eax, -0x50(%rbp)
movq -0x88(%rbp), %r13
movq %r13, %rdi
movl %r14d, %esi
callq 0x4d9d6
movl %eax, %r15d
addl -0x2c(%rbp), %r15d
movq %r13, %rdi
movl %ebx, %esi
movl $0x16, %edx
callq 0x4da25
movl %eax, -0x4c(%rbp)
leal 0x16(%rbx), %esi
movq %r13, %rdi
movl $0x15, %edx
callq 0x4da25
movl %eax, %r12d
leal 0x2b(%rbx), %esi
movq %r13, %rdi
movl $0x1b, %edx
callq 0x4da25
movl %eax, %r13d
movq -0x40(%rbp), %rdi
movl %r15d, %esi
callq 0x4d28d
testl %eax, %eax
je 0x401c8
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
mulsd 0x2ed0d(%rip), %xmm0    # 0x6ee68
mulsd 0x2cadd(%rip), %xmm1    # 0x6cc40
xorps %xmm2, %xmm2
cvtsi2sdl -0x4c(%rbp), %xmm2
mulsd 0x2a7ad(%rip), %xmm2    # 0x6a920
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0x70(%rbp), %rcx
movups (%rcx), %xmm3
movq -0x68(%rbp), %rcx
movups %xmm3, 0x10(%rcx,%rax)
movsd -0x60(%rbp), %xmm3
movsd %xmm3, 0x68(%rcx,%rax)
movl -0x44(%rbp), %edx
movl %edx, 0x94(%rcx,%rax)
movsd %xmm2, 0xe8(%rcx,%rax)
movsd %xmm1, 0xf0(%rcx,%rax)
movsd %xmm0, 0xf8(%rcx,%rax)
movb $0x1, 0x490(%rcx,%rax)
jmp 0x401e1
movl $0x2, %edi
leaq 0x2f66f(%rip), %rsi     # 0x6f843
movl -0x30(%rbp), %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x4d55d
movq -0x78(%rbp), %rdx
addl %edx, %r14d
addl $0x46, %r14d
addl -0x48(%rbp), %ebx
movl -0x50(%rbp), %eax
decl %eax
movq -0x80(%rbp), %r15
jne 0x400c6
xorl %ecx, %ecx
cmpl $0x0, -0x34(%rbp)
movl $0xa, %eax
cmovnel %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq