// File: /workspace/github_cpp_makefile_star2_O3/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 -0x64(%rbp), %rsi
callq 0x428c3
testl %eax, %eax
js 0x3c831
je 0x3c820
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, -0x70(%rbp)
movl $0xd7, %r14d
movq -0x80(%rbp), %rcx
cmpl $0x3f, (%rcx)
jg 0x3c820
movl 0x9f0c0(%rbx), %ecx
shll $0x3, %ecx
cmpl %ecx, %r14d
jg 0x3c820
movl %eax, -0x60(%rbp)
leal -0x82(%r14), %esi
movq %r12, %rdi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %r13d
leal -0x7c(%r14), %esi
movq %r12, %rdi
movl $0x1, %edx
callq 0x4d9d6
movl %eax, -0x54(%rbp)
leal -0x7b(%r14), %esi
movq %r12, %rdi
movl $0x5, %edx
callq 0x4d9d6
movq %rax, -0x78(%rbp)
leal -0x76(%r14), %esi
movq %r12, %rdi
movl $0x19, %edx
callq 0x4d9d6
movl %eax, -0x38(%rbp)
leal -0x5d(%r14), %esi
movq %r12, %rdi
movl $0x14, %edx
callq 0x4da25
movl %eax, -0x3c(%rbp)
leal -0x49(%r14), %esi
movq %r12, %rdi
movl $0x7, %edx
callq 0x4d9d6
movl %eax, -0x48(%rbp)
leal -0x42(%r14), %esi
movq %r12, %rdi
movl $0x7, %edx
callq 0x4d9d6
movl %eax, -0x34(%rbp)
leal -0x3b(%r14), %esi
movq %r12, %rdi
movl $0x8, %edx
callq 0x4d9d6
movl %eax, -0x40(%rbp)
leal -0x33(%r14), %esi
movq %r12, %rdi
movl $0x2, %edx
callq 0x4d9d6
movl %eax, -0x5c(%rbp)
leal -0x31(%r14), %esi
movq %r12, %rdi
movl $0xe, %edx
callq 0x4da25
movl %eax, -0x44(%rbp)
leal -0x23(%r14), %esi
movq %r12, %rdi
movl $0x14, %edx
callq 0x4da25
movl %eax, -0x4c(%rbp)
leal -0xf(%r14), %esi
movq %r12, %rdi
movl $0x7, %edx
callq 0x4d9d6
movl %eax, -0x58(%rbp)
leal -0x8(%r14), %esi
movq %r12, %rdi
movl $0x8, %edx
callq 0x4d9d6
movl %eax, -0x50(%rbp)
movl $0x4, %edi
movl %r13d, %esi
callq 0x4d28d
testl %eax, %eax
je 0x3c4f9
movl %eax, %r15d
movq 0x38(%rbx), %rax
movq (%rax), %rdi
movsd 0x8(%rax), %xmm0
movq 0x10(%rbx), %rsi
movsd 0x18(%rbx), %xmm1
callq 0x4f51b
cmpl $0x0, 0x9bdd0(%rbx)
jne 0x3c492
andpd 0x2d4a8(%rip), %xmm0    # 0x69930
ucomisd 0x30878(%rip), %xmm0    # 0x6cd08
jbe 0x3c49d
xorl %eax, %eax
movl %eax, 0x9bdd0(%rbx)
movl %eax, 0x30(%rbx)
movq 0x10(%rbx), %rsi
movsd 0x18(%rbx), %xmm0
movq -0x80(%rbp), %rdi
movl %r15d, %edx
callq 0x42820
testl %eax, %eax
js 0x3c80e
movl -0x38(%rbp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x34(%rbp), %xmm1
mulsd 0x3296b(%rip), %xmm1    # 0x6ee40
mulsd 0x2f943(%rip), %xmm0    # 0x6be20
addsd %xmm1, %xmm0
movl %eax, %eax
movl -0x3c(%rbp), %edx
cmpl $0xfff80000, %edx       # imm = 0xFFF80000
jne 0x3c519
decl %r15d
movslq %r15d, %rdx
jmp 0x3c5d5
movl $0x2, %edi
leaq 0x32c60(%rip), %rsi     # 0x6f165
movl $0x4, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x4d55d
jmp 0x3c80e
movq -0x78(%rbp), %rcx
addl $-0x7, %ecx
cvtsi2sd %ecx, %xmm2
mulsd 0x2e45c(%rip), %xmm2    # 0x6a988
addsd 0x2e45c(%rip), %xmm2    # 0x6a990
movsd 0x2f864(%rip), %xmm1    # 0x6bda0
divsd %xmm2, %xmm1
movq 0x38(%rbx), %rcx
leaq (%rax,%rax,2), %rsi
shlq $0x5, %rsi
movsd %xmm0, 0x38(%rcx,%rsi)
xorps %xmm2, %xmm2
cvtsi2sd %edx, %xmm2
mulsd 0x328a7(%rip), %xmm2    # 0x6ee08
divsd %xmm1, %xmm2
decl %r15d
movslq %r15d, %rdx
leaq (%rdx,%rdx,2), %rdi
movq -0x30(%rbp), %r8
movsd (%r8,%rdi,8), %xmm3
ucomisd 0x2e387(%rip), %xmm3    # 0x6a908
jne 0x3c585
jnp 0x3c5b7
movapd %xmm3, %xmm4
addsd 0x3287f(%rip), %xmm4    # 0x6ee10
ucomisd %xmm2, %xmm4
jbe 0x3c5a1
addsd 0x32889(%rip), %xmm2    # 0x6ee28
jmp 0x3c5b7
addsd 0x3286f(%rip), %xmm3    # 0x6ee18
ucomisd %xmm3, %xmm2
jbe 0x3c5b7
addsd 0x32869(%rip), %xmm2    # 0x6ee20
movq -0x30(%rbp), %r8
leaq (%r8,%rdi,8), %rdi
movsd %xmm2, (%rdi)
movapd %xmm0, %xmm3
divsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, 0x20(%rcx,%rsi)
movl -0x40(%rbp), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %rcx, %xmm1
movl -0x48(%rbp), %r9d
testl %r9d, %r9d
sete %cl
leaq (%rdx,%rdx,2), %rdx
movq -0x70(%rbp), %r8
movzwl (%r8,%rdx,2), %esi
testw %si, %si
sete %dil
andb %cl, %dil
movzwl %si, %ecx
cmpl %ecx, %r9d
setl %sil
orb %dil, %sil
movw %r9w, (%r8,%rdx,2)
movq 0x38(%rbx), %rdi
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rcx,2), %rcx
mulsd 0x2e3e6(%rip), %xmm1    # 0x6aa10
ucomisd 0x327fe(%rip), %xmm1    # 0x6ee30
movapd %xmm1, %xmm2
mulsd 0x2e26a(%rip), %xmm2    # 0x6a8a8
addsd 0x2f632(%rip), %xmm2    # 0x6bc78
cvttsd2si %xmm2, %r8d
movl $0x0, %r9d
cmovael %r9d, %r8d
xorpd %xmm2, %xmm2
ucomisd %xmm1, %xmm2
movb %sil, 0x15(%rdi,%rcx)
cmovael %r9d, %r8d
movq 0x38(%rbx), %rsi
cmpl $0x1, -0x54(%rbp)
movb $0x2, %dil
sbbb $0x0, %dil
movb %r8b, 0x12(%rsi,%rcx)
movq 0x38(%rbx), %rsi
movb %dil, 0x18(%rsi,%rcx)
movl -0x44(%rbp), %esi
cmpl $0xffffe000, %esi       # imm = 0xFFFFE000
je 0x3c6b3
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
mulsd 0x2f783(%rip), %xmm1    # 0x6be20
addsd %xmm0, %xmm1
movq 0x38(%rbx), %rsi
leaq (%rax,%rax,2), %rdi
shlq $0x5, %rdi
movsd %xmm1, 0x40(%rsi,%rdi)
movl -0x4c(%rbp), %edi
cmpl $0xfff80000, %edi       # imm = 0xFFF80000
je 0x3c771
movq -0x78(%rbp), %rsi
addl $-0x7, %esi
xorps %xmm2, %xmm2
cvtsi2sd %esi, %xmm2
mulsd 0x2e2c0(%rip), %xmm2    # 0x6a998
addsd 0x2e2c0(%rip), %xmm2    # 0x6a9a0
movsd 0x2f6b8(%rip), %xmm1    # 0x6bda0
divsd %xmm2, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %edi, %xmm2
mulsd 0x3270d(%rip), %xmm2    # 0x6ee08
divsd %xmm1, %xmm2
movq -0x30(%rbp), %rsi
movsd 0x8(%rsi,%rdx,8), %xmm3
ucomisd 0x2e1f7(%rip), %xmm3    # 0x6a908
jne 0x3c715
jnp 0x3c747
movapd %xmm3, %xmm4
addsd 0x326ef(%rip), %xmm4    # 0x6ee10
ucomisd %xmm2, %xmm4
jbe 0x3c731
addsd 0x326f9(%rip), %xmm2    # 0x6ee28
jmp 0x3c747
addsd 0x326df(%rip), %xmm3    # 0x6ee18
ucomisd %xmm3, %xmm2
jbe 0x3c747
addsd 0x326d9(%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)
movl -0x50(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movl -0x58(%rbp), %r9d
testl %r9d, %r9d
sete %al
movq -0x70(%rbp), %r8
movzwl 0x2(%r8,%rdx,2), %esi
testw %si, %si
sete %dil
andb %al, %dil
movzwl %si, %eax
cmpl %eax, %r9d
setl %al
orb %dil, %al
movw %r9w, 0x2(%r8,%rdx,2)
movq 0x38(%rbx), %rdx
mulsd 0x2e258(%rip), %xmm0    # 0x6aa10
ucomisd 0x32670(%rip), %xmm0    # 0x6ee30
movb %al, 0x16(%rdx,%rcx)
movapd %xmm0, %xmm1
mulsd 0x2e0d8(%rip), %xmm1    # 0x6a8a8
addsd 0x2f4a0(%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, -0x5c(%rbp)
setne %al
leal (%rax,%rax,4), %eax
addl $0xe, %eax
movq 0x38(%rbx), %rdx
movb %al, 0x19(%rdx,%rcx)
addl $0x82, %r14d
movl -0x60(%rbp), %eax
decl %eax
jne 0x3c31b
xorl %eax, %eax
cmpl $0x0, -0x64(%rbp)
sete %al
movl %eax, 0x9bdd0(%rbx)
jmp 0x3c836
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq