// File: 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
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl $0x18, %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x90(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x98(%rbp), %rdx
leaq -0x9c(%rbp), %rcx
leaq -0x20(%rbp), %r8
leaq -0xb0(%rbp), %r9
leaq -0x84(%rbp), %rax
movq %rax, (%rsp)
callq 0x7aad0
movl %eax, -0x94(%rbp)
cmpl $0x0, %eax
jge 0x76bd6
movl -0x90(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %ecx
movl $0x2, %edi
leaq 0x4a5a9(%rip), %rsi     # 0xc116c
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7735a
movl -0x14(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xc8(%rbp)
subl $0x1f, %eax
ja 0x76d09
movq -0xc8(%rbp), %rax
leaq 0x4a015(%rip), %rcx     # 0xc0c10
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x6, -0xb4(%rbp)
movl $0x8, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
movl $0x0, -0xc0(%rbp)
jmp 0x76d24
movl $0x5, -0xb4(%rbp)
movl $0x8, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
movl $0x0, -0xc0(%rbp)
jmp 0x76d24
movl $0x6, -0xb4(%rbp)
movl $0xa, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
movl $0x0, -0xc0(%rbp)
jmp 0x76d24
movl $0x4, -0xb4(%rbp)
movl $0x8, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
movl $0xc0, -0xc0(%rbp)
jmp 0x76d24
movl $0x6, -0xb4(%rbp)
movl $0xa, -0xb8(%rbp)
movl $0x18, -0xbc(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x76d24
movl $0x6, -0xb4(%rbp)
movl $0x9, -0xb8(%rbp)
movl $0x18, -0xbc(%rbp)
movl $0x78, -0xc0(%rbp)
jmp 0x76d24
movl -0x98(%rbp), %edx
movl $0xa, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x7735a
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %ecx
xorl %eax, %eax
cmpl -0x94(%rbp), %ecx
movb %al, -0xc9(%rbp)
jge 0x76d79
movl -0x84(%rbp), %eax
addl $0xbf, %eax
addl -0xb4(%rbp), %eax
addl -0xb8(%rbp), %eax
addl -0xbc(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
setle %al
movb %al, -0xc9(%rbp)
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0x76d88
jmp 0x77344
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl -0xb4(%rbp), %edx
callq 0x8bfc0
addl -0xc0(%rbp), %eax
movl %eax, -0xa0(%rbp)
movl -0xb4(%rbp), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl -0xb8(%rbp), %edx
callq 0x8bfc0
movl %eax, -0xa8(%rbp)
movl -0xb8(%rbp), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl -0xbc(%rbp), %edx
callq 0x8bfc0
movl %eax, -0xac(%rbp)
movl -0xbc(%rbp), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x16, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x46017(%rip), %xmm1    # 0xbce68
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x84(%rbp), %eax
addl $0x16, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x14, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x49b88(%rip), %xmm1    # 0xc0a18
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x84(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x14, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x49b49(%rip), %xmm1    # 0xc0a18
mulsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x84(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x15, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x47ec2(%rip), %xmm1    # 0xbedd0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x84(%rbp), %eax
addl $0x15, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x13, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x49ac3(%rip), %xmm1    # 0xc0a10
mulsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x84(%rbp), %eax
addl $0x13, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x13, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x49a84(%rip), %xmm1    # 0xc0a10
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x84(%rbp), %eax
addl $0x13, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x16, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x45e9d(%rip), %xmm1    # 0xbce68
mulsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x84(%rbp), %eax
addl $0x16, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x15, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x47dc6(%rip), %xmm1    # 0xbedd0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movl -0x84(%rbp), %eax
addl $0x15, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x1b, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x499d7(%rip), %xmm1    # 0xc0a20
mulsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movl -0x84(%rbp), %eax
addl $0x1b, %eax
movl %eax, -0x84(%rbp)
movl -0x14(%rbp), %edi
movl -0xa0(%rbp), %esi
callq 0x8b1b0
movl %eax, -0xa4(%rbp)
cmpl $0x0, %eax
jne 0x7709e
movl -0x90(%rbp), %edx
movl -0xa0(%rbp), %ecx
movl $0x2, %edi
leaq 0x4a9d6(%rip), %rsi     # 0xc1a68
movb $0x0, %al
callq 0x8b980
jmp 0x77330
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
addq $0x6f148, %rcx          # imm = 0x6F148
movl -0xa4(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rcx
movq 0x10(%rax), %rdx
movq %rdx, 0x10(%rcx)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rcx)
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movq 0x10(%rcx), %rdx
movq %rdx, (%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x8(%rax)
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movsd %xmm0, 0x68(%rax)
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movsd %xmm0, 0x60(%rax)
movl -0x9c(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0x94(%rax)
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0x90(%rax)
movl -0xa8(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0xa8(%rax)
movl -0xac(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0xac(%rax)
movl -0xb0(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0xb4(%rax)
movl $0x0, -0x8c(%rbp)
cmpl $0x3, -0x8c(%rbp)
jge 0x77309
movslq -0x8c(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movslq -0x8c(%rbp), %rcx
movsd %xmm0, 0xb8(%rax,%rcx,8)
movslq -0x8c(%rbp), %rax
movsd -0x60(%rbp,%rax,8), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movslq -0x8c(%rbp), %rcx
movsd %xmm0, 0xd0(%rax,%rcx,8)
movslq -0x8c(%rbp), %rax
movsd -0x80(%rbp,%rax,8), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movslq -0x8c(%rbp), %rcx
movsd %xmm0, 0xe8(%rax,%rcx,8)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x77231
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0xa4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movb $0x1, 0x490(%rax)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x76d2e
movl -0x98(%rbp), %edx
movl $0xa, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)