// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_head1009(bamboo::rtcm_t*, int*)
static int decode_head1009(rtcm_t *rtcm, int *sync)
{
    double tod;
    char *msg,tstr[64];
    int i=24,staid,nsat,type;
    
    type=getbitu(rtcm->buff,i,12); i+=12;
    
    if (i+49<=rtcm->len*8) {
        staid=getbitu(rtcm->buff,i,12);       i+=12;
        tod  =getbitu(rtcm->buff,i,27)*0.001; i+=27; /* sec in a day */
        *sync=getbitu(rtcm->buff,i, 1);       i+= 1;
        nsat =getbitu(rtcm->buff,i, 5);
    }
    else {
        trace(2,"rtcm3 %d length error: len=%d\n",type,rtcm->len);
        return -1;
    }
    /* test station id */
    if (!test_staid(rtcm,staid)) return -1;
    
    adjday_glot(rtcm,tod);
    
    time2str(rtcm->time,tstr,2);
    trace(4,"decode_head1009: time=%s nsat=%d sync=%d\n",tstr,nsat,*sync);
    
    if (rtcm->outtype) {
        msg=rtcm->msgtype+strlen(rtcm->msgtype);
        sprintf(msg," staid=%4d %s nsat=%2d sync=%d",staid,tstr,nsat,*sync);
    }
    return nsat;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x18, -0x74(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x74(%rbp), %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x80(%rbp)
movl -0x74(%rbp), %eax
addl $0xc, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
addl $0x31, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x7a65c
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x74(%rbp), %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x78(%rbp)
movl -0x74(%rbp), %eax
addl $0xc, %eax
movl %eax, -0x74(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x74(%rbp), %esi
movl $0x1b, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x43744(%rip), %xmm1    # 0xbdd48
mulsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x74(%rbp), %eax
addl $0x1b, %eax
movl %eax, -0x74(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x74(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x74(%rbp), %esi
movl $0x5, %edx
callq 0x8bfc0
movl %eax, -0x7c(%rbp)
jmp 0x7a688
movl -0x80(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %ecx
movl $0x2, %edi
leaq 0x46af7(%rip), %rsi     # 0xc116c
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7a771
movq -0x10(%rbp), %rdi
movl -0x78(%rbp), %esi
callq 0x79f30
cmpl $0x0, %eax
jne 0x7a6a5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7a771
movq -0x10(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x7a780
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x88(%rbp)
leaq -0x70(%rbp), %rsi
movq -0x90(%rbp), %rdi
movsd -0x88(%rbp), %xmm0
movl $0x2, %edx
callq 0x8f550
leaq -0x70(%rbp), %rdx
movl -0x7c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl (%rax), %r8d
movl $0x4, %edi
leaq 0x46c31(%rip), %rsi     # 0xc1335
movb $0x0, %al
callq 0x8b980
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x7a76b
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, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movl -0x78(%rbp), %edx
leaq -0x70(%rbp), %rcx
movl -0x7c(%rbp), %r8d
movq -0x18(%rbp), %rax
movl (%rax), %r9d
leaq 0x46a51(%rip), %rsi     # 0xc11b5
movb $0x0, %al
callq 0x9150
movl -0x7c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)