// File: /workspace/github_cpp_makefile_star2_O1/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 0x4e341
xorl %ecx, %ecx
cmpl $0x10, %r14d
setne %cl
cmpl $0x4, %r14d
leal 0x5b(%rcx,%rcx), %edx
movl $0x5a, %esi
cmovnel %edx, %esi
movl %eax, -0x3c(%rbp)
movl 0x9f0c0(%rbx), %eax
shll $0x3, %eax
cmpl %eax, %esi
movq %r14, -0x48(%rbp)
jle 0x428bf
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq %rax, -0x38(%rbp)
movq %rax, -0x50(%rbp)
jmp 0x42a72
leal 0x4(,%rcx,2), %r12d
movq %r15, %rdi
movl $0x24, %esi
cmpl $0x4, %r14d
jne 0x428f6
movl $0x11, %edx
callq 0x4e341
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
callq 0x432c4
movl $0x35, %r13d
jmp 0x42915
movl $0x14, %edx
callq 0x4e341
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
callq 0x4302b
movl $0x38, %r13d
movq %r15, %rdi
movl %r13d, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, -0x2c(%rbp)
leal 0x4(%r13), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4e341
movq %rax, -0x38(%rbp)
leal 0x5(%r13), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4e341
movq %rax, -0x50(%rbp)
leal 0x9(%r13), %esi
movq %r15, %rdi
movl $0x10, %edx
callq 0x4e341
movq %rax, -0x60(%rbp)
leal 0x19(%r13), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4e341
movq %rax, -0x58(%rbp)
leal 0x1d(%r13), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4e341
leal 0x1e(%r13), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4e341
leal 0x1f(%r13), %esi
movq %r15, %rdi
movl %r12d, %edx
callq 0x4e341
movl %eax, %r14d
addl %r13d, %r12d
addl $0x1f, %r12d
movslq -0x2c(%rbp), %rax
leaq 0x2c23e(%rip), %rcx     # 0x6ec00
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, -0x90(%rbp)
movq 0x10(%rbx), %rdi
movsd 0x18(%rbx), %xmm0
leaq -0x260(%rbp), %r13
movq %r13, %rsi
movl $0x2, %edx
callq 0x50696
subq $0x8, %rsp
leaq 0x2d134(%rip), %rsi     # 0x6fb2b
movl $0x4, %edi
movq %r13, %rdx
movl %r14d, %r13d
movq -0x48(%rbp), %rcx
movl %r14d, %r8d
movq -0x38(%rbp), %r9
xorl %eax, %eax
pushq -0x58(%rbp)
movq -0x50(%rbp), %r14
pushq -0x60(%rbp)
pushq %r14
callq 0x4ded0
addq $0x20, %rsp
cmpl $0x0, 0xc(%rbx)
je 0x42a6e
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
subq $0x8, %rsp
leaq 0x2ce6c(%rip), %rsi     # 0x6f8b8
leaq -0x260(%rbp), %rdx
movl %r13d, %ecx
movl %r14d, %r8d
movl -0x2c(%rbp), %r9d
xorl %eax, %eax
movq -0x38(%rbp), %r10
pushq %r10
callq 0x8120
addq $0x10, %rsp
movq -0x48(%rbp), %r14
testl %r13d, %r13d
js 0x42dee
leal -0x4(%r14), %eax
roll $0x1e, %eax
cmpl $0x8, %eax
jae 0x42dde
movl $0x8b, %ecx
btl %eax, %ecx
jae 0x42dde
testl %r13d, %r13d
je 0x42dd7
movl %eax, %eax
leaq 0x2d0cd(%rip), %rcx     # 0x6fb78
movl (%rcx,%rax,4), %r14d
leaq 0x2d0e2(%rip), %rcx     # 0x6fb98
movl (%rcx,%rax,4), %ecx
movl %ecx, -0x68(%rbp)
leaq 0x2d0f5(%rip), %rcx     # 0x6fbb8
movl (%rcx,%rax,4), %ecx
movl %ecx, -0x2c(%rbp)
leaq 0x2c2b4(%rip), %rcx     # 0x6ed84
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %rax, -0x60(%rbp)
leal 0x16(%r14), %eax
movq %rax, -0xa0(%rbp)
leaq 0x10(%rbx), %rax
movq %rax, -0x88(%rbp)
cmpl $0x2, %r13d
movl $0x1, %eax
cmovll %eax, %r13d
leaq 0x6f148(%rbx), %rax
movq %rax, -0x80(%rbp)
leal 0x47(%r14), %eax
movl %eax, -0x64(%rbp)
xorl %edx, %edx
movq %rbx, -0x38(%rbp)
movq %r14, -0x98(%rbp)
movl %r13d, -0x6c(%rbp)
movq -0xa0(%rbp), %rax
addl %r12d, %eax
movl 0x9f0c0(%rbx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x42dd7
movl %edx, -0x58(%rbp)
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x4e341
movl %eax, -0x78(%rbp)
leal (%r12,%r14), %esi
movq %r15, %rdi
movl $0x5, %edx
callq 0x4e341
movl %eax, %r13d
leal (%r12,%r14), %esi
addl $0x5, %esi
movq %r15, %rdi
movl $0x9, %edx
callq 0x4e341
movl %eax, -0x74(%rbp)
leal (%r12,%r14), %esi
addl $0xe, %esi
movq %r15, %rdi
movl $0x8, %edx
callq 0x4e390
movl %eax, -0x70(%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 0x42cc0
addl -0x64(%rbp), %r12d
movl %r12d, %r14d
leal -0x31(%r14), %r12d
movl 0x9f0c0(%rbx), %eax
shll $0x3, %eax
cmpl %eax, %r14d
jg 0x42cc7
movq %r15, %rdi
movl %r12d, %esi
movl $0x5, %edx
callq 0x4e341
movl %eax, %ebx
leal -0x2c(%r14), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4e341
leal -0x2b(%r14), %esi
movq %r15, %rdi
movl $0x2, %edx
callq 0x4e341
leal -0x29(%r14), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4e341
leal -0x25(%r14), %esi
movq %r15, %rdi
movl $0x14, %edx
callq 0x4e390
movl %eax, %r12d
leal -0x11(%r14), %esi
movq %r15, %rdi
movl $0x11, %edx
callq 0x4e341
cmpl -0x2c(%rbp), %ebx
jle 0x42c67
movl $0x2, %edi
leaq 0x2ccd0(%rip), %rsi     # 0x6f929
movl -0x3c(%rbp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4ded0
jmp 0x42ca6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movsd 0x27c9f(%rip), %xmm2    # 0x6a920
mulsd %xmm2, %xmm1
movslq %ebx, %rax
movq -0x60(%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 0x42bc8
addl $-0x31, %r14d
movl %r14d, %r12d
jmp 0x42cc7
addl %r14d, %r12d
addl $0x16, %r12d
movq -0x48(%rbp), %rbx
movl -0x78(%rbp), %r14d
addl -0x68(%rbp), %r14d
movl %ebx, %edi
movl %r14d, %esi
callq 0x4dbc5
testl %eax, %eax
movl -0x6c(%rbp), %r13d
je 0x42da5
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0x88(%rbp), %rcx
movups (%rcx), %xmm0
movq -0x80(%rbp), %rdx
leaq (%rdx,%rax), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
movups %xmm0, -0x198(%rdi)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x160(%rdi)
movq -0x50(%rbp), %rcx
movl %ecx, -0x144(%rdi)
xorps %xmm0, %xmm0
cvtsi2sdl -0x74(%rbp), %xmm0
mulsd 0x2905a(%rip), %xmm0    # 0x6bd98
movsd 0x2c13a(%rip), %xmm1    # 0x6ee80
mulsd %xmm1, %xmm0
movsd %xmm0, 0x298(%rdi)
xorps %xmm0, %xmm0
cvtsi2sdl -0x70(%rbp), %xmm0
leaq (%rdx,%rax), %rbx
mulsd 0x2c122(%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 0x42d85
jmp 0x42dbe
movl $0x2, %edi
leaq 0x2ca92(%rip), %rsi     # 0x6f843
movl -0x3c(%rbp), %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x4ded0
movl -0x58(%rbp), %edx
incl %edx
cmpl %r13d, %edx
movq -0x38(%rbp), %rbx
movq -0x98(%rbp), %r14
jne 0x42b21
movl $0x14, %eax
jmp 0x42e0f
xorl %ecx, %ecx
cmpl $0x0, -0x38(%rbp)
movl $0xa, %eax
cmovnel %ecx, %eax
jmp 0x42e0f
movl 0x9f0c0(%rbx), %ecx
leaq 0x2c14c(%rip), %rsi     # 0x6ef47
movl $0x2, %edi
movl -0x3c(%rbp), %edx
xorl %eax, %eax
callq 0x4ded0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq