// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %eax, %eax
cmpl $0x10, %esi
setne %al
cmpl $0x4, %esi
leal 0x59(%rax,%rax), %r11d
pushq $0x58
popq %r10
cmovnel %r11d, %r10d
movq %rdi, %r15
movl 0x9f0c0(%rdi), %edi
shll $0x3, %edi
cmpl %edi, %r10d
jle 0x3b9b8
pushq $-0x1
popq %rbx
jmp 0x3bb6d
movq %rdx, %r14
movq %r8, -0x40(%rbp)
movq %rcx, -0x68(%rbp)
movq %r9, -0x70(%rbp)
leal 0x4(,%rax,2), %eax
movq %rax, -0x38(%rbp)
leaq 0x9f0c4(%r15), %rbx
movl %esi, -0x44(%rbp)
cmpl $0x4, %esi
movq %r15, -0x60(%rbp)
pushq $0x24
popq %rsi
jne 0x3ba06
pushq $0x11
popq %rdx
movq %rbx, %rdi
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x3b61c
pushq $0x35
jmp 0x3ba22
pushq $0x14
popq %rdx
movq %rbx, %rdi
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x3b289
pushq $0x38
popq %r15
pushq $0x4
popq %r12
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x459f7
movl %eax, -0x2c(%rbp)
leal 0x4(%r15), %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x459f7
movl %eax, (%r14)
leal 0x5(%r15), %esi
movq %rbx, %rdi
movl %r12d, %edx
callq 0x459f7
movq -0x68(%rbp), %r13
movl %eax, (%r13)
leal 0x9(%r15), %esi
pushq $0x10
popq %rdx
movq %rbx, %rdi
callq 0x459f7
movq %rax, -0x58(%rbp)
leal 0x19(%r15), %esi
movq %rbx, %rdi
movl %r12d, %edx
callq 0x459f7
movq %r14, %r12
movq %rax, -0x50(%rbp)
leal 0x1d(%r15), %esi
movq %rbx, %rdi
movq -0x38(%rbp), %r14
movl %r14d, %edx
callq 0x459f7
movl %eax, %ebx
leal (%r15,%r14), %eax
addl $0x1d, %eax
movl %eax, -0x38(%rbp)
movslq -0x2c(%rbp), %rax
leaq 0x2923b(%rip), %rcx     # 0x64cf0
movsd (%rcx,%rax,8), %xmm0
movq -0x40(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x60(%rbp), %r15
movq 0x10(%r15), %rdi
movsd 0x18(%r15), %xmm0
leaq -0xb0(%rbp), %r14
pushq $0x2
popq %rdx
movq %r14, %rsi
callq 0x47a48
movq %r12, -0x40(%rbp)
movl (%r12), %r9d
movl (%r13), %r10d
subq $0x8, %rsp
leaq 0x29de0(%rip), %rsi     # 0x658d9
pushq $0x4
popq %rdi
movq %r14, %rdx
movl -0x44(%rbp), %ecx
movl %ebx, %r8d
xorl %eax, %eax
pushq -0x50(%rbp)
pushq -0x58(%rbp)
pushq %r10
callq 0x455bc
addq $0x20, %rsp
cmpl $0x0, 0xc(%r15)
je 0x3bb64
leaq 0x9b9d0(%r15), %rdi
callq 0x8290
leaq (%r15,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movl (%r13), %r8d
movq -0x40(%rbp), %rax
movl (%rax), %r10d
subq $0x8, %rsp
leaq 0x29d68(%rip), %rsi     # 0x658b4
leaq -0xb0(%rbp), %rdx
movl %ebx, %ecx
movl -0x2c(%rbp), %r9d
xorl %eax, %eax
pushq %r10
callq 0x8110
popq %rcx
popq %rdx
movq -0x70(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, (%rax)
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq