// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x9f0c4(%rdi), %r15
movq %r15, %rdi
movl $0x18, %esi
movl $0xc, %edx
callq 0x4d9d6
xorl %edx, %edx
cmpl $0x10, %r14d
setne %dl
cmpl $0x4, %r14d
leal 0x5b(%rdx,%rdx), %ecx
movl $0x5a, %esi
cmovnel %ecx, %esi
movl %eax, -0x30(%rbp)
movl 0x9f0c0(%rbx), %ecx
leal (,%rcx,8), %eax
cmpl %eax, %esi
jg 0x4254f
leal 0x4(,%rdx,2), %r13d
cmpl $0x4, %r14d
movq %r14, -0x40(%rbp)
movq %r15, %rdi
movl $0x24, %esi
jne 0x42059
movl $0x11, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
callq 0x42a20
movl $0x35, %r12d
jmp 0x42078
movl $0x14, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
callq 0x42786
movl $0x38, %r12d
movq %r15, %rdi
movl %r12d, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %r14d
leal 0x4(%r12), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4d9d6
movq %rax, -0x38(%rbp)
leal 0x5(%r12), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4d9d6
movq %rax, -0x78(%rbp)
leal 0x9(%r12), %esi
movq %r15, %rdi
movl $0x10, %edx
callq 0x4d9d6
movq %rax, -0x58(%rbp)
leal 0x19(%r12), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4d9d6
movq %rax, -0x50(%rbp)
leal 0x1d(%r12), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4d9d6
leal 0x1e(%r12), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4d9d6
leal 0x1f(%r12), %esi
movq %r15, %rdi
movq %r13, -0x48(%rbp)
movl %r13d, %edx
callq 0x4d9d6
movl %eax, %r13d
movl %r14d, -0x2c(%rbp)
movslq %r14d, %rax
leaq 0x2cad4(%rip), %rcx     # 0x6ec00
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, -0xa0(%rbp)
movq 0x10(%rbx), %rdi
movsd 0x18(%rbx), %xmm0
leaq -0x260(%rbp), %r14
movq %r14, %rsi
movl $0x2, %edx
callq 0x4fcf1
subq $0x8, %rsp
leaq 0x2d9ca(%rip), %rsi     # 0x6fb2b
movl $0x4, %edi
movq %r14, %rdx
movq -0x40(%rbp), %rcx
movl %r13d, %r8d
movq -0x38(%rbp), %r9
xorl %eax, %eax
pushq -0x50(%rbp)
movq -0x78(%rbp), %r14
pushq -0x58(%rbp)
pushq %r14
callq 0x4d55d
addq $0x20, %rsp
cmpl $0x0, 0xc(%rbx)
je 0x421d2
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
subq $0x8, %rsp
leaq 0x2d705(%rip), %rsi     # 0x6f8b8
leaq -0x260(%rbp), %rdx
movl %r13d, %ecx
movl %r14d, %r8d
movl -0x2c(%rbp), %r9d
xorl %eax, %eax
pushq -0x38(%rbp)
callq 0x8120
addq $0x10, %rsp
movq -0x38(%rbp), %rdx
testl %r13d, %r13d
js 0x42549
movq -0x40(%rbp), %rax
addl $-0x4, %eax
roll $0x1e, %eax
cmpl $0x8, %eax
jae 0x4253b
movl $0x8b, %ecx
btl %eax, %ecx
jae 0x4253b
testl %r13d, %r13d
je 0x42534
movq -0x48(%rbp), %rcx
addl %ecx, %r12d
addl $0x1f, %r12d
leaq 0x10(%rbx), %rcx
movq %rcx, -0x88(%rbp)
movl %eax, %eax
leaq 0x2d950(%rip), %rcx     # 0x6fb78
movl (%rcx,%rax,4), %edx
leaq 0x2d966(%rip), %rcx     # 0x6fb98
movl (%rcx,%rax,4), %ecx
movl %ecx, -0x60(%rbp)
leaq 0x2d979(%rip), %rcx     # 0x6fbb8
movl (%rcx,%rax,4), %ecx
movl %ecx, -0x58(%rbp)
leaq 0x2cb38(%rip), %rcx     # 0x6ed84
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %rax, -0x50(%rbp)
leal 0x16(%rdx), %eax
movq %rax, -0x98(%rbp)
leaq 0x6f148(%rbx), %rax
movq %rax, -0x80(%rbp)
movq %rdx, -0x90(%rbp)
leal 0x47(%rdx), %eax
movl %eax, -0x5c(%rbp)
xorl %edx, %edx
movq %rbx, -0x38(%rbp)
movl %r13d, -0x64(%rbp)
movq -0x98(%rbp), %rax
addl %r12d, %eax
movl 0x9f0c0(%rbx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x42534
movl %edx, -0x2c(%rbp)
movq %r15, %rdi
movl %r12d, %esi
movq -0x90(%rbp), %r14
movl %r14d, %edx
callq 0x4d9d6
movl %eax, -0x48(%rbp)
leal (%r12,%r14), %esi
movq %r15, %rdi
movl $0x5, %edx
callq 0x4d9d6
movl %eax, %r13d
leal (%r12,%r14), %esi
addl $0x5, %esi
movq %r15, %rdi
movl $0x9, %edx
callq 0x4d9d6
movl %eax, -0x6c(%rbp)
leal (%r12,%r14), %esi
addl $0xe, %esi
movq %r15, %rdi
movl $0x8, %edx
callq 0x4da25
movl %eax, -0x68(%rbp)
movl $0x1b8, %edx            # imm = 0x1B8
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
callq 0x8390
movl $0x1b8, %edx            # imm = 0x1B8
leaq -0x260(%rbp), %rdi
xorl %esi, %esi
callq 0x8390
testl %r13d, %r13d
jle 0x42429
addl -0x5c(%rbp), %r12d
movl %r12d, %r14d
leal -0x31(%r14), %r12d
movl 0x9f0c0(%rbx), %eax
shll $0x3, %eax
cmpl %eax, %r14d
jg 0x42430
movq %r15, %rdi
movl %r12d, %esi
movl $0x5, %edx
callq 0x4d9d6
movl %eax, %ebx
leal -0x2c(%r14), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4d9d6
leal -0x2b(%r14), %esi
movq %r15, %rdi
movl $0x2, %edx
callq 0x4d9d6
leal -0x29(%r14), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4d9d6
leal -0x25(%r14), %esi
movq %r15, %rdi
movl $0x14, %edx
callq 0x4da25
movl %eax, %r12d
leal -0x11(%r14), %esi
movq %r15, %rdi
movl $0x11, %edx
callq 0x4d9d6
cmpl -0x58(%rbp), %ebx
jle 0x423d0
movl $0x2, %edi
leaq 0x2d567(%rip), %rsi     # 0x6f929
movl -0x30(%rbp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4d55d
jmp 0x4240f
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movsd 0x28536(%rip), %xmm2    # 0x6a920
mulsd %xmm2, %xmm1
movslq %ebx, %rax
movq -0x50(%rbp), %rcx
movslq (%rcx,%rax,4), %rax
movsd %xmm1, -0x268(%rbp,%rax,8)
mulsd %xmm2, %xmm0
movsd %xmm0, -0x428(%rbp,%rax,8)
addl $0x31, %r14d
decl %r13d
movq -0x38(%rbp), %rbx
jne 0x42331
addl $-0x31, %r14d
movl %r14d, %r12d
jmp 0x42430
addl %r14d, %r12d
addl $0x16, %r12d
movq -0x40(%rbp), %rdi
movl -0x48(%rbp), %ebx
addl -0x60(%rbp), %ebx
movl %ebx, %esi
callq 0x4d28d
testl %eax, %eax
movq -0x78(%rbp), %r14
je 0x42506
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0x88(%rbp), %rcx
movups (%rcx), %xmm0
movq -0x80(%rbp), %rcx
leaq (%rcx,%rax), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
movups %xmm0, -0x198(%rdi)
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0x160(%rdi)
movl %r14d, -0x144(%rdi)
xorps %xmm0, %xmm0
cvtsi2sdl -0x6c(%rbp), %xmm0
mulsd 0x298f9(%rip), %xmm0    # 0x6bd98
movsd 0x2c9d9(%rip), %xmm1    # 0x6ee80
mulsd %xmm1, %xmm0
movsd %xmm0, 0x298(%rdi)
xorps %xmm0, %xmm0
cvtsi2sdl -0x68(%rbp), %xmm0
leaq (%rcx,%rax), %rbx
mulsd 0x2c9c1(%rip), %xmm0    # 0x6ee88
mulsd %xmm1, %xmm0
movsd %xmm0, 0x2a0(%rdi)
movl $0x1b8, %edx            # imm = 0x1B8
leaq -0x260(%rbp), %rsi
callq 0x84f0
xorl %eax, %eax
xorps %xmm0, %xmm0
cvtsd2ss -0x420(%rbp,%rax,8), %xmm0
movss %xmm0, 0x3a0(%rbx,%rax,4)
incq %rax
cmpq $0x37, %rax
jne 0x424e6
jmp 0x4251e
movl $0x2, %edi
leaq 0x2d331(%rip), %rsi     # 0x6f843
movl -0x30(%rbp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4d55d
movl -0x2c(%rbp), %edx
incl %edx
movl -0x64(%rbp), %r13d
cmpl %r13d, %edx
movq -0x38(%rbp), %rbx
jne 0x42283
movl $0x14, %eax
jmp 0x4256a
xorl %ecx, %ecx
testl %edx, %edx
movl $0xa, %eax
cmovnel %ecx, %eax
jmp 0x4256a
movl 0x9f0c0(%rbx), %ecx
leaq 0x2c9f1(%rip), %rsi     # 0x6ef47
movl $0x2, %edi
movl -0x30(%rbp), %edx
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq