// File: 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
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x24, -0x84(%rbp)
movl -0x84(%rbp), %eax
addl $0x9c, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x6fd30
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x8c(%rbp)
movl -0x84(%rbp), %eax
addl $0xc, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x6, %edx
callq 0x8bfc0
movl %eax, -0x90(%rbp)
movl -0x84(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
callq 0x7a500
movsd %xmm0, -0x30(%rbp)
movl -0x84(%rbp), %eax
addl $0x28, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
callq 0x7a500
movsd %xmm0, -0x28(%rbp)
movl -0x84(%rbp), %eax
addl $0x28, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
callq 0x7a500
movsd %xmm0, -0x20(%rbp)
movl -0x84(%rbp), %eax
addl $0x26, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x84(%rbp), %esi
movl $0x10, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x6fd59
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %edx
movl $0x2, %edi
leaq 0x51559(%rip), %rsi     # 0xc129f
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6feea
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x6fe28
movq -0x10(%rbp), %rax
addq $0x9b9d0, %rax          # imm = 0x9B9D0
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
callq 0x92e0
movq %rax, %rcx
movq -0x98(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movl $0x0, -0x88(%rbp)
cmpl $0x3, -0x88(%rbp)
jge 0x6fddf
movslq -0x88(%rbp), %rax
movsd 0x4d0ad(%rip), %xmm0    # 0xbce68
mulsd -0x30(%rbp,%rax,8), %xmm0
movslq -0x88(%rbp), %rax
movsd %xmm0, -0x50(%rbp,%rax,8)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x6fda3
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x8fb80
movq -0x80(%rbp), %rdi
movl -0x8c(%rbp), %edx
movsd 0x50bf2(%rip), %xmm0    # 0xc09f0
mulsd -0x70(%rbp), %xmm0
movsd 0x50be5(%rip), %xmm1    # 0xc09f0
mulsd -0x68(%rbp), %xmm1
movsd -0x60(%rbp), %xmm2
movsd -0x78(%rbp), %xmm3
leaq 0x5149f(%rip), %rsi     # 0xc12c0
movb $0x4, %al
callq 0x9150
movq -0x10(%rbp), %rdi
movl -0x8c(%rbp), %esi
callq 0x79f30
cmpl $0x0, %eax
jne 0x6fe48
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6feea
movq -0x10(%rbp), %rax
movl $0x1, 0x6f100(%rax)
movl $0x0, -0x88(%rbp)
cmpl $0x3, -0x88(%rbp)
jge 0x6feba
movslq -0x88(%rbp), %rax
movsd 0x4cff0(%rip), %xmm0    # 0xbce68
mulsd -0x30(%rbp,%rax,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x88(%rbp), %rcx
movsd %xmm0, 0x6f108(%rax,%rcx,8)
movq -0x10(%rbp), %rax
movslq -0x88(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, 0x6f120(%rax,%rcx,8)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x6fe60
movsd 0x4cfa6(%rip), %xmm0    # 0xbce68
mulsd -0x78(%rbp), %xmm0
movq -0x10(%rbp), %rax
movsd %xmm0, 0x6f138(%rax)
movl -0x90(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x6f0fc(%rax)
movl $0x5, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)