// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
leaq -0xf4(%rbp), %r12
movl $0xa8, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x8390
leaq 0x9f0c4(%rbx), %r15
pushq $0x18
popq %rsi
pushq $0xc
popq %rdx
movq %r15, %rdi
callq 0x459f7
movl %eax, %r14d
leaq -0x30(%rbp), %rdx
leaq -0x4c(%rbp), %rcx
leaq -0x34(%rbp), %r9
movq %rbx, %rdi
movl %r13d, -0x2c(%rbp)
movl %r13d, %esi
movq %r12, %r8
callq 0x3bb81
pushq $-0x1
popq %r13
testl %eax, %eax
js 0x3a3db
movl -0x34(%rbp), %r12d
movzbl -0xee(%rbp), %ecx
imull $0x24, %ecx, %edx
imull $0x3f, %eax, %esi
addl %r12d, %esi
addl %edx, %esi
movl 0x9f0c0(%rbx), %r9d
leal (,%r9,8), %edx
cmpl %edx, %esi
jle 0x3a0bd
leaq 0x2b997(%rip), %rsi     # 0x65a3f
pushq $0x2
popq %rdi
movl %r14d, %edx
movl %eax, %r8d
xorl %eax, %eax
callq 0x455bc
jmp 0x3a3db
movq %rbx, -0x40(%rbp)
movl %ecx, %ebx
xorl %ecx, %ecx
cmpq %rcx, %rbx
je 0x3a0ec
andq $0x0, -0xe00(%rbp,%rcx,8)
andq $0x0, -0x400(%rbp,%rcx,8)
movl $0xf, -0x200(%rbp,%rcx,4)
incq %rcx
jmp 0x3a0c5
movl %eax, %r13d
xorl %eax, %eax
movabsq $-0x3cbe3c86c81f8000, %rcx # imm = 0xC341C37937E08000
cmpq %rax, %r13
je 0x3a11d
movq %rcx, -0x800(%rbp,%rax,8)
movq %rcx, -0xa00(%rbp,%rax,8)
movq %rcx, -0xc00(%rbp,%rax,8)
incq %rax
jmp 0x3a0fb
leal (,%rbx,8), %eax
movq %rax, -0x48(%rbp)
xorl %r14d, %r14d
cmpq %r14, -0x48(%rbp)
je 0x3a163
leaq (%r12,%r14), %rsi
movq %r15, %rdi
pushq $0x8
popq %rdx
callq 0x459f7
cmpl $0xff, %eax
je 0x3a15d
cvtsi2sd %eax, %xmm0
mulsd 0x2a5a5(%rip), %xmm0    # 0x646f8
movsd %xmm0, -0x400(%rbp,%r14)
addq $0x8, %r14
jmp 0x3a12b
addl %r14d, %r12d
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x3a18d
movq %r15, %rdi
movl %r12d, %esi
pushq $0x4
popq %rdx
callq 0x459f7
movl %eax, -0x200(%rbp,%r14,4)
addl $0x4, %r12d
incq %r14
jmp 0x3a169
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x3a1e4
movq %r15, %rdi
movl %r12d, %esi
pushq $0xa
popq %rdx
callq 0x459f7
movsd -0x400(%rbp,%r14,8), %xmm0
ucomisd 0x26743(%rip), %xmm0    # 0x608f8
jne 0x3a1b9
jnp 0x3a1db
cvtsi2sd %eax, %xmm1
mulsd 0x2a563(%rip), %xmm1    # 0x64728
mulsd 0x2a52b(%rip), %xmm1    # 0x646f8
addsd %xmm0, %xmm1
movsd %xmm1, -0x400(%rbp,%r14,8)
incq %r14
addl $0xa, %r12d
jmp 0x3a190
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x3a218
movq %r15, %rdi
movl %r12d, %esi
pushq $0xe
popq %rdx
callq 0x45a39
cmpl $0xffffe000, %eax       # imm = 0xFFFFE000
je 0x3a20f
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0xe00(%rbp,%r14,8)
incq %r14
addl $0xe, %r12d
jmp 0x3a1e7
xorl %ebx, %ebx
pushq $0xf
popq %r14
cmpq %rbx, %r13
je 0x3a25e
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x45a39
cmpl $0xffffc000, %eax       # imm = 0xFFFFC000
je 0x3a255
cvtsi2sd %eax, %xmm0
mulsd 0x28b0c(%rip), %xmm0    # 0x62d50
mulsd 0x2a4ac(%rip), %xmm0    # 0x646f8
movsd %xmm0, -0xc00(%rbp,%rbx,8)
incq %rbx
addl $0xf, %r12d
jmp 0x3a21e
xorl %ebx, %ebx
pushq $0x16
popq %r14
cmpq %rbx, %r13
je 0x3a2a4
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x45a39
cmpl $0xffe00000, %eax       # imm = 0xFFE00000
je 0x3a29b
cvtsi2sd %eax, %xmm0
mulsd 0x28a4e(%rip), %xmm0    # 0x62cd8
mulsd 0x2a466(%rip), %xmm0    # 0x646f8
movsd %xmm0, -0xa00(%rbp,%rbx,8)
incq %rbx
addl $0x16, %r12d
jmp 0x3a264
xorl %ebx, %ebx
pushq $0x4
popq %r14
cmpq %rbx, %r13
je 0x3a2cd
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, -0x600(%rbp,%rbx,4)
addl $0x4, %r12d
incq %rbx
jmp 0x3a2aa
xorl %ebx, %ebx
pushq $0x1
popq %r14
cmpq %rbx, %r13
je 0x3a2f5
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, -0x500(%rbp,%rbx,4)
incl %r12d
incq %rbx
jmp 0x3a2d3
xorl %ebx, %ebx
pushq $0x6
popq %r14
cmpq %rbx, %r13
je 0x3a327
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x1000(%rbp,%rbx,8)
addl $0x6, %r12d
incq %rbx
jmp 0x3a2fb
xorl %ebx, %ebx
pushq $0xf
popq %r14
cmpq %rbx, %r13
je 0x3a365
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x45a39
cmpl $0xffffc000, %eax       # imm = 0xFFFFC000
je 0x3a35c
cvtsi2sd %eax, %xmm0
mulsd 0x265bd(%rip), %xmm0    # 0x60910
movsd %xmm0, -0x800(%rbp,%rbx,8)
incq %rbx
addl $0xf, %r12d
jmp 0x3a32d
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 -0x40(%rbp), %r12
movq %r12, %rdi
movl -0x2c(%rbp), %esi
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
pushq %r15
callq 0x3bf58
addq $0x30, %rsp
xorl %r13d, %r13d
cmpl $0x0, -0x30(%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