// File: /workspace/github_cpp_makefile_star2_O1/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 $0xfd8, %rsp            # imm = 0xFD8
movl %esi, %r13d
movq %rdi, %r12
leaq -0xf4(%rbp), %r14
movl $0xa8, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x8390
leaq 0x9f0c4(%r12), %r15
movq %r15, %rdi
movl $0x18, %esi
movl $0xc, %edx
callq 0x4e341
movl %eax, %ebx
leaq -0x48(%rbp), %rdx
leaq -0x4c(%rbp), %rcx
leaq -0x2c(%rbp), %r9
movq %r12, %rdi
movl %r13d, -0x44(%rbp)
movl %r13d, %esi
movq %r14, %r8
callq 0x4380e
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x41f35
movl %eax, %r14d
movzbl -0xee(%rbp), %ecx
leal (%rcx,%rcx,8), %eax
movl %r14d, %edx
shll $0x6, %edx
subl %r14d, %edx
addl -0x2c(%rbp), %edx
leal (%rdx,%rax,4), %eax
movl 0x9f0c0(%r12), %r9d
leal (,%r9,8), %edx
cmpl %edx, %eax
jle 0x41b02
leaq 0x2df57(%rip), %rsi     # 0x6fa43
movl $0x2, %edi
movl %ebx, %edx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x4ded0
jmp 0x41f35
testq %rcx, %rcx
movq %rcx, -0x38(%rbp)
je 0x41b52
leal (,%rcx,8), %edx
leaq -0xe00(%rbp), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x8390
movq -0x38(%rbp), %rax
leal (,%rax,8), %edx
leaq -0x400(%rbp), %rdi
xorl %esi, %esi
callq 0x8390
movq -0x38(%rbp), %rcx
movl $0xf, -0x200(%rbp,%rbx,4)
incq %rbx
cmpq %rbx, %rcx
jne 0x41b3f
testl %r14d, %r14d
je 0x41b90
cmpl $0x2, %r14d
movl $0x1, %eax
cmovgel %r14d, %eax
xorl %esi, %esi
movabsq $-0x3cbe3c86c81f8000, %rdx # imm = 0xC341C37937E08000
movq %rdx, -0x800(%rbp,%rsi,8)
movq %rdx, -0xa00(%rbp,%rsi,8)
movq %rdx, -0xc00(%rbp,%rsi,8)
incq %rsi
cmpq %rsi, %rax
jne 0x41b70
movl -0x2c(%rbp), %r13d
testl %ecx, %ecx
movq %r12, -0x40(%rbp)
je 0x41bed
leal (,%rcx,8), %r12d
xorl %ebx, %ebx
leal (%rbx,%r13), %esi
movq %r15, %rdi
movl $0x8, %edx
callq 0x4e341
cmpl $0xff, %eax
je 0x41bd6
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2d233(%rip), %xmm0    # 0x6ee00
movsd %xmm0, -0x400(%rbp,%rbx)
addq $0x8, %rbx
cmpq %rbx, %r12
jne 0x41ba6
addl %r13d, %ebx
movl %ebx, %r13d
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %rcx
movl %r13d, -0x2c(%rbp)
testq %rcx, %rcx
movl %r14d, -0x30(%rbp)
je 0x41c34
leal (,%rcx,4), %ebx
movl %r13d, %r14d
xorl %r12d, %r12d
leal (%r14,%r12), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4e341
movl %eax, -0x200(%rbp,%r12)
addq $0x4, %r12
cmpq %r12, %rbx
jne 0x41c07
addl %r12d, %r13d
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %rcx
movl %r13d, -0x2c(%rbp)
testq %rcx, %rcx
je 0x41c98
xorl %ebx, %ebx
movq %r15, %rdi
movl %r13d, %esi
movl $0xa, %edx
callq 0x4e341
movsd -0x400(%rbp,%rbx,8), %xmm0
ucomisd 0x28ca8(%rip), %xmm0    # 0x6a908
jne 0x41c64
jnp 0x41c88
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x2d1fd(%rip), %xmm1    # 0x6ee70
mulsd 0x2d185(%rip), %xmm1    # 0x6ee00
addsd %xmm0, %xmm1
movsd %xmm1, -0x400(%rbp,%rbx,8)
incq %rbx
addl $0xa, %r13d
movq -0x38(%rbp), %rcx
cmpq %rbx, %rcx
jne 0x41c3f
movl %r13d, -0x2c(%rbp)
testq %rcx, %rcx
je 0x41cda
movl %ecx, %ebx
xorl %r14d, %r14d
movq %r15, %rdi
movl %r13d, %esi
movl $0xe, %edx
callq 0x4e390
cmpl $0xffffe000, %eax       # imm = 0xFFFFE000
je 0x41cce
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0xe00(%rbp,%r14,8)
incq %r14
addl $0xe, %r13d
cmpq %r14, %rbx
jne 0x41ca6
movl %r13d, -0x2c(%rbp)
movl -0x30(%rbp), %eax
testl %eax, %eax
je 0x41d37
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
xorl %r14d, %r14d
movq %r15, %rdi
movl %r13d, %esi
movl $0xf, %edx
callq 0x4e390
cmpl $0xffffc000, %eax       # imm = 0xFFFFC000
je 0x41d2b
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2b037(%rip), %xmm0    # 0x6cd50
mulsd 0x2d0df(%rip), %xmm0    # 0x6ee00
movsd %xmm0, -0xc00(%rbp,%r14,8)
incq %r14
addl $0xf, %r13d
cmpq %r14, %rbx
jne 0x41cf3
movl %r13d, -0x2c(%rbp)
movl -0x30(%rbp), %eax
testl %eax, %eax
je 0x41d94
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
xorl %r14d, %r14d
movq %r15, %rdi
movl %r13d, %esi
movl $0x16, %edx
callq 0x4e390
cmpl $0xffe00000, %eax       # imm = 0xFFE00000
je 0x41d88
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2af62(%rip), %xmm0    # 0x6ccd8
mulsd 0x2d082(%rip), %xmm0    # 0x6ee00
movsd %xmm0, -0xa00(%rbp,%r14,8)
incq %r14
addl $0x16, %r13d
cmpq %r14, %rbx
jne 0x41d50
movl %r13d, -0x2c(%rbp)
movl -0x30(%rbp), %eax
testl %eax, %eax
je 0x41de0
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
shlq $0x2, %rbx
movl %r13d, %r12d
xorl %r14d, %r14d
leal (%r12,%r14), %esi
movq %r15, %rdi
movl $0x4, %edx
callq 0x4e341
movl %eax, -0x600(%rbp,%r14)
addq $0x4, %r14
cmpq %r14, %rbx
jne 0x41db4
addl %r14d, %r13d
movq -0x40(%rbp), %r12
movl -0x30(%rbp), %eax
movl %r13d, -0x2c(%rbp)
testl %eax, %eax
je 0x41e24
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
movl %r13d, %r12d
xorl %r14d, %r14d
leal (%r12,%r14), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x4e341
movl %eax, -0x500(%rbp,%r14,4)
incq %r14
cmpq %r14, %rbx
jne 0x41df9
addl %r14d, %r13d
movq -0x40(%rbp), %r12
movl -0x30(%rbp), %eax
movl %r13d, -0x2c(%rbp)
testl %eax, %eax
je 0x41e6a
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
xorl %r14d, %r14d
movq %r15, %rdi
movl %r13d, %esi
movl $0x6, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x1000(%rbp,%r14,8)
addl $0x6, %r13d
incq %r14
cmpq %r14, %rbx
jne 0x41e3a
movl %r13d, -0x2c(%rbp)
movl -0x30(%rbp), %eax
testl %eax, %eax
je 0x41ebf
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
xorl %r14d, %r14d
movq %r15, %rdi
movl %r13d, %esi
movl $0xf, %edx
callq 0x4e390
cmpl $0xffffc000, %eax       # imm = 0xFFFFC000
je 0x41eb3
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x28a77(%rip), %xmm0    # 0x6a920
movsd %xmm0, -0x800(%rbp,%r14,8)
incq %r14
addl $0xf, %r13d
cmpq %r14, %rbx
jne 0x41e83
movl %r13d, -0x2c(%rbp)
leaq -0x500(%rbp), %rax
leaq -0x200(%rbp), %r10
leaq -0x600(%rbp), %r11
leaq -0x1000(%rbp), %rbx
leaq -0x800(%rbp), %r14
leaq -0xe00(%rbp), %r15
leaq -0xf4(%rbp), %rdx
leaq -0x400(%rbp), %rcx
leaq -0xc00(%rbp), %r8
leaq -0xa00(%rbp), %r9
movq %r12, %rdi
movl -0x44(%rbp), %esi
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
pushq %r15
callq 0x43c1c
addq $0x30, %rsp
xorl %r13d, %r13d
cmpl $0x0, -0x48(%rbp)
sete %r13b
movl %r13d, 0x9bdd0(%r12)
movl %r13d, %eax
addq $0xfd8, %rsp            # imm = 0xFD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq