// File: /workspace/github_cpp_makefile_star2_O3/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 $0xb8, %rsp
movl %esi, %r14d
movq %rdi, %r12
leaq -0x94(%rbp), %rbx
movl $0x0, (%rbx)
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movq %rdi, -0xc8(%rbp)
movl $0x18, %esi
movl $0xc, %edx
callq 0x4d9d6
movl %eax, %r13d
leaq -0x9c(%rbp), %rax
movq %rax, (%rsp)
leaq -0x48(%rbp), %rdx
leaq -0x98(%rbp), %rcx
leaq -0xd0(%rbp), %r8
movq %r12, %rdi
movl %r14d, %esi
movq %rbx, %r9
callq 0x42b09
testl %eax, %eax
js 0x4067a
movq $0x0, -0x40(%rbp)
movl $0x8, %ecx
movq %rcx, -0x38(%rbp)
movl $0x6, %r15d
leal -0x1(%r14), %edx
cmpl $0x7, %edx
ja 0x406a2
leaq 0x2e50a(%rip), %rcx     # 0x6eb5c
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
movq %r14, -0x50(%rbp)
movl %r13d, -0x30(%rbp)
jmpq *%rdx
movl $0x78, -0x2c(%rbp)
movl $0x18, %ecx
movq %rcx, -0x40(%rbp)
movl $0x9, %ecx
jmp 0x406cf
movl 0x9f0c0(%r12), %ecx
leaq 0x2e8be(%rip), %rsi     # 0x6ef47
movl $0x2, %edi
movl %r13d, %edx
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x40a8b
cmpl $0x10, %r14d
je 0x406ef
cmpl $0x20, %r14d
jne 0x40a7d
movl %r13d, -0x30(%rbp)
movq %r14, -0x50(%rbp)
movl $0x1, -0x2c(%rbp)
movl $0x18, %ecx
movq %rcx, -0x40(%rbp)
movl $0xa, %ecx
movq %rcx, -0x38(%rbp)
jmp 0x40704
movl $0xa, %ecx
movq %rcx, -0x38(%rbp)
jmp 0x406e6
movl $0x5, %r15d
movl $0x0, -0x2c(%rbp)
jmp 0x40704
movl %r13d, -0x30(%rbp)
movq %r14, -0x50(%rbp)
movl $0xc0, -0x2c(%rbp)
movl $0x4, %r15d
testl %eax, %eax
je 0x40a7d
movl -0x9c(%rbp), %r14d
leaq 0x10(%r12), %rcx
movq %rcx, -0xb0(%rbp)
leaq 0x6f148(%r12), %rbx
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movl -0x98(%rbp), %ecx
movl %ecx, -0x60(%rbp)
movl -0x94(%rbp), %ecx
movl %ecx, -0x5c(%rbp)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rdx
leal (%rdx,%rcx), %r13d
leal (%r15,%r13), %ecx
addl $0xbf, %ecx
movl %ecx, -0x64(%rbp)
addl %r14d, %r13d
leal (%rdx,%r14), %ecx
movq %rcx, -0x58(%rbp)
movq %r12, -0xc0(%rbp)
movq %r15, -0xb8(%rbp)
leal (%r15,%r13), %edx
addl $0xbf, %edx
movl 0x9f0c0(%r12), %ecx
shll $0x3, %ecx
cmpl %ecx, %edx
jg 0x40a7d
movl %eax, -0x90(%rbp)
movq -0xc8(%rbp), %r12
movq %r12, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x4d9d6
addl -0x2c(%rbp), %eax
movl %eax, -0x44(%rbp)
addl %r15d, %r14d
movq %r12, %rdi
movl %r14d, %esi
movq -0x38(%rbp), %rdx
callq 0x4d9d6
movl %eax, -0x8c(%rbp)
movq -0x58(%rbp), %rax
leal (%r15,%rax), %esi
movq %r12, %rdi
movq -0x40(%rbp), %rdx
callq 0x4d9d6
movl %eax, -0x88(%rbp)
leal (%r15,%r13), %esi
movq %r12, %rdi
movl $0x16, %edx
callq 0x4da25
movl %eax, -0x84(%rbp)
leal (%r15,%r13), %esi
addl $0x16, %esi
movq %r12, %rdi
movl $0x14, %edx
callq 0x4da25
movl %eax, -0x80(%rbp)
leal (%r15,%r13), %esi
addl $0x2a, %esi
movq %r12, %rdi
movl $0x14, %edx
callq 0x4da25
movl %eax, -0x7c(%rbp)
leal (%r15,%r13), %esi
addl $0x3e, %esi
movq %r12, %rdi
movl $0x15, %edx
callq 0x4da25
movl %eax, -0x78(%rbp)
leal (%r15,%r13), %esi
addl $0x53, %esi
movq %r12, %rdi
movl $0x13, %edx
callq 0x4da25
movl %eax, -0x74(%rbp)
leal (%r15,%r13), %esi
addl $0x66, %esi
movq %r12, %rdi
movl $0x13, %edx
callq 0x4da25
movl %eax, -0x70(%rbp)
leal (%r15,%r13), %esi
addl $0x79, %esi
movq %r12, %rdi
movl $0x16, %edx
callq 0x4da25
movl %eax, -0x6c(%rbp)
leal (%r15,%r13), %esi
addl $0x8f, %esi
movq %r12, %rdi
movl $0x15, %edx
callq 0x4da25
movl %eax, -0x68(%rbp)
leal (%r15,%r13), %esi
addl $0xa4, %esi
movq %r12, %rdi
movl $0x1b, %edx
callq 0x4da25
movl %eax, %r12d
movq -0x50(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x4d28d
testl %eax, %eax
je 0x40a26
cvtsi2sd %r12d, %xmm0
cvtsi2sdl -0x68(%rbp), %xmm1
cvtsi2sdl -0x6c(%rbp), %xmm2
cvtsi2sdl -0x70(%rbp), %xmm3
cvtsi2sdl -0x74(%rbp), %xmm4
cvtsi2sdl -0x78(%rbp), %xmm5
cvtsi2sdl -0x7c(%rbp), %xmm6
cvtsi2sdl -0x80(%rbp), %xmm7
cvtsi2sdl -0x84(%rbp), %xmm8
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0xb0(%rbp), %rcx
movups (%rcx), %xmm9
movups %xmm9, 0x10(%rbx,%rax)
movups (%rcx), %xmm9
movups %xmm9, (%rbx,%rax)
movsd -0xa8(%rbp), %xmm9
movsd %xmm9, 0x68(%rbx,%rax)
movsd %xmm9, 0x60(%rbx,%rax)
movl -0x60(%rbp), %ecx
movl %ecx, 0x94(%rbx,%rax)
movl %ecx, 0x90(%rbx,%rax)
movl -0x8c(%rbp), %ecx
movl %ecx, 0xa8(%rbx,%rax)
movl -0x88(%rbp), %ecx
movl %ecx, 0xac(%rbx,%rax)
mulsd 0x2e4f4(%rip), %xmm0    # 0x6ee68
movsd 0x2c2c3(%rip), %xmm9    # 0x6cc40
mulsd %xmm9, %xmm1
movsd 0x29f95(%rip), %xmm10   # 0x6a920
mulsd %xmm10, %xmm2
movsd 0x2e4bf(%rip), %xmm11   # 0x6ee58
mulsd %xmm11, %xmm3
mulsd %xmm11, %xmm4
mulsd %xmm9, %xmm5
movsd 0x2e4af(%rip), %xmm9    # 0x6ee60
mulsd %xmm9, %xmm6
mulsd %xmm9, %xmm7
mulsd %xmm10, %xmm8
movl -0x5c(%rbp), %ecx
movl %ecx, 0xb4(%rbx,%rax)
movsd %xmm8, 0xb8(%rbx,%rax)
movsd %xmm7, 0xc0(%rbx,%rax)
movsd %xmm6, 0xc8(%rbx,%rax)
movsd %xmm5, 0xd0(%rbx,%rax)
movsd %xmm4, 0xd8(%rbx,%rax)
movsd %xmm3, 0xe0(%rbx,%rax)
movsd %xmm2, 0xe8(%rbx,%rax)
movsd %xmm1, 0xf0(%rbx,%rax)
movsd %xmm0, 0xf8(%rbx,%rax)
movb $0x1, 0x490(%rbx,%rax)
jmp 0x40a3f
movl $0x2, %edi
leaq 0x2ee11(%rip), %rsi     # 0x6f843
movl -0x30(%rbp), %edx
movl -0x44(%rbp), %ecx
xorl %eax, %eax
callq 0x4d55d
addl -0x38(%rbp), %r14d
movq -0x40(%rbp), %rax
addl %eax, %r14d
addl $0xbf, %r14d
movl -0x64(%rbp), %eax
addl %eax, %r13d
movq -0x58(%rbp), %rcx
addl %eax, %ecx
movq %rcx, -0x58(%rbp)
movl -0x90(%rbp), %eax
decl %eax
movq -0xc0(%rbp), %r12
movq -0xb8(%rbp), %r15
jne 0x4077b
xorl %ecx, %ecx
cmpl $0x0, -0x48(%rbp)
movl $0xa, %eax
cmovnel %ecx, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq