// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_msm7(bamboo::rtcm_t*, int)
static int decode_msm7(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*80>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,20); i+=20;
        if (prv!=-524288) pr[j]=prv*P2_29*RANGE_MS;
    }
    for (j=0;j<ncell;j++) { /* phaserange */
        cpv=getbits(rtcm->buff,i,24); i+=24;
        if (cpv!=-8388608) cp[j]=cpv*P2_31*RANGE_MS;
    }
    for (j=0;j<ncell;j++) { /* lock time */
        lock[j]=getbitu(rtcm->buff,i,10); i+=10;
    }
    for (j=0;j<ncell;j++) { /* half-cycle amiguity */
        half[j]=getbitu(rtcm->buff,i,1); i+=1;
    }
    for (j=0;j<ncell;j++) { /* cnr */
        cnr[j]=getbitu(rtcm->buff,i,10)*0.0625; i+=10;
    }
    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 0x3ab06
movl -0x34(%rbp), %r12d
movzbl -0xee(%rbp), %ecx
imull $0x24, %ecx, %edx
imull $0x50, %eax, %esi
addl %r12d, %esi
addl %edx, %esi
movl 0x9f0c0(%rbx), %r9d
leal (,%r9,8), %edx
cmpl %edx, %esi
jle 0x3a7e0
leaq 0x2b274(%rip), %rsi     # 0x65a3f
pushq $0x2
popq %rdi
movl %r14d, %edx
movl %eax, %r8d
xorl %eax, %eax
callq 0x455bc
jmp 0x3ab06
movq %rbx, -0x40(%rbp)
movl %ecx, %ebx
xorl %ecx, %ecx
cmpq %rcx, %rbx
je 0x3a80f
andq $0x0, -0xe00(%rbp,%rcx,8)
andq $0x0, -0x400(%rbp,%rcx,8)
movl $0xf, -0x200(%rbp,%rcx,4)
incq %rcx
jmp 0x3a7e8
movl %eax, %r13d
xorl %eax, %eax
movabsq $-0x3cbe3c86c81f8000, %rcx # imm = 0xC341C37937E08000
cmpq %rax, %r13
je 0x3a840
movq %rcx, -0x800(%rbp,%rax,8)
movq %rcx, -0xa00(%rbp,%rax,8)
movq %rcx, -0xc00(%rbp,%rax,8)
incq %rax
jmp 0x3a81e
leal (,%rbx,8), %eax
movq %rax, -0x48(%rbp)
xorl %r14d, %r14d
cmpq %r14, -0x48(%rbp)
je 0x3a886
leaq (%r12,%r14), %rsi
movq %r15, %rdi
pushq $0x8
popq %rdx
callq 0x459f7
cmpl $0xff, %eax
je 0x3a880
cvtsi2sd %eax, %xmm0
mulsd 0x29e82(%rip), %xmm0    # 0x646f8
movsd %xmm0, -0x400(%rbp,%r14)
addq $0x8, %r14
jmp 0x3a84e
addl %r14d, %r12d
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x3a8b0
movq %r15, %rdi
movl %r12d, %esi
pushq $0x4
popq %rdx
callq 0x459f7
movl %eax, -0x200(%rbp,%r14,4)
addl $0x4, %r12d
incq %r14
jmp 0x3a88c
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x3a907
movq %r15, %rdi
movl %r12d, %esi
pushq $0xa
popq %rdx
callq 0x459f7
movsd -0x400(%rbp,%r14,8), %xmm0
ucomisd 0x26020(%rip), %xmm0    # 0x608f8
jne 0x3a8dc
jnp 0x3a8fe
cvtsi2sd %eax, %xmm1
mulsd 0x29e40(%rip), %xmm1    # 0x64728
mulsd 0x29e08(%rip), %xmm1    # 0x646f8
addsd %xmm0, %xmm1
movsd %xmm1, -0x400(%rbp,%r14,8)
incq %r14
addl $0xa, %r12d
jmp 0x3a8b3
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x3a93b
movq %r15, %rdi
movl %r12d, %esi
pushq $0xe
popq %rdx
callq 0x45a39
cmpl $0xffffe000, %eax       # imm = 0xFFFFE000
je 0x3a932
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0xe00(%rbp,%r14,8)
incq %r14
addl $0xe, %r12d
jmp 0x3a90a
xorl %ebx, %ebx
pushq $0x14
popq %r14
cmpq %rbx, %r13
je 0x3a981
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x45a39
cmpl $0xfff80000, %eax       # imm = 0xFFF80000
je 0x3a978
cvtsi2sd %eax, %xmm0
mulsd 0x28371(%rip), %xmm0    # 0x62cd8
mulsd 0x29d89(%rip), %xmm0    # 0x646f8
movsd %xmm0, -0xc00(%rbp,%rbx,8)
incq %rbx
addl $0x14, %r12d
jmp 0x3a941
xorl %ebx, %ebx
pushq $0x18
popq %r14
cmpq %rbx, %r13
je 0x3a9c7
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x45a39
cmpl $0xff800000, %eax       # imm = 0xFF800000
je 0x3a9be
cvtsi2sd %eax, %xmm0
mulsd 0x2830b(%rip), %xmm0    # 0x62cb8
mulsd 0x29d43(%rip), %xmm0    # 0x646f8
movsd %xmm0, -0xa00(%rbp,%rbx,8)
incq %rbx
addl $0x18, %r12d
jmp 0x3a987
xorl %ebx, %ebx
pushq $0xa
popq %r14
cmpq %rbx, %r13
je 0x3a9f0
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, -0x600(%rbp,%rbx,4)
addl $0xa, %r12d
incq %rbx
jmp 0x3a9cd
xorl %ebx, %ebx
pushq $0x1
popq %r14
cmpq %rbx, %r13
je 0x3aa18
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, -0x500(%rbp,%rbx,4)
incl %r12d
incq %rbx
jmp 0x3a9f6
xorl %ebx, %ebx
pushq $0xa
popq %r14
cmpq %rbx, %r13
je 0x3aa52
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
mulsd 0x29cf0(%rip), %xmm0    # 0x64730
movsd %xmm0, -0x1000(%rbp,%rbx,8)
addl $0xa, %r12d
incq %rbx
jmp 0x3aa1e
xorl %ebx, %ebx
pushq $0xf
popq %r14
cmpq %rbx, %r13
je 0x3aa90
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x45a39
cmpl $0xffffc000, %eax       # imm = 0xFFFFC000
je 0x3aa87
cvtsi2sd %eax, %xmm0
mulsd 0x25e92(%rip), %xmm0    # 0x60910
movsd %xmm0, -0x800(%rbp,%rbx,8)
incq %rbx
addl $0xf, %r12d
jmp 0x3aa58
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