// File: /workspace/github_cpp_makefile_star2_O1/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 $0xa8, %rsp
movl %esi, %r15d
movq %rdi, %r14
leaq -0x80(%rbp), %rbx
movl $0x0, (%rbx)
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movq %rdi, -0xc0(%rbp)
movl $0x18, %esi
movl $0xc, %edx
callq 0x4e341
movl %eax, %r12d
leaq -0x44(%rbp), %rax
movq %rax, (%rsp)
leaq -0x40(%rbp), %rdx
leaq -0x84(%rbp), %rcx
leaq -0xc8(%rbp), %r8
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %r9
callq 0x433aa
testl %eax, %eax
js 0x402ea
xorl %r13d, %r13d
movl $0x8, %ecx
movq %rcx, -0x38(%rbp)
movl $0x6, %ecx
movq %rcx, -0x50(%rbp)
leal -0x1(%r15), %ecx
cmpl $0x7, %ecx
ja 0x40311
leaq 0x2e82f(%rip), %rdx     # 0x6eafc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x78, -0x2c(%rbp)
movl $0x18, %r13d
movl $0x9, %ecx
jmp 0x4032f
movl 0x9f0c0(%r14), %ecx
leaq 0x2ec4f(%rip), %rsi     # 0x6ef47
movl $0x2, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0x4ded0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4062a
cmpl $0x10, %r15d
je 0x4035d
cmpl $0x20, %r15d
jne 0x40335
movl $0x1, -0x2c(%rbp)
movl $0x18, %r13d
movl $0xa, %ecx
movq %rcx, -0x38(%rbp)
jmp 0x4036d
xorl %ecx, %ecx
cmpl $0x0, -0x40(%rbp)
jmp 0x40622
movl $0xa, %ecx
movq %rcx, -0x38(%rbp)
jmp 0x40354
movl $0x5, %ecx
movq %rcx, -0x50(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x4036d
movl $0xc0, -0x2c(%rbp)
movl $0x4, %ecx
movq %rcx, -0x50(%rbp)
movl -0x44(%rbp), %ebx
testl %eax, %eax
je 0x40619
movl %r12d, -0x54(%rbp)
movq %r15, -0xb0(%rbp)
leaq 0x10(%r14), %rcx
movq %rcx, -0xa0(%rbp)
leaq 0x6f148(%r14), %rcx
movq %rcx, -0x98(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movl -0x84(%rbp), %ecx
movl %ecx, -0x5c(%rbp)
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
movl -0x80(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq -0x38(%rbp), %rcx
addl %ecx, %eax
movq %rax, -0xa8(%rbp)
leal (%rax,%r13), %r12d
movq %r14, -0xb8(%rbp)
leal (%r12,%rbx), %eax
addl $0x79, %eax
movl 0x9f0c0(%r14), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x40619
movl %edx, -0x3c(%rbp)
movq -0xc0(%rbp), %r14
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %r15
movq %r13, %r12
movq -0x50(%rbp), %r13
movl %r13d, %edx
callq 0x4e341
addl -0x2c(%rbp), %eax
movl %eax, -0x7c(%rbp)
leal (%rbx,%r13), %eax
movq %r12, %r13
movq %r15, %r12
movq %rax, %r15
movq %r14, %rdi
movl %r15d, %esi
movq -0x38(%rbp), %rdx
callq 0x4e341
movl %eax, -0x78(%rbp)
movq -0xa8(%rbp), %rax
leal (%rax,%rbx), %esi
movq %r14, %rdi
movl %r13d, %edx
callq 0x4e341
movl %eax, -0x74(%rbp)
leal (%r12,%rbx), %esi
movq %r14, %rdi
movl $0x16, %edx
callq 0x4e390
movl %eax, -0x70(%rbp)
leal (%r12,%rbx), %esi
addl $0x16, %esi
movq %r14, %rdi
movl $0x14, %edx
callq 0x4e390
movl %eax, -0x6c(%rbp)
leal (%r12,%rbx), %esi
addl $0x2a, %esi
movq %r14, %rdi
movl $0x14, %edx
callq 0x4e390
movl %eax, -0x68(%rbp)
leal (%r12,%rbx), %esi
addl $0x3e, %esi
movq %r14, %rdi
movl $0x15, %edx
callq 0x4e390
movl %eax, -0x64(%rbp)
leal (%r12,%rbx), %esi
addl $0x53, %esi
movq %r14, %rdi
movl $0x13, %edx
callq 0x4e390
movl %eax, -0x60(%rbp)
leal (%r12,%rbx), %esi
addl $0x66, %esi
movq %r14, %rdi
movl -0x7c(%rbp), %r14d
movl $0x13, %edx
callq 0x4e390
movl %eax, %ebx
movq -0xb0(%rbp), %rdi
movl %r14d, %esi
callq 0x4dbc5
testl %eax, %eax
je 0x405e3
cvtsi2sd %ebx, %xmm0
movsd 0x2e952(%rip), %xmm3    # 0x6ee58
mulsd %xmm3, %xmm0
cvtsi2sdl -0x60(%rbp), %xmm1
cvtsi2sdl -0x64(%rbp), %xmm2
mulsd %xmm3, %xmm1
mulsd 0x2c720(%rip), %xmm2    # 0x6cc40
xorps %xmm3, %xmm3
cvtsi2sdl -0x68(%rbp), %xmm3
movsd 0x2e930(%rip), %xmm5    # 0x6ee60
mulsd %xmm5, %xmm3
cvtsi2sdl -0x6c(%rbp), %xmm4
mulsd %xmm5, %xmm4
xorps %xmm5, %xmm5
cvtsi2sdl -0x70(%rbp), %xmm5
mulsd 0x2a3d3(%rip), %xmm5    # 0x6a920
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0xa0(%rbp), %rcx
movups (%rcx), %xmm6
movq -0x98(%rbp), %rcx
movups %xmm6, (%rcx,%rax)
movsd -0x90(%rbp), %xmm6
movsd %xmm6, 0x60(%rcx,%rax)
movl -0x5c(%rbp), %edx
movl %edx, 0x90(%rcx,%rax)
movl -0x78(%rbp), %edx
movl %edx, 0xa8(%rcx,%rax)
movl -0x74(%rbp), %edx
movl %edx, 0xac(%rcx,%rax)
movl -0x58(%rbp), %edx
movl %edx, 0xb4(%rcx,%rax)
movsd %xmm5, 0xb8(%rcx,%rax)
movsd %xmm4, 0xc0(%rcx,%rax)
movsd %xmm3, 0xc8(%rcx,%rax)
movsd %xmm2, 0xd0(%rcx,%rax)
movsd %xmm1, 0xd8(%rcx,%rax)
movsd %xmm0, 0xe0(%rcx,%rax)
movb $0x1, 0x490(%rcx,%rax)
jmp 0x405fc
movl $0x2, %edi
leaq 0x2f254(%rip), %rsi     # 0x6f843
movl -0x54(%rbp), %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x4ded0
movl -0x3c(%rbp), %edx
addl -0x38(%rbp), %r15d
leal (%r15,%r13), %ebx
addl $0x79, %ebx
decl %edx
movq -0xb8(%rbp), %r14
jne 0x403e2
xorl %ecx, %ecx
cmpl $0x0, -0x40(%rbp)
movl %ebx, -0x44(%rbp)
movl $0xa, %eax
cmovnel %ecx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq