// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr2_head(bamboo::rtcm_t*, int, int*, int*, double*, int*)
static int decode_ssr2_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
                            double *udint, 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?52:49+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;
    *iod  =getbitu(rtcm->buff,i, 4); i+= 4;
    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_ssr2_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 %rdi, %r15
xorl %eax, %eax
cmpl $0x10, %esi
setne %al
cmpl $0x4, %esi
leal 0x59(%rax,%rax), %r10d
movl $0x58, %edi
cmovnel %r10d, %edi
movl 0x9f0c0(%r15), %r10d
shll $0x3, %r10d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl %r10d, %edi
jg 0x42f58
movq %rdx, %r12
movq %r8, -0x38(%rbp)
movq %rcx, -0x48(%rbp)
movq %r9, -0x68(%rbp)
leal 0x4(,%rax,2), %eax
movq %rax, -0x30(%rbp)
leaq 0x9f0c4(%r15), %r14
movl %esi, -0x40(%rbp)
cmpl $0x4, %esi
movq %r15, -0x60(%rbp)
movq %r14, %rdi
movl $0x24, %esi
jne 0x42de0
movl $0x11, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x42a20
movl $0x35, %r15d
jmp 0x42dff
movl $0x14, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x42786
movl $0x38, %r15d
movq %r14, %rdi
movl %r15d, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %r13d
leal 0x4(%r15), %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x4d9d6
movl %eax, (%r12)
leal 0x5(%r15), %esi
movq %r14, %rdi
movl $0x4, %edx
callq 0x4d9d6
movq -0x48(%rbp), %rcx
movl %eax, (%rcx)
leal 0x9(%r15), %esi
movq %r14, %rdi
movl $0x10, %edx
callq 0x4d9d6
movq %rax, -0x58(%rbp)
leal 0x19(%r15), %esi
movq %r14, %rdi
movl $0x4, %edx
callq 0x4d9d6
movq %rax, -0x50(%rbp)
leal 0x1d(%r15), %esi
movq %r14, %rdi
movq -0x30(%rbp), %rbx
movl %ebx, %edx
callq 0x4d9d6
movl %eax, %r14d
leal (%r15,%rbx), %eax
addl $0x1d, %eax
movl %eax, -0x30(%rbp)
movl %r13d, -0x3c(%rbp)
movslq %r13d, %rax
movq -0x48(%rbp), %r13
leaq 0x2bd67(%rip), %rcx     # 0x6ec00
movsd (%rcx,%rax,8), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x60(%rbp), %r15
movq 0x10(%r15), %rdi
movsd 0x18(%r15), %xmm0
leaq -0xb0(%rbp), %rbx
movq %rbx, %rsi
movl $0x2, %edx
callq 0x4fcf1
movq %r12, -0x38(%rbp)
movl (%r12), %r9d
movl (%r13), %r10d
subq $0x8, %rsp
leaq 0x2c9fe(%rip), %rsi     # 0x6f8dd
movl $0x4, %edi
movq %rbx, %rdx
movl -0x40(%rbp), %ecx
movl %r14d, %r8d
xorl %eax, %eax
pushq -0x50(%rbp)
pushq -0x58(%rbp)
pushq %r10
callq 0x4d55d
addq $0x20, %rsp
cmpl $0x0, 0xc(%r15)
je 0x42f4f
leaq 0x9b9d0(%r15), %rdi
callq 0x8290
leaq (%r15,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movl (%r13), %r8d
movq -0x38(%rbp), %rax
movl (%rax), %r10d
subq $0x8, %rsp
leaq 0x2c984(%rip), %rsi     # 0x6f8b8
leaq -0xb0(%rbp), %rdx
movl %r14d, %ecx
movl -0x3c(%rbp), %r9d
xorl %eax, %eax
pushq %r10
callq 0x8120
addq $0x10, %rsp
movq -0x68(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, (%rax)
movl %r14d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq