// File: 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
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x90(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl $0x18, %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x74(%rbp), %rdx
leaq -0x78(%rbp), %rcx
leaq -0x20(%rbp), %r8
leaq -0x90(%rbp), %r9
leaq -0x64(%rbp), %rax
movq %rax, (%rsp)
callq 0x7aad0
movl %eax, -0x7c(%rbp)
cmpl $0x0, %eax
jge 0x75c94
movl -0x70(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %ecx
movl $0x2, %edi
leaq 0x4b4eb(%rip), %rsi     # 0xc116c
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x76209
movl -0x14(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xa8(%rbp)
subl $0x1f, %eax
ja 0x75dc7
movq -0xa8(%rbp), %rax
leaq 0x4add7(%rip), %rcx     # 0xc0a90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x6, -0x94(%rbp)
movl $0x8, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
jmp 0x75ddf
movl $0x5, -0x94(%rbp)
movl $0x8, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
jmp 0x75ddf
movl $0x6, -0x94(%rbp)
movl $0xa, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
jmp 0x75ddf
movl $0x4, -0x94(%rbp)
movl $0x8, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0xc0, -0xa0(%rbp)
jmp 0x75ddf
movl $0x6, -0x94(%rbp)
movl $0xa, -0x98(%rbp)
movl $0x18, -0x9c(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x75ddf
movl $0x6, -0x94(%rbp)
movl $0x9, -0x98(%rbp)
movl $0x18, -0x9c(%rbp)
movl $0x78, -0xa0(%rbp)
jmp 0x75ddf
movl -0x74(%rbp), %edx
movl $0xa, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x76209
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %ecx
xorl %eax, %eax
cmpl -0x7c(%rbp), %ecx
movb %al, -0xa9(%rbp)
jge 0x75e26
movl -0x64(%rbp), %eax
addl $0x79, %eax
addl -0x94(%rbp), %eax
addl -0x98(%rbp), %eax
addl -0x9c(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
setle %al
movb %al, -0xa9(%rbp)
movb -0xa9(%rbp), %al
testb $0x1, %al
jne 0x75e35
jmp 0x761f6
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl -0x94(%rbp), %edx
callq 0x8bfc0
addl -0xa0(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x94(%rbp), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl -0x98(%rbp), %edx
callq 0x8bfc0
movl %eax, -0x88(%rbp)
movl -0x98(%rbp), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl -0x9c(%rbp), %edx
callq 0x8bfc0
movl %eax, -0x8c(%rbp)
movl -0x9c(%rbp), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl $0x16, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x46f8b(%rip), %xmm1    # 0xbce68
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x64(%rbp), %eax
addl $0x16, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl $0x14, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x4ab05(%rip), %xmm1    # 0xc0a18
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x64(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl $0x14, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x4aacf(%rip), %xmm1    # 0xc0a18
mulsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x64(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl $0x15, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x48e51(%rip), %xmm1    # 0xbedd0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x64(%rbp), %eax
addl $0x15, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl $0x13, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x4aa5b(%rip), %xmm1    # 0xc0a10
mulsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x64(%rbp), %eax
addl $0x13, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x64(%rbp), %esi
movl $0x13, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x4aa25(%rip), %xmm1    # 0xc0a10
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x64(%rbp), %eax
addl $0x13, %eax
movl %eax, -0x64(%rbp)
movl -0x14(%rbp), %edi
movl -0x80(%rbp), %esi
callq 0x8b1b0
movl %eax, -0x84(%rbp)
cmpl $0x0, %eax
jne 0x76031
movl -0x70(%rbp), %edx
movl -0x80(%rbp), %ecx
movl $0x2, %edi
leaq 0x4ba43(%rip), %rsi     # 0xc1a68
movb $0x0, %al
callq 0x8b980
jmp 0x761e8
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%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 -0x84(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movsd %xmm0, 0x60(%rax)
movl -0x78(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0x90(%rax)
movl -0x88(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0xa8(%rax)
movl -0x8c(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0xac(%rax)
movl -0x90(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0xb4(%rax)
movl $0x0, -0x6c(%rbp)
cmpl $0x3, -0x6c(%rbp)
jge 0x761c1
movslq -0x6c(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movslq -0x6c(%rbp), %rcx
movsd %xmm0, 0xb8(%rax,%rcx,8)
movslq -0x6c(%rbp), %rax
movsd -0x60(%rbp,%rax,8), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movslq -0x6c(%rbp), %rcx
movsd %xmm0, 0xd0(%rax,%rcx,8)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x76142
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x84(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movb $0x1, 0x490(%rax)
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x75de6
movl -0x74(%rbp), %edx
movl $0xa, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)