// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1012(bamboo::rtcm_t*)
static int decode_type1012(rtcm_t *rtcm)
{
    double pr1,cnr1,cnr2,tt,cp1,cp2,lam1,lam2;
    int i=24+61,j,index,nsat,sync,prn,sat,freq,code1,code2,pr21,ppr1,ppr2;
    int lock1,lock2,amb,sys=SYS_GLO;
    
    if ((nsat=decode_head1009(rtcm,&sync))<0) return -1;
    
    for (j=0;j<nsat&&rtcm->obs.n<MAXOBS&&i+130<=rtcm->len*8;j++) {
        prn  =getbitu(rtcm->buff,i, 6); i+= 6;
        code1=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;
        code2=getbitu(rtcm->buff,i, 2); i+= 2;
        pr21 =getbits(rtcm->buff,i,14); i+=14;
        ppr2 =getbits(rtcm->buff,i,20); i+=20;
        lock2=getbitu(rtcm->buff,i, 7); i+= 7;
        cnr2 =getbitu(rtcm->buff,i, 8); i+= 8;
        if (!(sat=satno(sys,prn))) {
            trace(2,"rtcm3 1012 satellite number error: sys=%d prn=%d\n",sys,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) {
            lam1=CLIGHT/(FREQ1_GLO+DFRQ1_GLO*(freq-7));
            rtcm->obs.data[index].P[0]=pr1;
            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]=code1?CODE_L1P:CODE_L1C;
        
        if (pr21!=(int)0xFFFFE000) {
            rtcm->obs.data[index].P[1]=pr1+pr21*0.02;
        }
        if (ppr2!=(int)0xFFF80000) {
            lam2=CLIGHT/(FREQ2_GLO+DFRQ2_GLO*(freq-7));
            cp2=adjcp(rtcm,sat,1,ppr2*0.0005/lam2);
            rtcm->obs.data[index].L[1]=pr1/lam2+cp2;
        }
        rtcm->obs.data[index].LLI[1]=lossoflock(rtcm,sat,1,lock2);
        rtcm->obs.data[index].SNR[1]=snratio(cnr2*0.25);
        rtcm->obs.data[index].code[1]=code2?CODE_L2P:CODE_L2C;
    }
    rtcm->obsflag=!sync;
    return sync?0:1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq -0x6c(%rbp), %rsi
callq 0x43167
testl %eax, %eax
js 0x3ceee
je 0x3cedd
leaq 0x30(%rbx), %rcx
movq %rcx, -0x80(%rbp)
leaq 0x9f0c4(%rbx), %r12
leaq 0x9bdd8(%rbx), %rcx
movq %rcx, -0x30(%rbp)
leaq 0x9cc60(%rbx), %rcx
movq %rcx, -0x38(%rbp)
movl $0xd7, %r14d
movq -0x80(%rbp), %rcx
cmpl $0x3f, (%rcx)
jg 0x3cedd
movl 0x9f0c0(%rbx), %ecx
shll $0x3, %ecx
cmpl %ecx, %r14d
jg 0x3cedd
movl %eax, -0x68(%rbp)
leal -0x82(%r14), %esi
movq %r12, %rdi
movl $0x6, %edx
callq 0x4e341
movl %eax, %r15d
leal -0x7c(%r14), %esi
movq %r12, %rdi
movl $0x1, %edx
callq 0x4e341
movl %eax, -0x58(%rbp)
leal -0x7b(%r14), %esi
movq %r12, %rdi
movl $0x5, %edx
callq 0x4e341
movq %rax, -0x78(%rbp)
leal -0x76(%r14), %esi
movq %r12, %rdi
movl $0x19, %edx
callq 0x4e341
movl %eax, -0x40(%rbp)
leal -0x5d(%r14), %esi
movq %r12, %rdi
movl $0x14, %edx
callq 0x4e390
movl %eax, -0x44(%rbp)
leal -0x49(%r14), %esi
movq %r12, %rdi
movl $0x7, %edx
callq 0x4e341
movl %eax, -0x50(%rbp)
leal -0x42(%r14), %esi
movq %r12, %rdi
movl $0x7, %edx
callq 0x4e341
movl %eax, -0x3c(%rbp)
leal -0x3b(%r14), %esi
movq %r12, %rdi
movl $0x8, %edx
callq 0x4e341
movl %eax, -0x48(%rbp)
leal -0x33(%r14), %esi
movq %r12, %rdi
movl $0x2, %edx
callq 0x4e341
movl %eax, -0x64(%rbp)
leal -0x31(%r14), %esi
movq %r12, %rdi
movl $0xe, %edx
callq 0x4e390
movl %eax, -0x4c(%rbp)
leal -0x23(%r14), %esi
movq %r12, %rdi
movl $0x14, %edx
callq 0x4e390
movl %eax, -0x54(%rbp)
leal -0xf(%r14), %esi
movq %r12, %rdi
movl $0x7, %edx
callq 0x4e341
movl %eax, -0x60(%rbp)
leal -0x8(%r14), %esi
movq %r12, %rdi
movl $0x8, %edx
callq 0x4e341
movl %eax, -0x5c(%rbp)
movl $0x4, %edi
movl %r15d, %esi
callq 0x4dbc5
testl %eax, %eax
je 0x3cc17
movl %eax, %r13d
movq 0x38(%rbx), %rax
movq (%rax), %rdi
movsd 0x8(%rax), %xmm0
movq 0x10(%rbx), %rsi
movsd 0x18(%rbx), %xmm1
callq 0x4fe97
cmpl $0x0, 0x9bdd0(%rbx)
jne 0x3cb2f
andpd 0x2ce0b(%rip), %xmm0    # 0x69930
ucomisd 0x301db(%rip), %xmm0    # 0x6cd08
jbe 0x3cb3a
xorl %eax, %eax
movl %eax, 0x9bdd0(%rbx)
movl %eax, 0x30(%rbx)
movq 0x10(%rbx), %rsi
movsd 0x18(%rbx), %xmm0
movq -0x80(%rbp), %rdi
movl %r13d, %edx
callq 0x430c2
testl %eax, %eax
js 0x3cec2
movl -0x40(%rbp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x3c(%rbp), %xmm1
mulsd 0x322ce(%rip), %xmm1    # 0x6ee40
mulsd 0x2f2a6(%rip), %xmm0    # 0x6be20
addsd %xmm1, %xmm0
movl %eax, %eax
movl -0x44(%rbp), %esi
cmpl $0xfff80000, %esi       # imm = 0xFFF80000
je 0x3cc6b
movq -0x78(%rbp), %rcx
addl $-0x7, %ecx
cvtsi2sd %ecx, %xmm2
mulsd 0x2dde6(%rip), %xmm2    # 0x6a988
addsd 0x2dde6(%rip), %xmm2    # 0x6a990
movsd 0x2f1ee(%rip), %xmm1    # 0x6bda0
divsd %xmm2, %xmm1
movq 0x38(%rbx), %rcx
leaq (%rax,%rax,2), %rdx
shlq $0x5, %rdx
movsd %xmm0, 0x38(%rcx,%rdx)
xorps %xmm2, %xmm2
cvtsi2sd %esi, %xmm2
mulsd 0x32231(%rip), %xmm2    # 0x6ee08
divsd %xmm1, %xmm2
leal -0x1(%r13), %esi
movslq %esi, %rsi
leaq (%rsi,%rsi,2), %rsi
movq -0x30(%rbp), %rdi
movsd (%rdi,%rsi,8), %xmm3
ucomisd 0x2dd11(%rip), %xmm3    # 0x6a908
jne 0x3cbfb
jnp 0x3cc4d
movapd %xmm3, %xmm4
addsd 0x32209(%rip), %xmm4    # 0x6ee10
ucomisd %xmm2, %xmm4
jbe 0x3cc37
addsd 0x32213(%rip), %xmm2    # 0x6ee28
jmp 0x3cc4d
movl $0x2, %edi
leaq 0x32542(%rip), %rsi     # 0x6f165
movl $0x4, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x4ded0
jmp 0x3cec2
addsd 0x321d9(%rip), %xmm3    # 0x6ee18
ucomisd %xmm3, %xmm2
jbe 0x3cc4d
addsd 0x321d3(%rip), %xmm2    # 0x6ee20
movq -0x30(%rbp), %rdi
leaq (%rdi,%rsi,8), %rsi
movsd %xmm2, (%rsi)
movapd %xmm0, %xmm3
divsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, 0x20(%rcx,%rdx)
movl -0x50(%rbp), %edi
testl %edi, %edi
jne 0x3cc8c
leal -0x1(%r13), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq -0x38(%rbp), %rdx
cmpw $0x0, (%rdx,%rcx,2)
je 0x3cde7
leal -0x1(%r13), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq -0x38(%rbp), %r9
movzwl (%r9,%rcx,2), %ecx
cmpl %ecx, %edi
setl %sil
movl -0x48(%rbp), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %rcx, %xmm1
decl %r13d
movslq %r13d, %rcx
leaq (%rcx,%rcx,2), %rdx
movw %di, (%r9,%rdx,2)
movq 0x38(%rbx), %rdi
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rcx,2), %rcx
mulsd 0x2dd39(%rip), %xmm1    # 0x6aa10
ucomisd 0x32151(%rip), %xmm1    # 0x6ee30
movapd %xmm1, %xmm2
mulsd 0x2dbbd(%rip), %xmm2    # 0x6a8a8
addsd 0x2ef85(%rip), %xmm2    # 0x6bc78
cvttsd2si %xmm2, %r8d
movl $0x0, %r10d
cmovael %r10d, %r8d
xorpd %xmm2, %xmm2
ucomisd %xmm1, %xmm2
movb %sil, 0x15(%rdi,%rcx)
cmovael %r10d, %r8d
movq 0x38(%rbx), %rsi
cmpl $0x1, -0x58(%rbp)
movb $0x2, %dil
sbbb $0x0, %dil
movb %r8b, 0x12(%rsi,%rcx)
movq 0x38(%rbx), %rsi
movb %dil, 0x18(%rsi,%rcx)
movl -0x4c(%rbp), %esi
cmpl $0xffffe000, %esi       # imm = 0xFFFFE000
movq %r9, %r8
je 0x3cd63
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
mulsd 0x2f0d3(%rip), %xmm1    # 0x6be20
addsd %xmm0, %xmm1
movq 0x38(%rbx), %rsi
leaq (%rax,%rax,2), %rdi
shlq $0x5, %rdi
movsd %xmm1, 0x40(%rsi,%rdi)
movl -0x54(%rbp), %r9d
cmpl $0xfff80000, %r9d       # imm = 0xFFF80000
movl -0x60(%rbp), %edi
je 0x3ce33
movq -0x78(%rbp), %rsi
addl $-0x7, %esi
xorps %xmm2, %xmm2
cvtsi2sd %esi, %xmm2
mulsd 0x2dc0b(%rip), %xmm2    # 0x6a998
addsd 0x2dc0b(%rip), %xmm2    # 0x6a9a0
movsd 0x2f003(%rip), %xmm1    # 0x6bda0
divsd %xmm2, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r9d, %xmm2
mulsd 0x32057(%rip), %xmm2    # 0x6ee08
divsd %xmm1, %xmm2
movq -0x30(%rbp), %rsi
movsd 0x8(%rsi,%rdx,8), %xmm3
ucomisd 0x2db41(%rip), %xmm3    # 0x6a908
jne 0x3cdcb
jnp 0x3ce09
movapd %xmm3, %xmm4
addsd 0x32039(%rip), %xmm4    # 0x6ee10
ucomisd %xmm2, %xmm4
jbe 0x3cdf3
addsd 0x32043(%rip), %xmm2    # 0x6ee28
jmp 0x3ce09
movb $0x1, %sil
movq -0x38(%rbp), %r9
jmp 0x3cca6
addsd 0x3201d(%rip), %xmm3    # 0x6ee18
ucomisd %xmm3, %xmm2
jbe 0x3ce09
addsd 0x32017(%rip), %xmm2    # 0x6ee20
movq -0x30(%rbp), %rsi
leaq (%rsi,%rdx,8), %rsi
addq $0x8, %rsi
movsd %xmm2, (%rsi)
divsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movq 0x38(%rbx), %rsi
leaq (%rax,%rax,2), %rax
shlq $0x5, %rax
movsd %xmm0, 0x28(%rsi,%rax)
testl %edi, %edi
jne 0x3ce44
cmpw $0x0, 0x2(%r8,%rdx,2)
je 0x3ced6
movzwl 0x2(%r8,%rdx,2), %eax
cmpl %eax, %edi
setl %al
movl -0x5c(%rbp), %esi
xorps %xmm0, %xmm0
cvtsi2sd %rsi, %xmm0
movw %di, 0x2(%r8,%rdx,2)
movq 0x38(%rbx), %rdx
mulsd 0x2dba4(%rip), %xmm0    # 0x6aa10
ucomisd 0x31fbc(%rip), %xmm0    # 0x6ee30
movb %al, 0x16(%rdx,%rcx)
movapd %xmm0, %xmm1
mulsd 0x2da24(%rip), %xmm1    # 0x6a8a8
addsd 0x2edec(%rip), %xmm1    # 0x6bc78
cvttsd2si %xmm1, %eax
movl $0x0, %edx
cmovael %edx, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmovael %edx, %eax
movq 0x38(%rbx), %rdx
movb %al, 0x13(%rdx,%rcx)
xorl %eax, %eax
cmpl $0x0, -0x64(%rbp)
setne %al
leal (%rax,%rax,4), %eax
addl $0xe, %eax
movq 0x38(%rbx), %rdx
movb %al, 0x19(%rdx,%rcx)
addl $0x82, %r14d
movl -0x68(%rbp), %eax
decl %eax
jne 0x3c9b8
jmp 0x3cedd
movb $0x1, %al
jmp 0x3ce4f
xorl %eax, %eax
cmpl $0x0, -0x6c(%rbp)
sete %al
movl %eax, 0x9bdd0(%rbx)
jmp 0x3cef3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq