// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_head1001(bamboo::rtcm_t*, int*)
static int decode_head1001(rtcm_t *rtcm, int *sync)
{
    double tow;
    char *msg,tstr[64];
    int i=24,staid,nsat,type;
    
    type=getbitu(rtcm->buff,i,12); i+=12;
    
    if (i+52<=rtcm->len*8) {
        staid=getbitu(rtcm->buff,i,12);       i+=12;
        tow  =getbitu(rtcm->buff,i,30)*0.001; i+=30;
        *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;
    
    adjweek(rtcm,tow);
    
    time2str(rtcm->time,tstr,2);
    trace(4,"decode_head1001: 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 $0x34, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x79e0c
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 $0x1e, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x43f94(%rip), %xmm1    # 0xbdd48
mulsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x74(%rbp), %eax
addl $0x1e, %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 0x79e38
movl -0x80(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %ecx
movl $0x2, %edi
leaq 0x47347(%rip), %rsi     # 0xc116c
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x79f21
movq -0x10(%rbp), %rdi
movl -0x78(%rbp), %esi
callq 0x79f30
cmpl $0x0, %eax
jne 0x79e55
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x79f21
movq -0x10(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x7a020
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 0x472d7(%rip), %rsi     # 0xc118b
movb $0x0, %al
callq 0x8b980
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x79f1b
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 0x472a1(%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)