// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr7(bamboo::rtcm_t*, int)
static int decode_ssr7(rtcm_t *rtcm, int sys)
{
    const int *codes;
    double udint,bias,std,pbias[MAXCODE],stdpb[MAXCODE];
    int i,j,k,type,mode,sync,iod,nsat,prn,sat,nbias,ncode,np,mw,offp,sii,swl;
    int dispe,sdc,yaw_ang,yaw_rate;
    
    type=getbitu(rtcm->buff,24,12);
    
    if ((nsat=decode_ssr7_head(rtcm,sys,&sync,&iod,&udint,&dispe,&mw,&i))<0) {
        trace(2,"rtcm3 %d length error: len=%d\n",type,rtcm->len);
        return -1;
    }
    switch (sys) {
        case SYS_GPS: np=6; offp=  0; codes=codes_gps; ncode=17; break;
        case SYS_GLO: np=5; offp=  0; codes=codes_glo; ncode= 4; break;
        case SYS_GAL: np=6; offp=  0; codes=codes_gal; ncode=19; break;
        case SYS_QZS: np=4; offp=192; codes=codes_qzs; ncode=13; break;
        case SYS_CMP: np=6; offp=  1; codes=codes_bds; ncode= 9; break;
        default: return sync?0:10;
    }
    for (j=0;j<nsat&&i+5+17+np<=rtcm->len*8;j++) {
        prn     =getbitu(rtcm->buff,i,np)+offp; i+=np;
        nbias   =getbitu(rtcm->buff,i, 5);      i+= 5;
        yaw_ang =getbitu(rtcm->buff,i, 9);      i+= 9;
        yaw_rate=getbits(rtcm->buff,i, 8);      i+= 8;
        
        for (k=0;k<MAXCODE;k++) pbias[k]=stdpb[k]=0.0;
        for (k=0;k<nbias&&i+49<=rtcm->len*8;k++) {
            mode=getbitu(rtcm->buff,i, 5); i+= 5;
            sii =getbitu(rtcm->buff,i, 1); i+= 1; /* integer-indicator */
            swl =getbitu(rtcm->buff,i, 2); i+= 2; /* WL integer-indicator */
            sdc =getbitu(rtcm->buff,i, 4); i+= 4; /* discontinuity counter */
            bias=getbits(rtcm->buff,i,20); i+=20; /* phase bias (m) */
            std =getbitu(rtcm->buff,i,17); i+=17; /* phase bias std-dev (m) */
            if (mode<=ncode) {
                pbias[codes[mode]-1]=bias*0.0001; /* (m) */
                stdpb[codes[mode]-1]=std *0.0001; /* (m) */
            }
            else {
                trace(2,"rtcm3 %d not supported mode: mode=%d\n",type,mode);
            }
        }
        if (!(sat=satno(sys,prn))) {
            trace(2,"rtcm3 %d satellite number error: prn=%d\n",type,prn);
            continue;
        }
        rtcm->ssr[sat-1].t0 [5]=rtcm->time;
        rtcm->ssr[sat-1].udi[5]=udint;
        rtcm->ssr[sat-1].iod[5]=iod;
        rtcm->ssr[sat-1].yaw_ang =yaw_ang / 256.0*180.0; /* (deg) */
        rtcm->ssr[sat-1].yaw_rate=yaw_rate/8192.0*180.0; /* (deg/s) */
        
        for (k=0;k<MAXCODE;k++) {
            rtcm->ssr[sat-1].pbias[k]=pbias[k];
            rtcm->ssr[sat-1].stdpb[k]=(float)stdpb[k];
        }
    }
    return 20;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x430, %rsp            # imm = 0x430
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl $0x18, %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x3c0(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x3c8(%rbp), %rdx
leaq -0x3cc(%rbp), %rcx
leaq -0x28(%rbp), %r8
leaq -0x3f8(%rbp), %r9
leaq -0x3e8(%rbp), %r10
leaq -0x3b4(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x7c7a0
movl %eax, -0x3d0(%rbp)
cmpl $0x0, %eax
jge 0x79638
movl -0x3c0(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %ecx
movl $0x2, %edi
leaq 0x47b47(%rip), %rsi     # 0xc116c
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x79d00
movl -0x14(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x410(%rbp)
subl $0x1f, %eax
ja 0x79743
movq -0x410(%rbp), %rax
leaq 0x47733(%rip), %rcx     # 0xc0d90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x6, -0x3e4(%rbp)
movl $0x0, -0x3ec(%rbp)
leaq 0x4790f(%rip), %rax     # 0xc0f90
movq %rax, -0x20(%rbp)
movl $0x11, -0x3e0(%rbp)
jmp 0x7975e
movl $0x5, -0x3e4(%rbp)
movl $0x0, -0x3ec(%rbp)
leaq 0x47931(%rip), %rax     # 0xc0fe0
movq %rax, -0x20(%rbp)
movl $0x4, -0x3e0(%rbp)
jmp 0x7975e
movl $0x6, -0x3e4(%rbp)
movl $0x0, -0x3ec(%rbp)
leaq 0x47913(%rip), %rax     # 0xc0ff0
movq %rax, -0x20(%rbp)
movl $0x13, -0x3e0(%rbp)
jmp 0x7975e
movl $0x4, -0x3e4(%rbp)
movl $0xc0, -0x3ec(%rbp)
leaq 0x47938(%rip), %rax     # 0xc1040
movq %rax, -0x20(%rbp)
movl $0xd, -0x3e0(%rbp)
jmp 0x7975e
movl $0x6, -0x3e4(%rbp)
movl $0x1, -0x3ec(%rbp)
leaq 0x4794d(%rip), %rax     # 0xc1080
movq %rax, -0x20(%rbp)
movl $0x9, -0x3e0(%rbp)
jmp 0x7975e
movl -0x3c8(%rbp), %edx
movl $0xa, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x79d00
movl $0x0, -0x3b8(%rbp)
movl -0x3b8(%rbp), %ecx
xorl %eax, %eax
cmpl -0x3d0(%rbp), %ecx
movb %al, -0x411(%rbp)
jge 0x797a8
movl -0x3b4(%rbp), %eax
addl $0x5, %eax
addl $0x11, %eax
addl -0x3e4(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
setle %al
movb %al, -0x411(%rbp)
movb -0x411(%rbp), %al
testb $0x1, %al
jne 0x797b7
jmp 0x79cf9
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl -0x3e4(%rbp), %edx
callq 0x8bfc0
addl -0x3ec(%rbp), %eax
movl %eax, -0x3d4(%rbp)
movl -0x3e4(%rbp), %eax
addl -0x3b4(%rbp), %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x5, %edx
callq 0x8bfc0
movl %eax, -0x3dc(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x9, %edx
callq 0x8bfc0
movl %eax, -0x400(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x9, %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
movl %eax, -0x404(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x3b4(%rbp)
movl $0x0, -0x3bc(%rbp)
cmpl $0x37, -0x3bc(%rbp)
jge 0x798cb
movslq -0x3bc(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x3b0(%rbp,%rax,8)
movslq -0x3bc(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x1f0(%rbp,%rax,8)
movl -0x3bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3bc(%rbp)
jmp 0x7988b
movl $0x0, -0x3bc(%rbp)
movl -0x3bc(%rbp), %ecx
xorl %eax, %eax
cmpl -0x3dc(%rbp), %ecx
movb %al, -0x412(%rbp)
jge 0x7990c
movl -0x3b4(%rbp), %eax
addl $0x31, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
setle %al
movb %al, -0x412(%rbp)
movb -0x412(%rbp), %al
testb $0x1, %al
jne 0x7991b
jmp 0x79ada
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x5, %edx
callq 0x8bfc0
movl %eax, -0x3c4(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
movl %eax, -0x3f0(%rbp)
movl -0x3b4(%rbp), %eax
incl %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x2, %edx
callq 0x8bfc0
movl %eax, -0x3f4(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x4, %edx
callq 0x8bfc0
movl %eax, -0x3fc(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x14, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3b4(%rbp), %esi
movl $0x11, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x3b4(%rbp), %eax
addl $0x11, %eax
movl %eax, -0x3b4(%rbp)
movl -0x3c4(%rbp), %eax
cmpl -0x3e0(%rbp), %eax
jg 0x79aa5
movsd 0x4340f(%rip), %xmm0    # 0xbce68
mulsd -0x30(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x3c4(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
cltq
movsd %xmm0, -0x1f0(%rbp,%rax,8)
movsd 0x433e6(%rip), %xmm0    # 0xbce68
mulsd -0x38(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x3c4(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
cltq
movsd %xmm0, -0x3b0(%rbp,%rax,8)
jmp 0x79ac4
movl -0x3c0(%rbp), %edx
movl -0x3c4(%rbp), %ecx
movl $0x2, %edi
leaq 0x48091(%rip), %rsi     # 0xc1b4e
movb $0x0, %al
callq 0x8b980
jmp 0x79ac6
movl -0x3bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3bc(%rbp)
jmp 0x798d5
movl -0x14(%rbp), %edi
movl -0x3d4(%rbp), %esi
callq 0x8b1b0
movl %eax, -0x3d8(%rbp)
cmpl $0x0, %eax
jne 0x79b17
movl -0x3c0(%rbp), %edx
movl -0x3d4(%rbp), %ecx
movl $0x2, %edi
leaq 0x47f5d(%rip), %rsi     # 0xc1a68
movb $0x0, %al
callq 0x8b980
jmp 0x79ce5
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x3d8(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movq 0x10(%rcx), %rdx
movq %rdx, 0x50(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x58(%rax)
movsd -0x28(%rbp), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x3d8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movsd %xmm0, 0x88(%rax)
movl -0x3cc(%rbp), %ecx
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x3d8(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x498, %rdx, %rdx      # imm = 0x498
addq %rdx, %rax
movl %ecx, 0xa4(%rax)
cvtsi2sdl -0x400(%rbp), %xmm0
movsd 0x44214(%rip), %xmm1    # 0xbddc8
divsd %xmm1, %xmm0
movsd 0x46e80(%rip), %xmm1    # 0xc0a40
mulsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x3d8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movsd %xmm0, 0x480(%rax)
cvtsi2sdl -0x404(%rbp), %xmm0
movsd 0x46e4c(%rip), %xmm1    # 0xc0a48
divsd %xmm1, %xmm0
movsd 0x46e38(%rip), %xmm1    # 0xc0a40
mulsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x3d8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movsd %xmm0, 0x488(%rax)
movl $0x0, -0x3bc(%rbp)
cmpl $0x37, -0x3bc(%rbp)
jge 0x79ce3
movslq -0x3bc(%rbp), %rax
movsd -0x1f0(%rbp,%rax,8), %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x3d8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movslq -0x3bc(%rbp), %rcx
movsd %xmm0, 0x1e8(%rax,%rcx,8)
movslq -0x3bc(%rbp), %rax
movsd -0x3b0(%rbp,%rax,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x10(%rbp), %rax
addq $0x6f148, %rax          # imm = 0x6F148
movl -0x3d8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x498, %rcx, %rcx      # imm = 0x498
addq %rcx, %rax
movslq -0x3bc(%rbp), %rcx
movss %xmm0, 0x3a0(%rax,%rcx,4)
movl -0x3bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3bc(%rbp)
jmp 0x79c3e
jmp 0x79ce5
movl -0x3b8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3b8(%rbp)
jmp 0x79768
movl $0x14, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x430, %rsp            # imm = 0x430
popq %rbp
retq
nopl (%rax)