// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, %rbx
movq %rdi, %r15
xorl %eax, %eax
cmpl $0x10, %esi
setne %al
cmpl $0x4, %esi
leal 0x5a(%rax,%rax), %edi
movl $0x59, %r9d
cmovnel %edi, %r9d
movl 0x9f0c0(%r15), %edi
shll $0x3, %edi
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl %edi, %r9d
jg 0x42d2b
movq %r8, -0x68(%rbp)
movq %rcx, -0x48(%rbp)
movq %rdx, -0x50(%rbp)
leal 0x4(,%rax,2), %eax
movq %rax, -0x38(%rbp)
leaq 0x9f0c4(%r15), %r13
movl %esi, -0x3c(%rbp)
movq %r13, %rdi
cmpl $0x4, %esi
jne 0x42ba4
movl $0x24, %esi
movl $0x11, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x42a20
movl $0x35, %r14d
jmp 0x42bc8
movl $0x24, %esi
movl $0x14, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x42786
movl $0x38, %r14d
movq %r13, %rdi
movl %r14d, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, -0x2c(%rbp)
leal 0x4(%r14), %esi
movq %r13, %rdi
movl $0x1, %edx
callq 0x4d9d6
movq -0x50(%rbp), %rcx
movl %eax, (%rcx)
leal 0x5(%r14), %esi
movq %r13, %rdi
movl $0x1, %edx
callq 0x4d9d6
movl %eax, (%rbx)
leal 0x6(%r14), %esi
movq %r13, %rdi
movl $0x4, %edx
callq 0x4d9d6
movq -0x48(%rbp), %r12
movl %eax, (%r12)
leal 0xa(%r14), %esi
movq %r13, %rdi
movl $0x10, %edx
callq 0x4d9d6
movq %rax, -0x60(%rbp)
leal 0x1a(%r14), %esi
movq %r13, %rdi
movl $0x4, %edx
callq 0x4d9d6
movq %rax, -0x58(%rbp)
leal 0x1e(%r14), %esi
movq %r13, %rdi
movq -0x38(%rbp), %rbx
movl %ebx, %edx
callq 0x4d9d6
movl %eax, %r13d
leal (%r14,%rbx), %eax
addl $0x1e, %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rbx
movslq -0x2c(%rbp), %rax
leaq 0x2bf8a(%rip), %rcx     # 0x6ec00
movsd (%rcx,%rax,8), %xmm0
movq -0x68(%rbp), %rax
movsd %xmm0, (%rax)
movq 0x10(%r15), %rdi
movsd 0x18(%r15), %xmm0
leaq -0xb0(%rbp), %r14
movq %r14, %rsi
movl $0x2, %edx
callq 0x4fcf1
movl (%rbx), %r9d
movl (%r12), %r10d
subq $0x8, %rsp
leaq 0x2cbb9(%rip), %rsi     # 0x6f86c
movl $0x4, %edi
movq %r14, %rdx
movl -0x3c(%rbp), %ecx
movl %r13d, %r8d
xorl %eax, %eax
pushq -0x58(%rbp)
pushq -0x60(%rbp)
pushq %r10
callq 0x4d55d
addq $0x20, %rsp
cmpl $0x0, 0xc(%r15)
je 0x42d22
leaq 0x9b9d0(%r15), %rdi
callq 0x8290
leaq (%r15,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movq -0x48(%rbp), %rax
movl (%rax), %r8d
movl (%rbx), %r10d
subq $0x8, %rsp
leaq 0x2cbb1(%rip), %rsi     # 0x6f8b8
leaq -0xb0(%rbp), %rdx
movl %r13d, %ecx
movl -0x2c(%rbp), %r9d
xorl %eax, %eax
pushq %r10
callq 0x8120
addq $0x10, %rsp
movq 0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, (%rax)
movl %r13d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq