// File: /workspace/github_cpp_makefile_star2_O2/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 $0xe8, %rsp
movl %esi, %ebx
movq %rdi, %r15
leaq -0x70(%rbp), %r14
andl $0x0, (%r14)
leaq 0x9f0c4(%rdi), %r12
pushq $0x18
popq %rsi
pushq $0xc
popq %rdx
movq %r12, %rdi
callq 0x459f7
movl %eax, %r13d
leaq -0x78(%rbp), %rax
movq %rax, (%rsp)
leaq -0x40(%rbp), %rdx
leaq -0x74(%rbp), %rcx
leaq -0xa8(%rbp), %r8
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %r9
callq 0x3b756
movl %eax, -0x60(%rbp)
testl %eax, %eax
js 0x394b1
movl %r13d, -0x54(%rbp)
xorl %r13d, %r13d
pushq $0x8
popq %rax
movq %rax, -0x38(%rbp)
pushq $0x6
popq %rax
movq %rax, -0x48(%rbp)
leal -0x1(%rbx), %ecx
pushq $0xa
popq %rax
cmpl $0x7, %ecx
ja 0x394d4
leaq 0x2b7b3(%rip), %rdx     # 0x64c4c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movq %rbx, -0x50(%rbp)
jmpq *%rcx
pushq $0x78
popq %rax
movl %eax, -0x2c(%rbp)
pushq $0x9
popq %rax
jmp 0x394e8
movl 0x9f0c0(%r15), %ecx
leaq 0x2ba84(%rip), %rsi     # 0x64f43
pushq $0x2
popq %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x455bc
pushq $-0x1
popq %rax
jmp 0x3986b
cmpl $0x10, %ebx
je 0x39515
cmpl $0x20, %ebx
jne 0x394f4
movq %rbx, -0x50(%rbp)
pushq $0x1
popq %rcx
movl %ecx, -0x2c(%rbp)
movq %rax, -0x38(%rbp)
pushq $0x18
popq %rax
movl %eax, %r13d
jmp 0x39527
xorl %ecx, %ecx
cmpl $0x0, -0x40(%rbp)
jmp 0x39868
movq %rax, -0x38(%rbp)
jmp 0x3950c
pushq $0x5
popq %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x39527
movq %rbx, -0x50(%rbp)
movl $0xc0, -0x2c(%rbp)
pushq $0x4
popq %rax
movq %rax, -0x48(%rbp)
movl -0x78(%rbp), %ebx
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
addl %ecx, %eax
leal 0xbf(%r13,%rax), %eax
movq %rax, -0xa0(%rbp)
leaq 0x10(%r15), %rax
movq %rax, -0x98(%rbp)
leaq 0x6f148(%r15), %rax
movq %rax, -0x90(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x58(%rbp)
xorl %edx, %edx
movq %r15, -0x80(%rbp)
cmpl -0x60(%rbp), %edx
je 0x3985f
movq -0xa0(%rbp), %rax
addl %ebx, %eax
movl 0x9f0c0(%r15), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x3985f
movl %edx, -0x3c(%rbp)
movq %r12, %rdi
movl %ebx, %esi
movq -0x48(%rbp), %r14
movl %r14d, %edx
callq 0x459f7
addl -0x2c(%rbp), %eax
movl %eax, -0x6c(%rbp)
addl %r14d, %ebx
movq -0x38(%rbp), %r14
movq %r12, %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, -0x68(%rbp)
addl %r14d, %ebx
movq %r12, %rdi
movl %ebx, %esi
movl %r13d, %edx
callq 0x459f7
movl %eax, -0x64(%rbp)
leal (%rbx,%r13), %esi
movq %r12, %rdi
pushq $0x16
popq %rdx
callq 0x45a39
cvtsi2sd %eax, %xmm0
movsd 0x2730f(%rip), %xmm1    # 0x60910
mulsd %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
leal 0x16(%r13,%rbx), %esi
movq %r12, %rdi
pushq $0x14
popq %r14
movl %r14d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
movsd 0x2b0e3(%rip), %xmm1    # 0x64710
mulsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
leal (%rbx,%r13), %esi
addl $0x2a, %esi
movq %r12, %rdi
movl %r14d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x2b0b9(%rip), %xmm0    # 0x64710
movsd %xmm0, -0xf0(%rbp)
leal (%rbx,%r13), %esi
addl $0x3e, %esi
movq %r12, %rdi
pushq $0x15
popq %r14
movl %r14d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
movsd 0x295bf(%rip), %xmm1    # 0x62c40
mulsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
leal 0x53(%r13,%rbx), %esi
movq %r12, %rdi
pushq $0x13
popq %r15
movl %r15d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
movsd 0x2b06b(%rip), %xmm1    # 0x64718
mulsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
leal (%rbx,%r13), %esi
addl $0x66, %esi
movq %r12, %rdi
movl %r15d, %edx
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x2b041(%rip), %xmm0    # 0x64718
movsd %xmm0, -0xd0(%rbp)
leal (%rbx,%r13), %esi
addl $0x79, %esi
movq %r12, %rdi
pushq $0x16
popq %rdx
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x27213(%rip), %xmm0    # 0x60910
movsd %xmm0, -0xc0(%rbp)
leal (%rbx,%r13), %esi
addl $0x8f, %esi
movq %r12, %rdi
movl %r14d, %edx
movl -0x6c(%rbp), %r14d
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x29516(%rip), %xmm0    # 0x62c40
movsd %xmm0, -0xb8(%rbp)
leal (%rbx,%r13), %esi
addl $0xa4, %esi
movq %r12, %rdi
pushq $0x1b
popq %rdx
callq 0x45a39
cvtsi2sd %eax, %xmm0
mulsd 0x2afcd(%rip), %xmm0    # 0x64720
movsd %xmm0, -0xb0(%rbp)
movq -0x50(%rbp), %rdi
movl %r14d, %esi
callq 0x452fd
testl %eax, %eax
je 0x39831
decl %eax
cltq
imulq $0x498, %rax, %rcx      # imm = 0x498
movq -0x90(%rbp), %rsi
leaq (%rsi,%rcx), %rax
movq -0x98(%rbp), %rdx
movups (%rdx), %xmm0
movups %xmm0, 0x10(%rsi,%rcx)
movups (%rdx), %xmm0
movups %xmm0, (%rsi,%rcx)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, 0x68(%rsi,%rcx)
movsd %xmm0, 0x60(%rsi,%rcx)
movl -0x5c(%rbp), %edx
movl %edx, 0x94(%rsi,%rcx)
movl %edx, 0x90(%rsi,%rcx)
movl -0x68(%rbp), %edx
movl %edx, 0xa8(%rsi,%rcx)
movl -0x64(%rbp), %edx
movl %edx, 0xac(%rsi,%rcx)
movl -0x58(%rbp), %edx
movl %edx, 0xb4(%rsi,%rcx)
xorl %ecx, %ecx
movq -0x80(%rbp), %r15
movl -0x3c(%rbp), %edx
cmpq $0x3, %rcx
je 0x39828
movsd -0x100(%rbp,%rcx,8), %xmm0
movsd %xmm0, 0xb8(%rax,%rcx,8)
movsd -0xe0(%rbp,%rcx,8), %xmm0
movsd %xmm0, 0xd0(%rax,%rcx,8)
movsd -0xc0(%rbp,%rcx,8), %xmm0
movsd %xmm0, 0xe8(%rax,%rcx,8)
incq %rcx
jmp 0x397e7
movb $0x1, 0x490(%rax)
jmp 0x3984f
pushq $0x2
popq %rdi
leaq 0x2c004(%rip), %rsi     # 0x6583f
movl -0x54(%rbp), %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x455bc
movq -0x80(%rbp), %r15
movl -0x3c(%rbp), %edx
addl %r13d, %ebx
addl $0xbf, %ebx
incl %edx
jmp 0x3957e
xorl %ecx, %ecx
cmpl $0x0, -0x40(%rbp)
pushq $0xa
popq %rax
cmovnel %ecx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq