// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_msm5(bamboo::rtcm_t*, int)
static int decode_msm5(rtcm_t *rtcm, int sys)
{
    msm_h_t h={0};
    double r[64],rr[64],pr[64],cp[64],rrf[64],cnr[64];
    int i,j,type,sync,iod,ncell,rng,rng_m,rate,prv,cpv,rrv,lock[64];
    int ex[64],half[64];
    
    type=getbitu(rtcm->buff,24,12);
    
    /* decode msm header */
    if ((ncell=decode_msm_head(rtcm,sys,&sync,&iod,&h,&i))<0) return -1;
    
    if (i+h.nsat*36+ncell*63>rtcm->len*8) {
        trace(2,"rtcm3 %d length error: nsat=%d ncell=%d len=%d\n",type,h.nsat,
              ncell,rtcm->len);
        return -1;
    }
    for (j=0;j<h.nsat;j++) {
        r[j]=rr[j]=0.0; ex[j]=15;
    }
    for (j=0;j<ncell;j++) pr[j]=cp[j]=rrf[j]=-1E16;
    
    /* decode satellite data */
    for (j=0;j<h.nsat;j++) { /* range */
        rng  =getbitu(rtcm->buff,i, 8); i+= 8;
        if (rng!=255) r[j]=rng*RANGE_MS;
    }
    for (j=0;j<h.nsat;j++) { /* extended info */
        ex[j]=getbitu(rtcm->buff,i, 4); i+= 4;
    }
    for (j=0;j<h.nsat;j++) {
        rng_m=getbitu(rtcm->buff,i,10); i+=10;
        if (r[j]!=0.0) r[j]+=rng_m*P2_10*RANGE_MS;
    }
    for (j=0;j<h.nsat;j++) { /* phaserangerate */
        rate =getbits(rtcm->buff,i,14); i+=14;
        if (rate!=-8192) rr[j]=rate*1.0;
    }
    /* decode signal data */
    for (j=0;j<ncell;j++) { /* pseudorange */
        prv=getbits(rtcm->buff,i,15); i+=15;
        if (prv!=-16384) pr[j]=prv*P2_24*RANGE_MS;
    }
    for (j=0;j<ncell;j++) { /* phaserange */
        cpv=getbits(rtcm->buff,i,22); i+=22;
        if (cpv!=-2097152) cp[j]=cpv*P2_29*RANGE_MS;
    }
    for (j=0;j<ncell;j++) { /* lock time */
        lock[j]=getbitu(rtcm->buff,i,4); i+=4;
    }
    for (j=0;j<ncell;j++) { /* half-cycle ambiguity */
        half[j]=getbitu(rtcm->buff,i,1); i+=1;
    }
    for (j=0;j<ncell;j++) { /* cnr */
        cnr[j]=getbitu(rtcm->buff,i,6)*1.0; i+=6;
    }
    for (j=0;j<ncell;j++) { /* phaserangerate */
        rrv=getbits(rtcm->buff,i,15); i+=15;
        if (rrv!=-16384) rrf[j]=rrv*0.0001;
    }
    /* save obs data in msm message */
    save_msm_obs(rtcm,sys,&h,r,pr,cp,rr,rrf,cnr,lock,ex,half);
    
    rtcm->obsflag=!sync;
    return sync?0:1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xfe8, %rsp            # imm = 0xFE8
movl %esi, %r12d
movq %rdi, %r14
leaq -0x104(%rbp), %rbx
movl $0xa8, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8390
leaq 0x9f0c4(%r14), %r15
movq %r15, %rdi
movl $0x18, %esi
movl $0xc, %edx
callq 0x4d9d6
movl %eax, %r13d
leaq -0x40(%rbp), %rdx
leaq -0x5c(%rbp), %rcx
leaq -0x44(%rbp), %r9
movq %r14, %rdi
movl %r12d, %esi
movq %rbx, %r8
callq 0x42f6d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x41773
movl %eax, %r8d
movl %r12d, -0x3c(%rbp)
movl -0x44(%rbp), %r12d
movzbl -0xfe(%rbp), %ecx
leal (%rcx,%rcx,8), %eax
movl %r8d, %edx
shll $0x6, %edx
subl %r8d, %edx
addl %r12d, %edx
leal (%rdx,%rax,4), %eax
movl 0x9f0c0(%r14), %r9d
leal (,%r9,8), %edx
cmpl %edx, %eax
jle 0x413c3
leaq 0x2e694(%rip), %rsi     # 0x6fa43
movl $0x2, %edi
movl %r13d, %edx
xorl %eax, %eax
callq 0x4d55d
jmp 0x41773
movq %r14, -0x58(%rbp)
testl %ecx, %ecx
movl %r8d, -0x2c(%rbp)
movq %rcx, -0x38(%rbp)
je 0x4141b
leal (,%rcx,8), %ebx
leaq -0xe10(%rbp), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
movq %rbx, %rdx
callq 0x8390
leaq -0x410(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x8390
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movl $0xf, -0x210(%rbp,%r14,4)
incq %r14
cmpq %r14, %rcx
jne 0x41407
movl %r8d, %ebx
testl %r8d, %r8d
je 0x4144f
xorl %eax, %eax
movabsq $-0x3cbe3c86c81f8000, %rdx # imm = 0xC341C37937E08000
movq %rdx, -0x810(%rbp,%rax,8)
movq %rdx, -0xa10(%rbp,%rax,8)
movq %rdx, -0xc10(%rbp,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x4142f
testq %rcx, %rcx
je 0x4157e
movl %ecx, %eax
movq %rax, -0x50(%rbp)
movl %ecx, %r14d
shll $0x3, %r14d
xorl %r13d, %r13d
leal (%r12,%r13), %esi
movq %r15, %rdi
movl $0x8, %edx
callq 0x4d9d6
cmpl $0xff, %eax
je 0x41499
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2d971(%rip), %xmm0    # 0x6ee00
movsd %xmm0, -0x410(%rbp,%r13)
addq $0x8, %r13
cmpq %r13, %r14
jne 0x41468
addq %r13, %r12
cmpq $0x0, -0x38(%rbp)
je 0x4157e
xorl %r14d, %r14d
movq -0x50(%rbp), %r13
movq %r15, %rdi
movl %r12d, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, -0x210(%rbp,%r14,4)
addl $0x4, %r12d
incq %r14
cmpq %r14, %r13
jne 0x414b7
cmpq $0x0, -0x38(%rbp)
je 0x4157e
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0xa, %edx
callq 0x4d9d6
movsd -0x410(%rbp,%r14,8), %xmm0
ucomisd 0x293fd(%rip), %xmm0    # 0x6a908
jne 0x4150f
jnp 0x41534
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x2d952(%rip), %xmm1    # 0x6ee70
mulsd 0x2d8da(%rip), %xmm1    # 0x6ee00
addsd %xmm0, %xmm1
movsd %xmm1, -0x410(%rbp,%r14,8)
incq %r14
addl $0xa, %r12d
cmpq %r14, %r13
jne 0x414e9
cmpq $0x0, -0x38(%rbp)
je 0x4157e
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0xe, %edx
callq 0x4da25
cmpl $0xffffe000, %eax       # imm = 0xFFFFE000
je 0x41572
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0xe10(%rbp,%r14,8)
incq %r14
addl $0xe, %r12d
cmpq %r14, %r13
jne 0x4154a
cmpl $0x0, -0x2c(%rbp)
je 0x416ff
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0xf, %edx
callq 0x4da25
cmpl $0xffffc000, %eax       # imm = 0xFFFFC000
je 0x415c3
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2b79f(%rip), %xmm0    # 0x6cd50
mulsd 0x2d847(%rip), %xmm0    # 0x6ee00
movsd %xmm0, -0xc10(%rbp,%r14,8)
incq %r14
addl $0xf, %r12d
cmpq %r14, %rbx
jne 0x4158b
cmpl $0x0, -0x2c(%rbp)
je 0x416ff
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0x16, %edx
callq 0x4da25
cmpl $0xffe00000, %eax       # imm = 0xFFE00000
je 0x41614
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2b6d6(%rip), %xmm0    # 0x6ccd8
mulsd 0x2d7f6(%rip), %xmm0    # 0x6ee00
movsd %xmm0, -0xa10(%rbp,%r14,8)
incq %r14
addl $0x16, %r12d
cmpq %r14, %rbx
jne 0x415dc
cmpl $0x0, -0x2c(%rbp)
je 0x416ff
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, -0x610(%rbp,%r14,4)
addl $0x4, %r12d
incq %r14
cmpq %r14, %rbx
jne 0x4162d
cmpl $0x0, -0x2c(%rbp)
je 0x416ff
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0x1, %edx
callq 0x4d9d6
movl %eax, -0x510(%rbp,%r14,4)
incl %r12d
incq %r14
cmpq %r14, %rbx
jne 0x4165e
cmpl $0x0, -0x2c(%rbp)
je 0x416ff
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x1010(%rbp,%r14,8)
addl $0x6, %r12d
incq %r14
cmpq %r14, %rbx
jne 0x4168a
cmpl $0x0, -0x2c(%rbp)
je 0x416ff
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl $0xf, %edx
callq 0x4da25
cmpl $0xffffc000, %eax       # imm = 0xFFFFC000
je 0x416f3
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x29237(%rip), %xmm0    # 0x6a920
movsd %xmm0, -0x810(%rbp,%r14,8)
incq %r14
addl $0xf, %r12d
cmpq %r14, %rbx
jne 0x416c3
leaq -0x510(%rbp), %rax
leaq -0x210(%rbp), %r10
leaq -0x610(%rbp), %r11
leaq -0x1010(%rbp), %rbx
leaq -0x810(%rbp), %r14
leaq -0xe10(%rbp), %r15
leaq -0x104(%rbp), %rdx
leaq -0x410(%rbp), %rcx
leaq -0xc10(%rbp), %r8
leaq -0xa10(%rbp), %r9
movq -0x58(%rbp), %r12
movq %r12, %rdi
movl -0x3c(%rbp), %esi
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
pushq %r15
callq 0x4336c
addq $0x30, %rsp
xorl %ebx, %ebx
cmpl $0x0, -0x40(%rbp)
sete %bl
movl %ebx, 0x9bdd0(%r12)
movl %ebx, %eax
addq $0xfe8, %rsp            # imm = 0xFE8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq