// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr4(bamboo::rtcm_t*, int)
static int decode_ssr4(rtcm_t *rtcm, int sys)
{
    double udint,deph[3],ddeph[3],dclk[3];
    int i,j,k,type,nsat,sync,iod,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; /*update by tj */
        case SYS_SBS: np=6; ni= 9; nj=24; offp=120; break;
        default: return sync?0:10;
    }
    for (j=0;j<nsat&&i+191+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;
        
        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 [0]=rtcm->ssr[sat-1].t0 [1]=rtcm->time;
        rtcm->ssr[sat-1].udi[0]=rtcm->ssr[sat-1].udi[1]=udint;
        rtcm->ssr[sat-1].iod[0]=rtcm->ssr[sat-1].iod[1]=iod;
        rtcm->ssr[sat-1].iode=iode;
        rtcm->ssr[sat-1].iodcrc=iodcrc;
        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].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 $0xc8, %rsp
movl %esi, %r15d
movq %rdi, %r14
leaq -0x90(%rbp), %rbx
movl $0x0, (%rbx)
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movq %rdi, -0xd0(%rbp)
movl $0x18, %esi
movl $0xc, %edx
callq 0x4e341
movl %eax, %r13d
leaq -0x4c(%rbp), %rax
movq %rax, (%rsp)
leaq -0x48(%rbp), %rdx
leaq -0x94(%rbp), %rcx
leaq -0xe0(%rbp), %r8
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %r9
callq 0x433aa
testl %eax, %eax
js 0x40d32
movq $0x0, -0x40(%rbp)
movl $0x8, %ecx
movq %rcx, -0x38(%rbp)
movl $0x6, %ecx
movq %rcx, -0x58(%rbp)
leal -0x1(%r15), %ecx
cmpl $0x7, %ecx
ja 0x40d59
leaq 0x2de4e(%rip), %rdx     # 0x6eb5c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movl %r13d, -0x30(%rbp)
jmpq *%rcx
movl $0x78, -0x2c(%rbp)
movl $0x18, %ecx
movq %rcx, -0x40(%rbp)
movl $0x9, %ecx
jmp 0x40d7e
movl 0x9f0c0(%r14), %ecx
leaq 0x2e207(%rip), %rsi     # 0x6ef47
movl $0x2, %edi
movl %r13d, %edx
xorl %eax, %eax
callq 0x4ded0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x41158
cmpl $0x10, %r15d
je 0x40dac
cmpl $0x20, %r15d
jne 0x40d84
movl %r13d, -0x30(%rbp)
movl $0x1, -0x2c(%rbp)
movl $0x18, %ecx
movq %rcx, -0x40(%rbp)
movl $0xa, %ecx
movq %rcx, -0x38(%rbp)
jmp 0x40dc0
xorl %ecx, %ecx
cmpl $0x0, -0x48(%rbp)
jmp 0x41150
movl $0xa, %ecx
movq %rcx, -0x38(%rbp)
jmp 0x40da3
movl $0x5, %ecx
movq %rcx, -0x58(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x40dc0
movl %r13d, -0x30(%rbp)
movl $0xc0, -0x2c(%rbp)
movl $0x4, %ecx
movq %rcx, -0x58(%rbp)
movl -0x4c(%rbp), %r13d
testl %eax, %eax
je 0x41146
movq %r15, -0xc0(%rbp)
leaq 0x10(%r14), %rcx
movq %rcx, -0xa8(%rbp)
movq %r14, -0xc8(%rbp)
addq $0x6f148, %r14          # imm = 0x6F148
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movl -0x94(%rbp), %ecx
movl %ecx, -0x60(%rbp)
movl -0x90(%rbp), %ecx
movl %ecx, -0x5c(%rbp)
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
movq -0x58(%rbp), %rax
movq -0x38(%rbp), %rcx
addl %eax, %ecx
movq -0x40(%rbp), %rax
movq %rcx, -0xb8(%rbp)
leal (%rcx,%rax), %r12d
movq %r12, -0xb0(%rbp)
movq -0xd0(%rbp), %r15
leal (%r12,%r13), %eax
addl $0xbf, %eax
movq -0xc8(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x41146
movl %edx, -0x44(%rbp)
movq %r15, %rdi
movl %r13d, %esi
movq -0x58(%rbp), %rbx
movl %ebx, %edx
callq 0x4e341
addl -0x2c(%rbp), %eax
movl %eax, -0x8c(%rbp)
leal (%rbx,%r13), %esi
movq %r15, %rdi
movq %rsi, -0xd8(%rbp)
movq -0x38(%rbp), %rdx
callq 0x4e341
movl %eax, -0x88(%rbp)
movq -0xb8(%rbp), %rax
leal (%rax,%r13), %esi
movq %r15, %rdi
movq -0x40(%rbp), %rdx
callq 0x4e341
movl %eax, -0x84(%rbp)
leal (%r12,%r13), %esi
movq %r15, %rdi
movl $0x16, %edx
callq 0x4e390
movl %eax, -0x80(%rbp)
leal (%r12,%r13), %esi
addl $0x16, %esi
movq %r15, %rdi
movl $0x14, %edx
callq 0x4e390
movl %eax, -0x7c(%rbp)
leal (%r12,%r13), %esi
addl $0x2a, %esi
movq %r15, %rdi
movl $0x14, %edx
callq 0x4e390
movl %eax, -0x78(%rbp)
leal (%r12,%r13), %esi
addl $0x3e, %esi
movq %r15, %rdi
movl $0x15, %edx
callq 0x4e390
movl %eax, -0x74(%rbp)
leal (%r12,%r13), %esi
addl $0x53, %esi
movq %r15, %rdi
movl $0x13, %edx
callq 0x4e390
movl %eax, -0x70(%rbp)
leal (%r12,%r13), %esi
addl $0x66, %esi
movq %r15, %rdi
movl $0x13, %edx
callq 0x4e390
movl %eax, -0x6c(%rbp)
leal (%r12,%r13), %esi
addl $0x79, %esi
movq %r15, %rdi
movl $0x16, %edx
callq 0x4e390
movl %eax, -0x68(%rbp)
leal (%r12,%r13), %esi
addl $0x8f, %esi
movq %r15, %rdi
movl $0x15, %edx
callq 0x4e390
movl %eax, -0x64(%rbp)
leal (%r12,%r13), %esi
addl $0xa4, %esi
movq %r15, %rdi
movl $0x1b, %edx
callq 0x4e390
movl %eax, %r13d
movq -0xc0(%rbp), %rdi
movl -0x8c(%rbp), %esi
movl %esi, %ebx
callq 0x4dbc5
testl %eax, %eax
je 0x41103
cvtsi2sd %r13d, %xmm0
cvtsi2sdl -0x64(%rbp), %xmm1
cvtsi2sdl -0x68(%rbp), %xmm2
cvtsi2sdl -0x6c(%rbp), %xmm3
cvtsi2sdl -0x70(%rbp), %xmm4
cvtsi2sdl -0x74(%rbp), %xmm5
cvtsi2sdl -0x78(%rbp), %xmm6
cvtsi2sdl -0x7c(%rbp), %xmm7
cvtsi2sdl -0x80(%rbp), %xmm8
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0xa8(%rbp), %rcx
movups (%rcx), %xmm9
movups %xmm9, 0x10(%r14,%rax)
movups (%rcx), %xmm9
movups %xmm9, (%r14,%rax)
movsd -0xa0(%rbp), %xmm9
movsd %xmm9, 0x68(%r14,%rax)
movsd %xmm9, 0x60(%r14,%rax)
movl -0x60(%rbp), %ecx
movl %ecx, 0x94(%r14,%rax)
movl %ecx, 0x90(%r14,%rax)
movl -0x88(%rbp), %ecx
movl %ecx, 0xa8(%r14,%rax)
movl -0x84(%rbp), %ecx
movl %ecx, 0xac(%r14,%rax)
mulsd 0x2de21(%rip), %xmm0    # 0x6ee68
movsd 0x2bbf0(%rip), %xmm9    # 0x6cc40
mulsd %xmm9, %xmm1
movsd 0x298c2(%rip), %xmm10   # 0x6a920
mulsd %xmm10, %xmm2
movsd 0x2ddec(%rip), %xmm11   # 0x6ee58
mulsd %xmm11, %xmm3
mulsd %xmm11, %xmm4
mulsd %xmm9, %xmm5
movsd 0x2dddc(%rip), %xmm9    # 0x6ee60
mulsd %xmm9, %xmm6
mulsd %xmm9, %xmm7
mulsd %xmm10, %xmm8
movl -0x5c(%rbp), %ecx
movl %ecx, 0xb4(%r14,%rax)
movsd %xmm8, 0xb8(%r14,%rax)
movsd %xmm7, 0xc0(%r14,%rax)
movsd %xmm6, 0xc8(%r14,%rax)
movsd %xmm5, 0xd0(%r14,%rax)
movsd %xmm4, 0xd8(%r14,%rax)
movsd %xmm3, 0xe0(%r14,%rax)
movsd %xmm2, 0xe8(%r14,%rax)
movsd %xmm1, 0xf0(%r14,%rax)
movsd %xmm0, 0xf8(%r14,%rax)
movb $0x1, 0x490(%r14,%rax)
jmp 0x4111b
movl $0x2, %edi
leaq 0x2e734(%rip), %rsi     # 0x6f843
movl -0x30(%rbp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4ded0
movl -0x44(%rbp), %edx
movq -0xd8(%rbp), %rcx
addl -0x38(%rbp), %ecx
movq -0x40(%rbp), %rax
leal (%rax,%rcx), %r13d
addl $0xbf, %r13d
decl %edx
movq -0xb0(%rbp), %r12
jne 0x40e40
xorl %ecx, %ecx
cmpl $0x0, -0x48(%rbp)
movl %r13d, -0x4c(%rbp)
movl $0xa, %eax
cmovnel %ecx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq