// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr1_head(bamboo::rtcm_t*, int, int*, int*, double*, int*, int*)
static int decode_ssr1_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
                            double *udint, int *refd, int *hsize)
{
    double tod,tow;
    char *msg,tstr[64];
    int i=24+12,nsat,udi,provid=0,solid=0,ns;
    
    ns=sys==SYS_QZS?4:6;
    
    if (i+(sys==SYS_GLO?53:50+ns)>rtcm->len*8) return -1;
    
    if (sys==SYS_GLO) {
        tod=getbitu(rtcm->buff,i,17); i+=17;
        adjday_glot(rtcm,tod);
    }
    else {
        tow=getbitu(rtcm->buff,i,20); i+=20;
        adjweek(rtcm,tow);
    }
    udi   =getbitu(rtcm->buff,i, 4); i+= 4;
    *sync =getbitu(rtcm->buff,i, 1); i+= 1;
    *refd =getbitu(rtcm->buff,i, 1); i+= 1; /* satellite ref datum */
    *iod  =getbitu(rtcm->buff,i, 4); i+= 4; /* iod */
    provid=getbitu(rtcm->buff,i,16); i+=16; /* provider id */
    solid =getbitu(rtcm->buff,i, 4); i+= 4; /* solution id */
    nsat  =getbitu(rtcm->buff,i,ns); i+=ns;
    *udint=ssrudint[udi];
    
    time2str(rtcm->time,tstr,2);
    trace(4,"decode_ssr1_head: time=%s sys=%d nsat=%d sync=%d iod=%d provid=%d solid=%d\n",
          tstr,sys,nsat,*sync,*iod,provid,solid);
    
    if (rtcm->outtype) {
        msg=rtcm->msgtype+strlen(rtcm->msgtype);
        sprintf(msg," %s nsat=%2d iod=%2d udi=%2d sync=%d",tstr,nsat,*iod,udi,
                *sync);
    }
    *hsize=i;
    return nsat;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x24, -0x94(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0xa4(%rbp)
movl -0x14(%rbp), %edx
movl $0x6, %eax
movl $0x4, %ecx
cmpl $0x10, %edx
cmovel %ecx, %eax
movl %eax, -0xa8(%rbp)
movl -0x94(%rbp), %eax
movl %eax, -0xbc(%rbp)
cmpl $0x4, -0x14(%rbp)
jne 0x7ab4c
movl $0x35, %eax
movl %eax, -0xc0(%rbp)
jmp 0x7ab5b
movl -0xa8(%rbp), %eax
addl $0x32, %eax
movl %eax, -0xc0(%rbp)
movl -0xbc(%rbp), %eax
movl -0xc0(%rbp), %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jle 0x7ab86
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ae98
cmpl $0x4, -0x14(%rbp)
jne 0x7abd2
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x11, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x94(%rbp), %eax
addl $0x11, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
callq 0x7a780
jmp 0x7ac16
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x14, %edx
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x94(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
movsd -0x48(%rbp), %xmm0
callq 0x7a020
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x4, %edx
callq 0x8bfc0
movl %eax, -0x9c(%rbp)
movl -0x94(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x4, %edx
callq 0x8bfc0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x94(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x10, %edx
callq 0x8bfc0
movl %eax, -0xa0(%rbp)
movl -0x94(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl $0x4, %edx
callq 0x8bfc0
movl %eax, -0xa4(%rbp)
movl -0x94(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x94(%rbp), %esi
movl -0xa8(%rbp), %edx
callq 0x8bfc0
movl %eax, -0x98(%rbp)
movl -0xa8(%rbp), %eax
addl -0x94(%rbp), %eax
movl %eax, -0x94(%rbp)
movslq -0x9c(%rbp), %rcx
leaq 0x46192(%rip), %rax     # 0xc0f10
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0xb8(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0xb0(%rbp)
leaq -0x90(%rbp), %rsi
movq -0xb8(%rbp), %rdi
movsd -0xb0(%rbp), %xmm0
movl $0x2, %edx
callq 0x8f550
leaq -0x90(%rbp), %rdx
movl -0x14(%rbp), %ecx
movl -0x98(%rbp), %r8d
movq -0x20(%rbp), %rax
movl (%rax), %r9d
movq -0x28(%rbp), %rax
movl (%rax), %r11d
movl -0xa0(%rbp), %r10d
movl -0xa4(%rbp), %eax
movl $0x4, %edi
leaq 0x46c94(%rip), %rsi     # 0xc1a91
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x8b980
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x7ae83
movq -0x10(%rbp), %rax
addq $0x9b9d0, %rax          # imm = 0x9B9D0
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
callq 0x92e0
movq %rax, %rcx
movq -0xc8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rdx
movl -0x98(%rbp), %ecx
movq -0x28(%rbp), %rax
movl (%rax), %r8d
movl -0x9c(%rbp), %r9d
movq -0x20(%rbp), %rax
movl (%rax), %eax
leaq 0x46c64(%rip), %rsi     # 0xc1add
movl %eax, (%rsp)
movb $0x0, %al
callq 0x9150
movl -0x94(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x98(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)