// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr1(bamboo::rtcm_t*, int)
static int decode_ssr1(rtcm_t *rtcm, int sys)
{
    double udint,deph[3],ddeph[3];
    int i,j,k,type,sync,iod,nsat,prn,sat,iode,iodcrc,refd=0,np,ni,nj,offp;
    
    type=getbitu(rtcm->buff,24,12);
    
    if ((nsat=decode_ssr1_head(rtcm,sys,&sync,&iod,&udint,&refd,&i))<0) {
        trace(2,"rtcm3 %d length error: len=%d\n",type,rtcm->len);
        return -1;
    }
    switch (sys) {
        case SYS_GPS: np=6; ni= 8; nj= 0; offp=  0; break;
        case SYS_GLO: np=5; ni= 8; nj= 0; offp=  0; break;
        case SYS_GAL: np=6; ni=10; nj= 0; offp=  0; break;
        case SYS_QZS: np=4; ni= 8; nj= 0; offp=192; break;
        case SYS_CMP: np=6; ni=10; nj=24; offp=  1; break;
        case SYS_SBS: np=6; ni= 9; nj=24; offp=120; break;
        default: return sync?0:10;
    }
    for (j=0;j<nsat&&i+121+np+ni+nj<=rtcm->len*8;j++) {
        prn     =getbitu(rtcm->buff,i,np)+offp; i+=np;
        iode    =getbitu(rtcm->buff,i,ni);      i+=ni;
        iodcrc  =getbitu(rtcm->buff,i,nj);      i+=nj;
        deph [0]=getbits(rtcm->buff,i,22)*1E-4; i+=22;
        deph [1]=getbits(rtcm->buff,i,20)*4E-4; i+=20;
        deph [2]=getbits(rtcm->buff,i,20)*4E-4; i+=20;
        ddeph[0]=getbits(rtcm->buff,i,21)*1E-6; i+=21;
        ddeph[1]=getbits(rtcm->buff,i,19)*4E-6; i+=19;
        ddeph[2]=getbits(rtcm->buff,i,19)*4E-6; i+=19;
        
        if (!(sat=satno(sys,prn))) {
            trace(2,"rtcm3 %d satellite number error: prn=%d\n",type,prn);
            continue;
        }
        rtcm->ssr[sat-1].t0 [0]=rtcm->time;
        rtcm->ssr[sat-1].udi[0]=udint;
        rtcm->ssr[sat-1].iod[0]=iod;
        rtcm->ssr[sat-1].iode=iode;     /* sbas/bds: toe/t0 modulo */
        rtcm->ssr[sat-1].iodcrc=iodcrc; /* sbas/bds: iod crc */
        rtcm->ssr[sat-1].refd=refd;
        
        for (k=0;k<3;k++) {
            rtcm->ssr[sat-1].deph [k]=deph [k];
            rtcm->ssr[sat-1].ddeph[k]=ddeph[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 $0xc8, %rsp
movl %esi, %ebx
movq %rdi, %r15
leaq -0x68(%rbp), %r14
andl $0x0, (%r14)
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
pushq $0x18
popq %r12
pushq $0xc
popq %rdx
movq %rdi, -0xa0(%rbp)
movl %r12d, %esi
callq 0x459f7
movl %eax, %r13d
leaq -0x70(%rbp), %rax
movq %rax, (%rsp)
leaq -0x34(%rbp), %rdx
leaq -0x6c(%rbp), %rcx
leaq -0xa8(%rbp), %r8
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %r9
callq 0x3b756
movl %eax, -0x58(%rbp)
testl %eax, %eax
js 0x38b3d
movl %r12d, %esi
movl %r13d, -0x4c(%rbp)
xorl %r12d, %r12d
pushq $0x8
popq %r14
pushq $0x6
popq %rax
movq %rax, -0x40(%rbp)
leal -0x1(%rbx), %ecx
pushq $0xa
popq %rax
cmpl $0x7, %ecx
ja 0x38b60
leaq 0x2c0c8(%rip), %rdx     # 0x64bec
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movq %rbx, -0x48(%rbp)
jmpq *%rcx
pushq $0x78
popq %rax
movl %eax, -0x2c(%rbp)
pushq $0x9
popq %r14
jmp 0x38b77
movl 0x9f0c0(%r15), %ecx
leaq 0x2c3f8(%rip), %rsi     # 0x64f43
pushq $0x2
popq %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x455bc
pushq $-0x1
popq %rax
jmp 0x38e49
cmpl $0x10, %ebx
je 0x38b9c
cmpl $0x20, %ebx
jne 0x38b7c
movq %rbx, -0x48(%rbp)
pushq $0x1
popq %rcx
movl %ecx, -0x2c(%rbp)
movl %eax, %r14d
movl %esi, %r12d
jmp 0x38bae
xorl %ecx, %ecx
cmpl $0x0, -0x34(%rbp)
jmp 0x38e46
movl %eax, %r14d
jmp 0x38b93
pushq $0x5
popq %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x38bae
movq %rbx, -0x48(%rbp)
movl $0xc0, -0x2c(%rbp)
pushq $0x4
popq %rax
movq %rax, -0x40(%rbp)
movl -0x70(%rbp), %ebx
movq -0x40(%rbp), %rax
addl %r14d, %eax
leal 0x79(%r12,%rax), %eax
movq %rax, -0x98(%rbp)
leaq 0x10(%r15), %rax
movq %rax, -0x90(%rbp)
leaq 0x6f148(%r15), %rax
movq %rax, -0x88(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x50(%rbp)
xorl %edx, %edx
movq %r15, -0x78(%rbp)
movq -0xa0(%rbp), %r13
cmpl -0x58(%rbp), %edx
je 0x38e3d
movq -0x98(%rbp), %rax
addl %ebx, %eax
movl 0x9f0c0(%r15), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x38e3d
movl %edx, -0x30(%rbp)
movq %r13, %rdi
movl %ebx, %esi
movq %r12, %r15
movq %r14, %r12
movq -0x40(%rbp), %r14
movl %r14d, %edx
callq 0x459f7
addl -0x2c(%rbp), %eax
movl %eax, -0x64(%rbp)
addl %r14d, %ebx
movq %r12, %r14
movq %r15, %r12
movq %r13, %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, -0x60(%rbp)
addl %r14d, %ebx
movq %r13, %rdi
movl %ebx, %esi
movl %r12d, %edx
callq 0x459f7
movl %eax, -0x5c(%rbp)
leal (%rbx,%r15), %esi
movq %r13, %rdi
pushq $0x16
popq %rdx
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x27c82(%rip), %xmm0    # 0x60910
movsd %xmm0, -0xe0(%rbp)
leal (%r15,%rbx), %esi
addl $0x16, %esi
movq %r13, %rdi
pushq $0x14
popq %r15
movl %r15d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
movsd 0x2ba58(%rip), %xmm1    # 0x64710
mulsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
leal (%r12,%rbx), %esi
addl $0x2a, %esi
movq %r13, %rdi
movl %r15d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x2ba2e(%rip), %xmm0    # 0x64710
movsd %xmm0, -0xd0(%rbp)
leal (%r12,%rbx), %esi
addl $0x3e, %esi
movq %r13, %rdi
pushq $0x15
popq %rdx
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x29f38(%rip), %xmm0    # 0x62c40
movsd %xmm0, -0xc0(%rbp)
leal (%r12,%rbx), %esi
addl $0x53, %esi
movq %r13, %rdi
pushq $0x13
popq %r15
movl %r15d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
movsd 0x2b9e6(%rip), %xmm1    # 0x64718
mulsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
leal 0x66(%r12,%rbx), %esi
movq %r13, %rdi
movl %r15d, %edx
movl -0x64(%rbp), %r15d
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x2b9ba(%rip), %xmm0    # 0x64718
movsd %xmm0, -0xb0(%rbp)
movq -0x48(%rbp), %rdi
movl %r15d, %esi
callq 0x452fd
testl %eax, %eax
je 0x38e12
decl %eax
cltq
imulq $0x498, %rax, %rcx      # imm = 0x498
movq -0x88(%rbp), %rsi
leaq (%rsi,%rcx), %rax
movq -0x90(%rbp), %rdx
movups (%rdx), %xmm0
movups %xmm0, (%rsi,%rcx)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, 0x60(%rsi,%rcx)
movl -0x54(%rbp), %edx
movl %edx, 0x90(%rsi,%rcx)
movl -0x60(%rbp), %edx
movl %edx, 0xa8(%rsi,%rcx)
movl -0x5c(%rbp), %edx
movl %edx, 0xac(%rsi,%rcx)
movl -0x50(%rbp), %edx
movl %edx, 0xb4(%rsi,%rcx)
xorl %ecx, %ecx
movq -0x78(%rbp), %r15
movl -0x30(%rbp), %edx
cmpq $0x3, %rcx
je 0x38e09
movsd -0xe0(%rbp,%rcx,8), %xmm0
movsd %xmm0, 0xb8(%rax,%rcx,8)
movsd -0xc0(%rbp,%rcx,8), %xmm0
movsd %xmm0, 0xd0(%rax,%rcx,8)
incq %rcx
jmp 0x38dda
movb $0x1, 0x490(%rax)
jmp 0x38e30
pushq $0x2
popq %rdi
leaq 0x2ca23(%rip), %rsi     # 0x6583f
movl -0x4c(%rbp), %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x455bc
movq -0x78(%rbp), %r15
movl -0x30(%rbp), %edx
addl %r12d, %ebx
addl $0x79, %ebx
incl %edx
jmp 0x38c03
xorl %ecx, %ecx
cmpl $0x0, -0x34(%rbp)
pushq $0xa
popq %rax
cmovnel %ecx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq