// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1010(bamboo::rtcm_t*)
static int decode_type1010(rtcm_t *rtcm)
{
    double pr1,cnr1,tt,cp1,lam1;
    int i=24+61,j,index,nsat,sync,prn,sat,code,freq,ppr1,lock1,amb,sys=SYS_GLO;
    
    if ((nsat=decode_head1009(rtcm,&sync))<0) return -1;
    
    for (j=0;j<nsat&&rtcm->obs.n<MAXOBS&&i+79<=rtcm->len*8;j++) {
        prn  =getbitu(rtcm->buff,i, 6); i+= 6;
        code =getbitu(rtcm->buff,i, 1); i+= 1;
        freq =getbitu(rtcm->buff,i, 5); i+= 5;
        pr1  =getbitu(rtcm->buff,i,25); i+=25;
        ppr1 =getbits(rtcm->buff,i,20); i+=20;
        lock1=getbitu(rtcm->buff,i, 7); i+= 7;
        amb  =getbitu(rtcm->buff,i, 7); i+= 7;
        cnr1 =getbitu(rtcm->buff,i, 8); i+= 8;
        if (!(sat=satno(sys,prn))) {
            trace(2,"rtcm3 1010 satellite number error: prn=%d\n",prn);
            continue;
        }
        tt=timediff(rtcm->obs.data[0].time,rtcm->time);
        if (rtcm->obsflag||fabs(tt)>1E-9) {
            rtcm->obs.n=rtcm->obsflag=0;
        }
        if ((index=obsindex(&rtcm->obs,rtcm->time,sat))<0) continue;
        pr1=pr1*0.02+amb*PRUNIT_GLO;
        if (ppr1!=(int)0xFFF80000) {
            rtcm->obs.data[index].P[0]=pr1;
            lam1=CLIGHT/(FREQ1_GLO+DFRQ1_GLO*(freq-7));
            cp1=adjcp(rtcm,sat,0,ppr1*0.0005/lam1);
            rtcm->obs.data[index].L[0]=pr1/lam1+cp1;
        }
        rtcm->obs.data[index].LLI[0]=lossoflock(rtcm,sat,0,lock1);
        rtcm->obs.data[index].SNR[0]=snratio(cnr1*0.25);
        rtcm->obs.data[index].code[0]=code?CODE_L1P:CODE_L1C;
    }
    return sync?0:1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x55, -0x3c(%rbp)
movl $0x4, -0x6c(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
callq 0x7a560
movl %eax, -0x48(%rbp)
cmpl $0x0, %eax
jge 0x7043e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7084e
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x48(%rbp), %ecx
movb %al, -0xa1(%rbp)
jge 0x70485
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpl $0x40, 0x30(%rcx)
movb %al, -0xa1(%rbp)
jge 0x70485
movl -0x3c(%rbp), %eax
addl $0x4f, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
setle %al
movb %al, -0xa1(%rbp)
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0x70494
jmp 0x7083b
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x6, %edx
callq 0x8bfc0
movl %eax, -0x50(%rbp)
movl -0x3c(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
movl %eax, -0x58(%rbp)
movl -0x3c(%rbp), %eax
incl %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x5, %edx
callq 0x8bfc0
movl %eax, -0x5c(%rbp)
movl -0x3c(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x19, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x18(%rbp)
movl -0x3c(%rbp), %eax
addl $0x19, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x14, %edx
callq 0x8c050
movl %eax, -0x60(%rbp)
movl -0x3c(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x7, %edx
movl %edx, -0xa8(%rbp)
callq 0x8bfc0
movl -0xa8(%rbp), %edx
movl %eax, -0x64(%rbp)
movl -0x3c(%rbp), %eax
addl $0x7, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
callq 0x8bfc0
movl %eax, -0x68(%rbp)
movl -0x3c(%rbp), %eax
addl $0x7, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x8, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x3c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x3c(%rbp)
movl -0x6c(%rbp), %edi
movl -0x50(%rbp), %esi
callq 0x8b1b0
movl %eax, -0x54(%rbp)
cmpl $0x0, %eax
jne 0x705fa
movl -0x50(%rbp), %edx
movl $0x2, %edi
leaq 0x50d71(%rip), %rsi     # 0xc135f
movb $0x0, %al
callq 0x8b980
jmp 0x7082d
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rcx
movq %rcx, -0x80(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movsd -0x78(%rbp), %xmm0
movq -0x90(%rbp), %rsi
movsd -0x88(%rbp), %xmm1
callq 0x8e8e0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x9bdd0(%rax)
jne 0x70678
movsd -0x28(%rbp), %xmm0
movaps 0x4cbba(%rip), %xmm1    # 0xbd220
pand %xmm1, %xmm0
movsd 0x4d72e(%rip), %xmm1    # 0xbdda0
ucomisd %xmm1, %xmm0
jbe 0x70691
movq -0x10(%rbp), %rax
movl $0x0, 0x9bdd0(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x30(%rax)
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0xa0(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x98(%rbp)
movl -0x54(%rbp), %edx
movq -0xa0(%rbp), %rsi
movsd -0x98(%rbp), %xmm0
callq 0x7a130
movl %eax, -0x44(%rbp)
cmpl $0x0, %eax
jge 0x706d7
jmp 0x7082d
movsd -0x18(%rbp), %xmm0
cvtsi2sdl -0x68(%rbp), %xmm1
movsd 0x5030f(%rip), %xmm2    # 0xc09f8
mulsd %xmm2, %xmm1
movsd 0x4d693(%rip), %xmm2    # 0xbdd88
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
cmpl $0xfff80000, -0x60(%rbp) # imm = 0xFFF80000
je 0x707af
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x38(%rax)
movl -0x5c(%rbp), %eax
subl $0x7, %eax
cvtsi2sd %eax, %xmm1
movsd 0x4c79a(%rip), %xmm0    # 0xbced8
mulsd %xmm0, %xmm1
movsd 0x4c796(%rip), %xmm0    # 0xbcee0
addsd %xmm0, %xmm1
movsd 0x4d652(%rip), %xmm0    # 0xbdda8
divsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %esi
cvtsi2sdl -0x60(%rbp), %xmm0
movsd 0x50275(%rip), %xmm1    # 0xc09e8
mulsd %xmm1, %xmm0
divsd -0x38(%rbp), %xmm0
xorl %edx, %edx
callq 0x7a2d0
movsd %xmm0, -0x30(%rbp)
movsd -0x18(%rbp), %xmm0
divsd -0x38(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %esi
movl -0x64(%rbp), %ecx
xorl %edx, %edx
callq 0x7a3f0
movb %al, %cl
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x44(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x15(%rax)
movsd 0x4c768(%rip), %xmm0    # 0xbcf48
mulsd -0x20(%rbp), %xmm0
callq 0x7a4a0
movb %al, %cl
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x44(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x12(%rax)
movl -0x58(%rbp), %edx
movl $0x1, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x44(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x18(%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x70445
movl -0x4c(%rbp), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)