// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1006(bamboo::rtcm_t*)
static int decode_type1006(rtcm_t *rtcm)
{
    double rr[3],re[3],pos[3],anth;
    char *msg;
    int i=24+12,j,staid,itrf;
    
    if (i+156<=rtcm->len*8) {
        staid=getbitu(rtcm->buff,i,12); i+=12;
        itrf =getbitu(rtcm->buff,i, 6); i+= 6+4;
        rr[0]=getbits_38(rtcm->buff,i); i+=38+2;
        rr[1]=getbits_38(rtcm->buff,i); i+=38+2;
        rr[2]=getbits_38(rtcm->buff,i); i+=38;
        anth =getbitu(rtcm->buff,i,16);
    }
    else {
        trace(2,"rtcm3 1006 length error: len=%d\n",rtcm->len);
        return -1;
    }
    if (rtcm->outtype) {
        msg=rtcm->msgtype+strlen(rtcm->msgtype);
        for (j=0;j<3;j++) re[j]=rr[j]*0.0001;
        ecef2pos(re,pos);
        sprintf(msg," staid=%4d pos=%.8f %.8f %.3f anth=%.3f",staid,pos[0]*R2D,
                pos[1]*R2D,pos[2],anth);
    }
    /* test station id */
    if (!test_staid(rtcm,staid)) return -1;
    
    rtcm->sta.deltype=1; /* xyz */
    for (j=0;j<3;j++) {
        rtcm->sta.pos[j]=rr[j]*0.0001;
        rtcm->sta.del[j]=0.0;
    }
    rtcm->sta.hgt=anth*0.0001;
    rtcm->sta.itrf=itrf;
    return 5;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl 0x9f0c0(%rdi), %edx
cmpl $0x18, %edx
jl 0x3bbd2
movq %rdi, %rbx
leaq 0x9f0c4(%rdi), %r12
movq %r12, %rdi
movl $0x24, %esi
movl $0xc, %edx
callq 0x4d9d6
movl %eax, %r15d
movq %r12, %rdi
movl $0x30, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %r14d
movq %r12, %rdi
movl $0x3a, %esi
movl $0x20, %edx
callq 0x4da25
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r12, %rdi
movl $0x5a, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd -0x30(%rbp), %xmm1
mulsd 0x2f07b(%rip), %xmm1    # 0x6aa90
addsd %xmm0, %xmm1
movsd %xmm1, -0x50(%rbp)
movq %r12, %rdi
movl $0x62, %esi
movl $0x20, %edx
callq 0x4da25
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r12, %rdi
movl $0x82, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd -0x30(%rbp), %xmm1
mulsd 0x2f02b(%rip), %xmm1    # 0x6aa90
addsd %xmm0, %xmm1
movsd %xmm1, -0x48(%rbp)
movq %r12, %rdi
movl $0x8a, %esi
movl $0x20, %edx
callq 0x4da25
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r12, %rdi
movl $0xaa, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd -0x30(%rbp), %xmm1
mulsd 0x2efdb(%rip), %xmm1    # 0x6aa90
addsd %xmm0, %xmm1
movsd %xmm1, -0x40(%rbp)
movq %r12, %rdi
movl $0xb0, %esi
movl $0x10, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x30(%rbp)
cmpl $0x0, 0xc(%rbx)
je 0x3bb64
leaq 0x9b9d0(%rbx), %r12
movq %r12, %rdi
callq 0x8290
xorl %ecx, %ecx
movsd 0x2ee22(%rip), %xmm0    # 0x6a920
movsd -0x50(%rbp,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, -0x70(%rbp,%rcx,8)
incq %rcx
cmpq $0x3, %rcx
jne 0x3bafe
addq %rax, %r12
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %r13
movq %r13, %rsi
callq 0x500e2
movsd 0x33303(%rip), %xmm1    # 0x6ee38
movsd (%r13), %xmm0
mulsd %xmm1, %xmm0
mulsd 0x8(%r13), %xmm1
movsd 0x10(%r13), %xmm2
leaq 0x33549(%rip), %rsi     # 0x6f09b
movq %r12, %rdi
movl %r15d, %edx
movsd -0x30(%rbp), %xmm3
movb $0x4, %al
callq 0x8120
movq %rbx, %rdi
movl %r15d, %esi
callq 0x426d9
testl %eax, %eax
je 0x3bbe5
movl $0x1, 0x6f100(%rbx)
xorl %eax, %eax
movsd 0x2ed99(%rip), %xmm0    # 0x6a920
movsd -0x50(%rbp,%rax,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x6f108(%rbx,%rax,8)
movq $0x0, 0x6f120(%rbx,%rax,8)
incq %rax
cmpq $0x3, %rax
jne 0x3bb87
movsd -0x30(%rbp), %xmm0
mulsd 0x2ed64(%rip), %xmm0    # 0x6a920
movsd %xmm0, 0x6f138(%rbx)
movl %r14d, 0x6f0fc(%rbx)
movl $0x5, %eax
jmp 0x3bbea
leaq 0x334a1(%rip), %rsi     # 0x6f07a
movl $0x2, %edi
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq